From ebb5bf10dc96dee40232deaa36810d20e1edb3b1 Mon Sep 17 00:00:00 2001 From: Nils Ponsard | Nitrokey Date: Mon, 18 Sep 2023 14:53:50 +0200 Subject: [PATCH] feat: update nethsm api client --- docs/developer-guide.rst | 13 + nethsm-api.yaml | 1209 ++++---- pynitrokey/nethsm/__init__.py | 339 ++- pynitrokey/nethsm/client/__init__.py | 8 +- pynitrokey/nethsm/client/api_client.py | 1468 +++++----- pynitrokey/nethsm/client/api_response.py | 28 + pynitrokey/nethsm/client/apis/path_to_api.py | 232 +- .../nethsm/client/apis/paths/__init__.py | 2 +- .../apis/paths/config_backup_passphrase.py | 10 +- .../client/apis/paths/config_logging.py | 14 +- .../client/apis/paths/config_network.py | 14 +- .../nethsm/client/apis/paths/config_time.py | 14 +- .../client/apis/paths/config_tls_cert_pem.py | 14 +- .../client/apis/paths/config_tls_csr_pem.py | 10 +- .../client/apis/paths/config_tls_generate.py | 10 +- .../apis/paths/config_tls_public_pem.py | 10 +- .../apis/paths/config_unattended_boot.py | 14 +- .../apis/paths/config_unlock_passphrase.py | 10 +- .../nethsm/client/apis/paths/health_alive.py | 10 +- .../nethsm/client/apis/paths/health_ready.py | 10 +- .../nethsm/client/apis/paths/health_state.py | 10 +- pynitrokey/nethsm/client/apis/paths/info.py | 10 +- pynitrokey/nethsm/client/apis/paths/keys.py | 14 +- .../nethsm/client/apis/paths/keys_generate.py | 10 +- .../nethsm/client/apis/paths/keys_key_id.py | 18 +- .../client/apis/paths/keys_key_id_cert.py | 18 +- .../client/apis/paths/keys_key_id_csr_pem.py | 10 +- .../client/apis/paths/keys_key_id_decrypt.py | 10 +- .../client/apis/paths/keys_key_id_encrypt.py | 10 +- .../apis/paths/keys_key_id_public_pem.py | 10 +- .../keys_key_id_restrictions_tags_tag.py | 14 +- .../client/apis/paths/keys_key_id_sign.py | 10 +- pynitrokey/nethsm/client/apis/paths/lock.py | 10 +- .../nethsm/client/apis/paths/metrics.py | 10 +- .../nethsm/client/apis/paths/provision.py | 10 +- pynitrokey/nethsm/client/apis/paths/random.py | 10 +- .../nethsm/client/apis/paths/system_backup.py | 10 +- .../client/apis/paths/system_cancel_update.py | 10 +- .../client/apis/paths/system_commit_update.py | 10 +- .../client/apis/paths/system_factory_reset.py | 10 +- .../nethsm/client/apis/paths/system_info.py | 10 +- .../nethsm/client/apis/paths/system_reboot.py | 10 +- .../client/apis/paths/system_restore.py | 10 +- .../client/apis/paths/system_shutdown.py | 10 +- .../nethsm/client/apis/paths/system_update.py | 10 +- pynitrokey/nethsm/client/apis/paths/unlock.py | 10 +- pynitrokey/nethsm/client/apis/paths/users.py | 14 +- .../nethsm/client/apis/paths/users_user_id.py | 18 +- .../apis/paths/users_user_id_passphrase.py | 10 +- .../client/apis/paths/users_user_id_tags.py | 10 +- .../apis/paths/users_user_id_tags_tag.py | 14 +- pynitrokey/nethsm/client/apis/tag_to_api.py | 8 +- .../nethsm/client/apis/tags/__init__.py | 8 +- .../nethsm/client/apis/tags/default_api.py | 223 +- .../nethsm/client/components/__init__.py | 0 .../components/request_bodies/__init__.py | 0 .../client/components/responses/__init__.py | 0 .../{model => components/schema}/__init__.py | 2 +- .../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 + pynitrokey/nethsm/client/configuration.py | 474 ---- .../nethsm/client/configurations/__init__.py | 0 .../configurations/api_configuration.py | 441 +++ .../configurations/schema_configuration.py | 105 + pynitrokey/nethsm/client/exceptions.py | 62 +- .../client/model/backup_passphrase_config.py | 88 - .../client/model/backup_passphrase_config.pyi | 88 - pynitrokey/nethsm/client/model/base64.py | 39 - pynitrokey/nethsm/client/model/base64.pyi | 34 - .../nethsm/client/model/decrypt_data.py | 88 - .../nethsm/client/model/decrypt_data.pyi | 88 - .../nethsm/client/model/decrypt_mode.py | 84 - .../nethsm/client/model/decrypt_mode.pyi | 70 - .../client/model/decrypt_request_data.py | 117 - .../client/model/decrypt_request_data.pyi | 117 - .../nethsm/client/model/distinguished_name.py | 143 - .../client/model/distinguished_name.pyi | 143 - .../nethsm/client/model/encrypt_data.py | 103 - .../nethsm/client/model/encrypt_data.pyi | 103 - .../nethsm/client/model/encrypt_mode.py | 44 - .../nethsm/client/model/encrypt_mode.pyi | 38 - .../client/model/encrypt_request_data.py | 117 - .../client/model/encrypt_request_data.pyi | 117 - .../nethsm/client/model/health_state_data.py | 88 - .../nethsm/client/model/health_state_data.pyi | 88 - pynitrokey/nethsm/client/model/id.py | 41 - pynitrokey/nethsm/client/model/id.pyi | 34 - pynitrokey/nethsm/client/model/info_data.py | 95 - pynitrokey/nethsm/client/model/info_data.pyi | 95 - .../client/model/key_generate_request_data.py | 151 - .../model/key_generate_request_data.pyi | 147 - pynitrokey/nethsm/client/model/key_item.py | 88 - pynitrokey/nethsm/client/model/key_item.pyi | 88 - pynitrokey/nethsm/client/model/key_list.py | 56 - pynitrokey/nethsm/client/model/key_list.pyi | 56 - .../nethsm/client/model/key_mechanism.py | 134 - .../nethsm/client/model/key_mechanism.pyi | 110 - .../nethsm/client/model/key_mechanisms.py | 56 - .../nethsm/client/model/key_mechanisms.pyi | 56 - .../nethsm/client/model/key_private_data.py | 122 - .../nethsm/client/model/key_private_data.pyi | 122 - .../nethsm/client/model/key_public_data.py | 109 - .../nethsm/client/model/key_public_data.pyi | 109 - .../nethsm/client/model/key_restrictions.py | 83 - .../nethsm/client/model/key_restrictions.pyi | 83 - pynitrokey/nethsm/client/model/key_type.py | 74 - pynitrokey/nethsm/client/model/key_type.pyi | 62 - pynitrokey/nethsm/client/model/log_level.py | 59 - pynitrokey/nethsm/client/model/log_level.pyi | 50 - .../nethsm/client/model/logging_config.py | 112 - .../nethsm/client/model/logging_config.pyi | 112 - .../nethsm/client/model/network_config.py | 107 - .../nethsm/client/model/network_config.pyi | 107 - pynitrokey/nethsm/client/model/passphrase.py | 37 - pynitrokey/nethsm/client/model/passphrase.pyi | 34 - pynitrokey/nethsm/client/model/pem_cert.py | 24 - pynitrokey/nethsm/client/model/pem_cert.pyi | 24 - pynitrokey/nethsm/client/model/pem_csr.py | 24 - pynitrokey/nethsm/client/model/pem_csr.pyi | 24 - .../nethsm/client/model/pem_private_key.py | 24 - .../nethsm/client/model/pem_private_key.pyi | 24 - .../nethsm/client/model/pem_public_key.py | 24 - .../nethsm/client/model/pem_public_key.pyi | 24 - .../nethsm/client/model/pgp_private_key.py | 24 - .../nethsm/client/model/pgp_private_key.pyi | 24 - pynitrokey/nethsm/client/model/private_key.py | 134 - .../nethsm/client/model/private_key.pyi | 134 - .../client/model/provision_request_data.py | 115 - .../client/model/provision_request_data.pyi | 115 - pynitrokey/nethsm/client/model/public_key.py | 203 -- pynitrokey/nethsm/client/model/public_key.pyi | 203 -- pynitrokey/nethsm/client/model/random_data.py | 88 - .../nethsm/client/model/random_data.pyi | 88 - .../client/model/random_request_data.py | 92 - .../client/model/random_request_data.pyi | 88 - pynitrokey/nethsm/client/model/sign_data.py | 88 - pynitrokey/nethsm/client/model/sign_data.pyi | 88 - pynitrokey/nethsm/client/model/sign_mode.py | 84 - pynitrokey/nethsm/client/model/sign_mode.pyi | 70 - .../nethsm/client/model/sign_request_data.py | 104 - .../nethsm/client/model/sign_request_data.pyi | 104 - pynitrokey/nethsm/client/model/switch.py | 49 - pynitrokey/nethsm/client/model/switch.pyi | 42 - pynitrokey/nethsm/client/model/system_info.py | 119 - .../nethsm/client/model/system_info.pyi | 119 - .../nethsm/client/model/system_state.py | 54 - .../nethsm/client/model/system_state.pyi | 46 - .../nethsm/client/model/system_update_data.py | 83 - .../client/model/system_update_data.pyi | 83 - pynitrokey/nethsm/client/model/tag_list.py | 56 - pynitrokey/nethsm/client/model/tag_list.pyi | 56 - pynitrokey/nethsm/client/model/time_config.py | 83 - .../nethsm/client/model/time_config.pyi | 83 - .../model/tls_key_generate_request_data.py | 107 - .../model/tls_key_generate_request_data.pyi | 103 - .../nethsm/client/model/tls_key_type.py | 69 - .../nethsm/client/model/tls_key_type.pyi | 58 - .../client/model/unattended_boot_config.py | 88 - .../client/model/unattended_boot_config.pyi | 88 - .../client/model/unlock_passphrase_config.py | 88 - .../client/model/unlock_passphrase_config.pyi | 88 - .../client/model/unlock_request_data.py | 88 - .../client/model/unlock_request_data.pyi | 88 - pynitrokey/nethsm/client/model/user_data.py | 100 - pynitrokey/nethsm/client/model/user_data.pyi | 100 - pynitrokey/nethsm/client/model/user_item.py | 88 - pynitrokey/nethsm/client/model/user_item.pyi | 88 - pynitrokey/nethsm/client/model/user_list.py | 56 - pynitrokey/nethsm/client/model/user_list.pyi | 56 - .../client/model/user_passphrase_post_data.py | 88 - .../model/user_passphrase_post_data.pyi | 88 - .../nethsm/client/model/user_post_data.py | 116 - .../nethsm/client/model/user_post_data.pyi | 116 - pynitrokey/nethsm/client/model/user_role.py | 59 - pynitrokey/nethsm/client/model/user_role.pyi | 50 - pynitrokey/nethsm/client/models/__init__.py | 68 - pynitrokey/nethsm/client/paths/__init__.py | 50 +- .../config_backup_passphrase/__init__.py | 6 +- .../paths/config_backup_passphrase/put.py | 354 --- .../paths/config_backup_passphrase/put.pyi | 342 --- .../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 | 6 +- .../nethsm/client/paths/config_logging/get.py | 277 -- .../client/paths/config_logging/get.pyi | 266 -- .../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 + .../nethsm/client/paths/config_logging/put.py | 354 --- .../client/paths/config_logging/put.pyi | 342 --- .../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 | 6 +- .../nethsm/client/paths/config_network/get.py | 277 -- .../client/paths/config_network/get.pyi | 266 -- .../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 + .../nethsm/client/paths/config_network/put.py | 354 --- .../client/paths/config_network/put.pyi | 342 --- .../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 | 6 +- .../nethsm/client/paths/config_time/get.py | 277 -- .../nethsm/client/paths/config_time/get.pyi | 266 -- .../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 + .../nethsm/client/paths/config_time/put.py | 354 --- .../nethsm/client/paths/config_time/put.pyi | 342 --- .../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 | 6 +- .../client/paths/config_tls_cert_pem/get.py | 275 -- .../client/paths/config_tls_cert_pem/get.pyi | 264 -- .../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 + .../client/paths/config_tls_cert_pem/put.py | 339 --- .../client/paths/config_tls_cert_pem/put.pyi | 328 --- .../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 | 6 +- .../client/paths/config_tls_csr_pem/post.py | 371 --- .../client/paths/config_tls_csr_pem/post.pyi | 360 --- .../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 | 6 +- .../client/paths/config_tls_generate/post.py | 354 --- .../client/paths/config_tls_generate/post.pyi | 342 --- .../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 | 6 +- .../client/paths/config_tls_public_pem/get.py | 275 -- .../paths/config_tls_public_pem/get.pyi | 264 -- .../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 | 6 +- .../paths/config_unattended_boot/get.py | 277 -- .../paths/config_unattended_boot/get.pyi | 266 -- .../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 + .../paths/config_unattended_boot/put.py | 354 --- .../paths/config_unattended_boot/put.pyi | 342 --- .../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 | 6 +- .../paths/config_unlock_passphrase/put.py | 354 --- .../paths/config_unlock_passphrase/put.pyi | 342 --- .../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 | 6 +- .../nethsm/client/paths/health_alive/get.py | 214 -- .../nethsm/client/paths/health_alive/get.pyi | 208 -- .../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 | 6 +- .../nethsm/client/paths/health_ready/get.py | 214 -- .../nethsm/client/paths/health_ready/get.pyi | 208 -- .../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 | 6 +- .../nethsm/client/paths/health_state/get.py | 234 -- .../nethsm/client/paths/health_state/get.pyi | 229 -- .../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 | 6 +- pynitrokey/nethsm/client/paths/info/get.py | 234 -- pynitrokey/nethsm/client/paths/info/get.pyi | 229 -- .../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 | 6 +- pynitrokey/nethsm/client/paths/keys/get.py | 331 --- pynitrokey/nethsm/client/paths/keys/get.pyi | 320 --- .../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 + pynitrokey/nethsm/client/paths/keys/post.py | 514 ---- pynitrokey/nethsm/client/paths/keys/post.pyi | 502 ---- .../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 | 6 +- .../nethsm/client/paths/keys_generate/post.py | 354 --- .../client/paths/keys_generate/post.pyi | 342 --- .../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 | 6 +- .../nethsm/client/paths/keys_key_id/delete.py | 311 --- .../client/paths/keys_key_id/delete.pyi | 299 -- .../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 + .../nethsm/client/paths/keys_key_id/get.py | 344 --- .../nethsm/client/paths/keys_key_id/get.pyi | 332 --- .../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 + .../nethsm/client/paths/keys_key_id/put.py | 587 ---- .../nethsm/client/paths/keys_key_id/put.pyi | 574 ---- .../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 | 6 +- .../client/paths/keys_key_id_cert/delete.py | 311 --- .../client/paths/keys_key_id_cert/delete.pyi | 299 -- .../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 + .../client/paths/keys_key_id_cert/get.py | 342 --- .../client/paths/keys_key_id_cert/get.pyi | 330 --- .../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 + .../client/paths/keys_key_id_cert/put.py | 493 ---- .../client/paths/keys_key_id_cert/put.pyi | 481 ---- .../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 | 6 +- .../client/paths/keys_key_id_csr_pem/post.py | 441 --- .../client/paths/keys_key_id_csr_pem/post.pyi | 429 --- .../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 | 6 +- .../client/paths/keys_key_id_decrypt/post.py | 455 --- .../client/paths/keys_key_id_decrypt/post.pyi | 442 --- .../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 | 6 +- .../client/paths/keys_key_id_encrypt/post.py | 455 --- .../client/paths/keys_key_id_encrypt/post.pyi | 442 --- .../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 | 6 +- .../paths/keys_key_id_public_pem/get.py | 342 --- .../paths/keys_key_id_public_pem/get.pyi | 330 --- .../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 | 6 +- .../delete.py | 320 --- .../delete.pyi | 308 --- .../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 + .../keys_key_id_restrictions_tags_tag/put.py | 346 --- .../keys_key_id_restrictions_tags_tag/put.pyi | 332 --- .../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 | 6 +- .../client/paths/keys_key_id_sign/post.py | 455 --- .../client/paths/keys_key_id_sign/post.pyi | 442 --- .../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 | 6 +- pynitrokey/nethsm/client/paths/lock/post.py | 244 -- pynitrokey/nethsm/client/paths/lock/post.pyi | 233 -- .../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 | 6 +- pynitrokey/nethsm/client/paths/metrics/get.py | 275 -- .../nethsm/client/paths/metrics/get.pyi | 264 -- .../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 | 6 +- .../nethsm/client/paths/provision/post.py | 324 --- .../nethsm/client/paths/provision/post.pyi | 317 --- .../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 | 6 +- pynitrokey/nethsm/client/paths/random/post.py | 372 --- .../nethsm/client/paths/random/post.pyi | 361 --- .../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 | 6 +- .../nethsm/client/paths/system_backup/post.py | 244 -- .../client/paths/system_backup/post.pyi | 233 -- .../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 | 6 +- .../client/paths/system_cancel_update/post.py | 244 -- .../paths/system_cancel_update/post.pyi | 233 -- .../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 | 6 +- .../client/paths/system_commit_update/post.py | 244 -- .../paths/system_commit_update/post.pyi | 233 -- .../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 | 6 +- .../client/paths/system_factory_reset/post.py | 244 -- .../paths/system_factory_reset/post.pyi | 233 -- .../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 | 6 +- .../nethsm/client/paths/system_info/get.py | 277 -- .../nethsm/client/paths/system_info/get.pyi | 266 -- .../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 | 6 +- .../nethsm/client/paths/system_reboot/post.py | 244 -- .../client/paths/system_reboot/post.pyi | 233 -- .../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 | 6 +- .../client/paths/system_restore/post.py | 392 --- .../client/paths/system_restore/post.pyi | 385 --- .../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 | 6 +- .../client/paths/system_shutdown/post.py | 244 -- .../client/paths/system_shutdown/post.pyi | 233 -- .../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 | 6 +- .../nethsm/client/paths/system_update/post.py | 384 --- .../client/paths/system_update/post.pyi | 372 --- .../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 | 6 +- pynitrokey/nethsm/client/paths/unlock/post.py | 337 --- .../nethsm/client/paths/unlock/post.pyi | 329 --- .../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 | 6 +- pynitrokey/nethsm/client/paths/users/get.py | 277 -- pynitrokey/nethsm/client/paths/users/get.pyi | 266 -- .../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 + pynitrokey/nethsm/client/paths/users/post.py | 354 --- pynitrokey/nethsm/client/paths/users/post.pyi | 342 --- .../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 | 6 +- .../client/paths/users_user_id/delete.py | 311 --- .../client/paths/users_user_id/delete.pyi | 299 -- .../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 + .../nethsm/client/paths/users_user_id/get.py | 344 --- .../nethsm/client/paths/users_user_id/get.pyi | 332 --- .../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 + .../nethsm/client/paths/users_user_id/put.py | 424 --- .../nethsm/client/paths/users_user_id/put.pyi | 411 --- .../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 | 6 +- .../paths/users_user_id_passphrase/post.py | 424 --- .../paths/users_user_id_passphrase/post.pyi | 411 --- .../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 | 6 +- .../client/paths/users_user_id_tags/get.py | 344 --- .../client/paths/users_user_id_tags/get.pyi | 332 --- .../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 | 6 +- .../paths/users_user_id_tags_tag/delete.py | 320 --- .../paths/users_user_id_tags_tag/delete.pyi | 308 --- .../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 + .../paths/users_user_id_tags_tag/put.py | 346 --- .../paths/users_user_id_tags_tag/put.pyi | 332 --- .../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 | 80 +- pynitrokey/nethsm/client/schemas.py | 2462 ----------------- 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 + 1320 files changed, 35946 insertions(+), 52297 deletions(-) create mode 100644 pynitrokey/nethsm/client/api_response.py create mode 100644 pynitrokey/nethsm/client/components/__init__.py create mode 100644 pynitrokey/nethsm/client/components/request_bodies/__init__.py create mode 100644 pynitrokey/nethsm/client/components/responses/__init__.py rename pynitrokey/nethsm/client/{model => components/schema}/__init__.py (80%) create mode 100644 pynitrokey/nethsm/client/components/schema/backup_passphrase_config.py create mode 100644 pynitrokey/nethsm/client/components/schema/base64.py create mode 100644 pynitrokey/nethsm/client/components/schema/decrypt_data.py create mode 100644 pynitrokey/nethsm/client/components/schema/decrypt_mode.py create mode 100644 pynitrokey/nethsm/client/components/schema/decrypt_request_data.py create mode 100644 pynitrokey/nethsm/client/components/schema/distinguished_name.py create mode 100644 pynitrokey/nethsm/client/components/schema/encrypt_data.py create mode 100644 pynitrokey/nethsm/client/components/schema/encrypt_mode.py create mode 100644 pynitrokey/nethsm/client/components/schema/encrypt_request_data.py create mode 100644 pynitrokey/nethsm/client/components/schema/health_state_data.py create mode 100644 pynitrokey/nethsm/client/components/schema/id.py create mode 100644 pynitrokey/nethsm/client/components/schema/info_data.py create mode 100644 pynitrokey/nethsm/client/components/schema/key_generate_request_data.py create mode 100644 pynitrokey/nethsm/client/components/schema/key_item.py create mode 100644 pynitrokey/nethsm/client/components/schema/key_list.py create mode 100644 pynitrokey/nethsm/client/components/schema/key_mechanism.py create mode 100644 pynitrokey/nethsm/client/components/schema/key_mechanisms.py create mode 100644 pynitrokey/nethsm/client/components/schema/key_private_data.py create mode 100644 pynitrokey/nethsm/client/components/schema/key_public_data.py create mode 100644 pynitrokey/nethsm/client/components/schema/key_restrictions.py create mode 100644 pynitrokey/nethsm/client/components/schema/key_type.py create mode 100644 pynitrokey/nethsm/client/components/schema/log_level.py create mode 100644 pynitrokey/nethsm/client/components/schema/logging_config.py create mode 100644 pynitrokey/nethsm/client/components/schema/metrics_data.py create mode 100644 pynitrokey/nethsm/client/components/schema/network_config.py create mode 100644 pynitrokey/nethsm/client/components/schema/passphrase.py create mode 100644 pynitrokey/nethsm/client/components/schema/pem_cert.py create mode 100644 pynitrokey/nethsm/client/components/schema/pem_csr.py create mode 100644 pynitrokey/nethsm/client/components/schema/pem_private_key.py create mode 100644 pynitrokey/nethsm/client/components/schema/pem_public_key.py create mode 100644 pynitrokey/nethsm/client/components/schema/pgp_private_key.py create mode 100644 pynitrokey/nethsm/client/components/schema/private_key.py create mode 100644 pynitrokey/nethsm/client/components/schema/provision_request_data.py create mode 100644 pynitrokey/nethsm/client/components/schema/public_key.py create mode 100644 pynitrokey/nethsm/client/components/schema/random_data.py create mode 100644 pynitrokey/nethsm/client/components/schema/random_request_data.py create mode 100644 pynitrokey/nethsm/client/components/schema/sign_data.py create mode 100644 pynitrokey/nethsm/client/components/schema/sign_mode.py create mode 100644 pynitrokey/nethsm/client/components/schema/sign_request_data.py create mode 100644 pynitrokey/nethsm/client/components/schema/switch.py create mode 100644 pynitrokey/nethsm/client/components/schema/system_info.py create mode 100644 pynitrokey/nethsm/client/components/schema/system_state.py create mode 100644 pynitrokey/nethsm/client/components/schema/system_update_data.py create mode 100644 pynitrokey/nethsm/client/components/schema/tag_list.py create mode 100644 pynitrokey/nethsm/client/components/schema/time_config.py create mode 100644 pynitrokey/nethsm/client/components/schema/tls_key_generate_request_data.py create mode 100644 pynitrokey/nethsm/client/components/schema/tls_key_type.py create mode 100644 pynitrokey/nethsm/client/components/schema/unattended_boot_config.py create mode 100644 pynitrokey/nethsm/client/components/schema/unlock_passphrase_config.py create mode 100644 pynitrokey/nethsm/client/components/schema/unlock_request_data.py create mode 100644 pynitrokey/nethsm/client/components/schema/user_data.py create mode 100644 pynitrokey/nethsm/client/components/schema/user_item.py create mode 100644 pynitrokey/nethsm/client/components/schema/user_list.py create mode 100644 pynitrokey/nethsm/client/components/schema/user_passphrase_post_data.py create mode 100644 pynitrokey/nethsm/client/components/schema/user_post_data.py create mode 100644 pynitrokey/nethsm/client/components/schema/user_role.py create mode 100644 pynitrokey/nethsm/client/components/schemas/__init__.py create mode 100644 pynitrokey/nethsm/client/components/security_schemes/__init__.py create mode 100644 pynitrokey/nethsm/client/components/security_schemes/security_scheme_basic.py delete mode 100644 pynitrokey/nethsm/client/configuration.py create mode 100644 pynitrokey/nethsm/client/configurations/__init__.py create mode 100644 pynitrokey/nethsm/client/configurations/api_configuration.py create mode 100644 pynitrokey/nethsm/client/configurations/schema_configuration.py delete mode 100644 pynitrokey/nethsm/client/model/backup_passphrase_config.py delete mode 100644 pynitrokey/nethsm/client/model/backup_passphrase_config.pyi delete mode 100644 pynitrokey/nethsm/client/model/base64.py delete mode 100644 pynitrokey/nethsm/client/model/base64.pyi delete mode 100644 pynitrokey/nethsm/client/model/decrypt_data.py delete mode 100644 pynitrokey/nethsm/client/model/decrypt_data.pyi delete mode 100644 pynitrokey/nethsm/client/model/decrypt_mode.py delete mode 100644 pynitrokey/nethsm/client/model/decrypt_mode.pyi delete mode 100644 pynitrokey/nethsm/client/model/decrypt_request_data.py delete mode 100644 pynitrokey/nethsm/client/model/decrypt_request_data.pyi delete mode 100644 pynitrokey/nethsm/client/model/distinguished_name.py delete mode 100644 pynitrokey/nethsm/client/model/distinguished_name.pyi delete mode 100644 pynitrokey/nethsm/client/model/encrypt_data.py delete mode 100644 pynitrokey/nethsm/client/model/encrypt_data.pyi delete mode 100644 pynitrokey/nethsm/client/model/encrypt_mode.py delete mode 100644 pynitrokey/nethsm/client/model/encrypt_mode.pyi delete mode 100644 pynitrokey/nethsm/client/model/encrypt_request_data.py delete mode 100644 pynitrokey/nethsm/client/model/encrypt_request_data.pyi delete mode 100644 pynitrokey/nethsm/client/model/health_state_data.py delete mode 100644 pynitrokey/nethsm/client/model/health_state_data.pyi delete mode 100644 pynitrokey/nethsm/client/model/id.py delete mode 100644 pynitrokey/nethsm/client/model/id.pyi delete mode 100644 pynitrokey/nethsm/client/model/info_data.py delete mode 100644 pynitrokey/nethsm/client/model/info_data.pyi delete mode 100644 pynitrokey/nethsm/client/model/key_generate_request_data.py delete mode 100644 pynitrokey/nethsm/client/model/key_generate_request_data.pyi delete mode 100644 pynitrokey/nethsm/client/model/key_item.py delete mode 100644 pynitrokey/nethsm/client/model/key_item.pyi delete mode 100644 pynitrokey/nethsm/client/model/key_list.py delete mode 100644 pynitrokey/nethsm/client/model/key_list.pyi delete mode 100644 pynitrokey/nethsm/client/model/key_mechanism.py delete mode 100644 pynitrokey/nethsm/client/model/key_mechanism.pyi delete mode 100644 pynitrokey/nethsm/client/model/key_mechanisms.py delete mode 100644 pynitrokey/nethsm/client/model/key_mechanisms.pyi delete mode 100644 pynitrokey/nethsm/client/model/key_private_data.py delete mode 100644 pynitrokey/nethsm/client/model/key_private_data.pyi delete mode 100644 pynitrokey/nethsm/client/model/key_public_data.py delete mode 100644 pynitrokey/nethsm/client/model/key_public_data.pyi delete mode 100644 pynitrokey/nethsm/client/model/key_restrictions.py delete mode 100644 pynitrokey/nethsm/client/model/key_restrictions.pyi delete mode 100644 pynitrokey/nethsm/client/model/key_type.py delete mode 100644 pynitrokey/nethsm/client/model/key_type.pyi delete mode 100644 pynitrokey/nethsm/client/model/log_level.py delete mode 100644 pynitrokey/nethsm/client/model/log_level.pyi delete mode 100644 pynitrokey/nethsm/client/model/logging_config.py delete mode 100644 pynitrokey/nethsm/client/model/logging_config.pyi delete mode 100644 pynitrokey/nethsm/client/model/network_config.py delete mode 100644 pynitrokey/nethsm/client/model/network_config.pyi delete mode 100644 pynitrokey/nethsm/client/model/passphrase.py delete mode 100644 pynitrokey/nethsm/client/model/passphrase.pyi delete mode 100644 pynitrokey/nethsm/client/model/pem_cert.py delete mode 100644 pynitrokey/nethsm/client/model/pem_cert.pyi delete mode 100644 pynitrokey/nethsm/client/model/pem_csr.py delete mode 100644 pynitrokey/nethsm/client/model/pem_csr.pyi delete mode 100644 pynitrokey/nethsm/client/model/pem_private_key.py delete mode 100644 pynitrokey/nethsm/client/model/pem_private_key.pyi delete mode 100644 pynitrokey/nethsm/client/model/pem_public_key.py delete mode 100644 pynitrokey/nethsm/client/model/pem_public_key.pyi delete mode 100644 pynitrokey/nethsm/client/model/pgp_private_key.py delete mode 100644 pynitrokey/nethsm/client/model/pgp_private_key.pyi delete mode 100644 pynitrokey/nethsm/client/model/private_key.py delete mode 100644 pynitrokey/nethsm/client/model/private_key.pyi delete mode 100644 pynitrokey/nethsm/client/model/provision_request_data.py delete mode 100644 pynitrokey/nethsm/client/model/provision_request_data.pyi delete mode 100644 pynitrokey/nethsm/client/model/public_key.py delete mode 100644 pynitrokey/nethsm/client/model/public_key.pyi delete mode 100644 pynitrokey/nethsm/client/model/random_data.py delete mode 100644 pynitrokey/nethsm/client/model/random_data.pyi delete mode 100644 pynitrokey/nethsm/client/model/random_request_data.py delete mode 100644 pynitrokey/nethsm/client/model/random_request_data.pyi delete mode 100644 pynitrokey/nethsm/client/model/sign_data.py delete mode 100644 pynitrokey/nethsm/client/model/sign_data.pyi delete mode 100644 pynitrokey/nethsm/client/model/sign_mode.py delete mode 100644 pynitrokey/nethsm/client/model/sign_mode.pyi delete mode 100644 pynitrokey/nethsm/client/model/sign_request_data.py delete mode 100644 pynitrokey/nethsm/client/model/sign_request_data.pyi delete mode 100644 pynitrokey/nethsm/client/model/switch.py delete mode 100644 pynitrokey/nethsm/client/model/switch.pyi delete mode 100644 pynitrokey/nethsm/client/model/system_info.py delete mode 100644 pynitrokey/nethsm/client/model/system_info.pyi delete mode 100644 pynitrokey/nethsm/client/model/system_state.py delete mode 100644 pynitrokey/nethsm/client/model/system_state.pyi delete mode 100644 pynitrokey/nethsm/client/model/system_update_data.py delete mode 100644 pynitrokey/nethsm/client/model/system_update_data.pyi delete mode 100644 pynitrokey/nethsm/client/model/tag_list.py delete mode 100644 pynitrokey/nethsm/client/model/tag_list.pyi delete mode 100644 pynitrokey/nethsm/client/model/time_config.py delete mode 100644 pynitrokey/nethsm/client/model/time_config.pyi delete mode 100644 pynitrokey/nethsm/client/model/tls_key_generate_request_data.py delete mode 100644 pynitrokey/nethsm/client/model/tls_key_generate_request_data.pyi delete mode 100644 pynitrokey/nethsm/client/model/tls_key_type.py delete mode 100644 pynitrokey/nethsm/client/model/tls_key_type.pyi delete mode 100644 pynitrokey/nethsm/client/model/unattended_boot_config.py delete mode 100644 pynitrokey/nethsm/client/model/unattended_boot_config.pyi delete mode 100644 pynitrokey/nethsm/client/model/unlock_passphrase_config.py delete mode 100644 pynitrokey/nethsm/client/model/unlock_passphrase_config.pyi delete mode 100644 pynitrokey/nethsm/client/model/unlock_request_data.py delete mode 100644 pynitrokey/nethsm/client/model/unlock_request_data.pyi delete mode 100644 pynitrokey/nethsm/client/model/user_data.py delete mode 100644 pynitrokey/nethsm/client/model/user_data.pyi delete mode 100644 pynitrokey/nethsm/client/model/user_item.py delete mode 100644 pynitrokey/nethsm/client/model/user_item.pyi delete mode 100644 pynitrokey/nethsm/client/model/user_list.py delete mode 100644 pynitrokey/nethsm/client/model/user_list.pyi delete mode 100644 pynitrokey/nethsm/client/model/user_passphrase_post_data.py delete mode 100644 pynitrokey/nethsm/client/model/user_passphrase_post_data.pyi delete mode 100644 pynitrokey/nethsm/client/model/user_post_data.py delete mode 100644 pynitrokey/nethsm/client/model/user_post_data.pyi delete mode 100644 pynitrokey/nethsm/client/model/user_role.py delete mode 100644 pynitrokey/nethsm/client/model/user_role.pyi delete mode 100644 pynitrokey/nethsm/client/models/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/config_backup_passphrase/put.py delete mode 100644 pynitrokey/nethsm/client/paths/config_backup_passphrase/put.pyi create mode 100644 pynitrokey/nethsm/client/paths/config_backup_passphrase/put/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/config_backup_passphrase/put/operation.py create mode 100644 pynitrokey/nethsm/client/paths/config_backup_passphrase/put/request_body/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/config_backup_passphrase/put/request_body/content/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/config_backup_passphrase/put/request_body/content/application_json/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/config_backup_passphrase/put/request_body/content/application_json/schema.py create mode 100644 pynitrokey/nethsm/client/paths/config_backup_passphrase/put/responses/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/config_backup_passphrase/put/responses/response_204/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/config_backup_passphrase/put/responses/response_400/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/config_backup_passphrase/put/responses/response_401/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/config_backup_passphrase/put/responses/response_403/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/config_backup_passphrase/put/responses/response_406/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/config_backup_passphrase/put/responses/response_412/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/config_backup_passphrase/put/security/__init__.py create 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/get.py delete mode 100644 pynitrokey/nethsm/client/paths/config_logging/get.pyi create mode 100644 pynitrokey/nethsm/client/paths/config_logging/get/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/config_logging/get/operation.py create mode 100644 pynitrokey/nethsm/client/paths/config_logging/get/responses/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/config_logging/get/responses/response_200/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/config_logging/get/responses/response_200/content/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/config_logging/get/responses/response_200/content/application_json/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/config_logging/get/responses/response_200/content/application_json/schema.py create mode 100644 pynitrokey/nethsm/client/paths/config_logging/get/responses/response_401/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/config_logging/get/responses/response_403/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/config_logging/get/responses/response_406/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/config_logging/get/responses/response_412/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/config_logging/get/security/__init__.py create 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.py delete mode 100644 pynitrokey/nethsm/client/paths/config_logging/put.pyi create mode 100644 pynitrokey/nethsm/client/paths/config_logging/put/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/config_logging/put/operation.py create mode 100644 pynitrokey/nethsm/client/paths/config_logging/put/request_body/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/config_logging/put/request_body/content/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/config_logging/put/request_body/content/application_json/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/config_logging/put/request_body/content/application_json/schema.py create mode 100644 pynitrokey/nethsm/client/paths/config_logging/put/responses/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/config_logging/put/responses/response_204/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/config_logging/put/responses/response_400/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/config_logging/put/responses/response_401/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/config_logging/put/responses/response_403/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/config_logging/put/responses/response_406/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/config_logging/put/responses/response_412/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/config_logging/put/security/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/config_logging/put/security/security_requirement_object_0.py delete mode 100644 pynitrokey/nethsm/client/paths/config_network/get.py delete mode 100644 pynitrokey/nethsm/client/paths/config_network/get.pyi create mode 100644 pynitrokey/nethsm/client/paths/config_network/get/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/config_network/get/operation.py create mode 100644 pynitrokey/nethsm/client/paths/config_network/get/responses/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/config_network/get/responses/response_200/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/config_network/get/responses/response_200/content/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/config_network/get/responses/response_200/content/application_json/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/config_network/get/responses/response_200/content/application_json/schema.py create mode 100644 pynitrokey/nethsm/client/paths/config_network/get/responses/response_401/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/config_network/get/responses/response_403/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/config_network/get/responses/response_406/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/config_network/get/responses/response_412/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/config_network/get/security/__init__.py create 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.py delete mode 100644 pynitrokey/nethsm/client/paths/config_network/put.pyi create mode 100644 pynitrokey/nethsm/client/paths/config_network/put/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/config_network/put/operation.py create mode 100644 pynitrokey/nethsm/client/paths/config_network/put/request_body/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/config_network/put/request_body/content/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/config_network/put/request_body/content/application_json/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/config_network/put/request_body/content/application_json/schema.py create mode 100644 pynitrokey/nethsm/client/paths/config_network/put/responses/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/config_network/put/responses/response_204/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/config_network/put/responses/response_400/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/config_network/put/responses/response_401/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/config_network/put/responses/response_403/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/config_network/put/responses/response_406/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/config_network/put/responses/response_412/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/config_network/put/security/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/config_network/put/security/security_requirement_object_0.py delete mode 100644 pynitrokey/nethsm/client/paths/config_time/get.py delete mode 100644 pynitrokey/nethsm/client/paths/config_time/get.pyi create mode 100644 pynitrokey/nethsm/client/paths/config_time/get/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/config_time/get/operation.py create mode 100644 pynitrokey/nethsm/client/paths/config_time/get/responses/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/config_time/get/responses/response_200/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/config_time/get/responses/response_200/content/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/config_time/get/responses/response_200/content/application_json/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/config_time/get/responses/response_200/content/application_json/schema.py create mode 100644 pynitrokey/nethsm/client/paths/config_time/get/responses/response_401/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/config_time/get/responses/response_403/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/config_time/get/responses/response_406/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/config_time/get/responses/response_412/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/config_time/get/security/__init__.py create 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.py delete mode 100644 pynitrokey/nethsm/client/paths/config_time/put.pyi create mode 100644 pynitrokey/nethsm/client/paths/config_time/put/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/config_time/put/operation.py create mode 100644 pynitrokey/nethsm/client/paths/config_time/put/request_body/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/config_time/put/request_body/content/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/config_time/put/request_body/content/application_json/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/config_time/put/request_body/content/application_json/schema.py create mode 100644 pynitrokey/nethsm/client/paths/config_time/put/responses/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/config_time/put/responses/response_204/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/config_time/put/responses/response_400/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/config_time/put/responses/response_401/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/config_time/put/responses/response_403/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/config_time/put/responses/response_406/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/config_time/put/responses/response_412/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/config_time/put/security/__init__.py create 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/get.py delete mode 100644 pynitrokey/nethsm/client/paths/config_tls_cert_pem/get.pyi create mode 100644 pynitrokey/nethsm/client/paths/config_tls_cert_pem/get/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/config_tls_cert_pem/get/operation.py create mode 100644 pynitrokey/nethsm/client/paths/config_tls_cert_pem/get/responses/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/config_tls_cert_pem/get/responses/response_200/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/config_tls_cert_pem/get/responses/response_200/content/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/config_tls_cert_pem/get/responses/response_200/content/application_x_pem_file/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/config_tls_cert_pem/get/responses/response_200/content/application_x_pem_file/schema.py create mode 100644 pynitrokey/nethsm/client/paths/config_tls_cert_pem/get/responses/response_401/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/config_tls_cert_pem/get/responses/response_403/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/config_tls_cert_pem/get/responses/response_406/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/config_tls_cert_pem/get/responses/response_412/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/config_tls_cert_pem/get/responses/response_415/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/config_tls_cert_pem/get/security/__init__.py create 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.py delete mode 100644 pynitrokey/nethsm/client/paths/config_tls_cert_pem/put.pyi create mode 100644 pynitrokey/nethsm/client/paths/config_tls_cert_pem/put/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/config_tls_cert_pem/put/operation.py create mode 100644 pynitrokey/nethsm/client/paths/config_tls_cert_pem/put/request_body/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/config_tls_cert_pem/put/request_body/content/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/config_tls_cert_pem/put/request_body/content/application_x_pem_file/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/config_tls_cert_pem/put/request_body/content/application_x_pem_file/schema.py create mode 100644 pynitrokey/nethsm/client/paths/config_tls_cert_pem/put/responses/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/config_tls_cert_pem/put/responses/response_201/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/config_tls_cert_pem/put/responses/response_400/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/config_tls_cert_pem/put/responses/response_401/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/config_tls_cert_pem/put/responses/response_403/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/config_tls_cert_pem/put/responses/response_406/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/config_tls_cert_pem/put/responses/response_412/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/config_tls_cert_pem/put/security/__init__.py create 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/post.py delete mode 100644 pynitrokey/nethsm/client/paths/config_tls_csr_pem/post.pyi create mode 100644 pynitrokey/nethsm/client/paths/config_tls_csr_pem/post/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/config_tls_csr_pem/post/operation.py create mode 100644 pynitrokey/nethsm/client/paths/config_tls_csr_pem/post/request_body/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/config_tls_csr_pem/post/request_body/content/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/config_tls_csr_pem/post/request_body/content/application_json/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/config_tls_csr_pem/post/request_body/content/application_json/schema.py create mode 100644 pynitrokey/nethsm/client/paths/config_tls_csr_pem/post/responses/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/config_tls_csr_pem/post/responses/response_200/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/config_tls_csr_pem/post/responses/response_200/content/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/config_tls_csr_pem/post/responses/response_200/content/application_x_pem_file/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/config_tls_csr_pem/post/responses/response_200/content/application_x_pem_file/schema.py create mode 100644 pynitrokey/nethsm/client/paths/config_tls_csr_pem/post/responses/response_401/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/config_tls_csr_pem/post/responses/response_403/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/config_tls_csr_pem/post/responses/response_406/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/config_tls_csr_pem/post/responses/response_412/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/config_tls_csr_pem/post/security/__init__.py create 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/post.py delete mode 100644 pynitrokey/nethsm/client/paths/config_tls_generate/post.pyi create mode 100644 pynitrokey/nethsm/client/paths/config_tls_generate/post/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/config_tls_generate/post/operation.py create mode 100644 pynitrokey/nethsm/client/paths/config_tls_generate/post/request_body/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/config_tls_generate/post/request_body/content/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/config_tls_generate/post/request_body/content/application_json/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/config_tls_generate/post/request_body/content/application_json/schema.py create mode 100644 pynitrokey/nethsm/client/paths/config_tls_generate/post/responses/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/config_tls_generate/post/responses/response_204/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/config_tls_generate/post/responses/response_400/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/config_tls_generate/post/responses/response_401/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/config_tls_generate/post/responses/response_403/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/config_tls_generate/post/responses/response_406/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/config_tls_generate/post/responses/response_412/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/config_tls_generate/post/security/__init__.py create 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/get.py delete mode 100644 pynitrokey/nethsm/client/paths/config_tls_public_pem/get.pyi create mode 100644 pynitrokey/nethsm/client/paths/config_tls_public_pem/get/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/config_tls_public_pem/get/operation.py create mode 100644 pynitrokey/nethsm/client/paths/config_tls_public_pem/get/responses/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/config_tls_public_pem/get/responses/response_200/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/config_tls_public_pem/get/responses/response_200/content/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/config_tls_public_pem/get/responses/response_200/content/application_x_pem_file/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/config_tls_public_pem/get/responses/response_200/content/application_x_pem_file/schema.py create mode 100644 pynitrokey/nethsm/client/paths/config_tls_public_pem/get/responses/response_401/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/config_tls_public_pem/get/responses/response_403/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/config_tls_public_pem/get/responses/response_406/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/config_tls_public_pem/get/responses/response_412/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/config_tls_public_pem/get/security/__init__.py create 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/get.py delete mode 100644 pynitrokey/nethsm/client/paths/config_unattended_boot/get.pyi create mode 100644 pynitrokey/nethsm/client/paths/config_unattended_boot/get/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/config_unattended_boot/get/operation.py create mode 100644 pynitrokey/nethsm/client/paths/config_unattended_boot/get/responses/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/config_unattended_boot/get/responses/response_200/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/config_unattended_boot/get/responses/response_200/content/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/config_unattended_boot/get/responses/response_200/content/application_json/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/config_unattended_boot/get/responses/response_200/content/application_json/schema.py create mode 100644 pynitrokey/nethsm/client/paths/config_unattended_boot/get/responses/response_401/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/config_unattended_boot/get/responses/response_403/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/config_unattended_boot/get/responses/response_406/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/config_unattended_boot/get/responses/response_412/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/config_unattended_boot/get/security/__init__.py create 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.py delete mode 100644 pynitrokey/nethsm/client/paths/config_unattended_boot/put.pyi create mode 100644 pynitrokey/nethsm/client/paths/config_unattended_boot/put/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/config_unattended_boot/put/operation.py create mode 100644 pynitrokey/nethsm/client/paths/config_unattended_boot/put/request_body/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/config_unattended_boot/put/request_body/content/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/config_unattended_boot/put/request_body/content/application_json/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/config_unattended_boot/put/request_body/content/application_json/schema.py create mode 100644 pynitrokey/nethsm/client/paths/config_unattended_boot/put/responses/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/config_unattended_boot/put/responses/response_204/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/config_unattended_boot/put/responses/response_400/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/config_unattended_boot/put/responses/response_401/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/config_unattended_boot/put/responses/response_403/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/config_unattended_boot/put/responses/response_406/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/config_unattended_boot/put/responses/response_412/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/config_unattended_boot/put/security/__init__.py create 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/put.py delete mode 100644 pynitrokey/nethsm/client/paths/config_unlock_passphrase/put.pyi create mode 100644 pynitrokey/nethsm/client/paths/config_unlock_passphrase/put/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/config_unlock_passphrase/put/operation.py create mode 100644 pynitrokey/nethsm/client/paths/config_unlock_passphrase/put/request_body/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/config_unlock_passphrase/put/request_body/content/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/config_unlock_passphrase/put/request_body/content/application_json/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/config_unlock_passphrase/put/request_body/content/application_json/schema.py create mode 100644 pynitrokey/nethsm/client/paths/config_unlock_passphrase/put/responses/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/config_unlock_passphrase/put/responses/response_204/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/config_unlock_passphrase/put/responses/response_400/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/config_unlock_passphrase/put/responses/response_401/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/config_unlock_passphrase/put/responses/response_403/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/config_unlock_passphrase/put/responses/response_406/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/config_unlock_passphrase/put/responses/response_412/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/config_unlock_passphrase/put/security/__init__.py create 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/get.py delete mode 100644 pynitrokey/nethsm/client/paths/health_alive/get.pyi create mode 100644 pynitrokey/nethsm/client/paths/health_alive/get/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/health_alive/get/operation.py create mode 100644 pynitrokey/nethsm/client/paths/health_alive/get/responses/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/health_alive/get/responses/response_200/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/health_alive/get/responses/response_406/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/health_alive/get/responses/response_412/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/health_ready/get.py delete mode 100644 pynitrokey/nethsm/client/paths/health_ready/get.pyi create mode 100644 pynitrokey/nethsm/client/paths/health_ready/get/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/health_ready/get/operation.py create mode 100644 pynitrokey/nethsm/client/paths/health_ready/get/responses/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/health_ready/get/responses/response_200/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/health_ready/get/responses/response_406/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/health_ready/get/responses/response_412/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/health_state/get.py delete mode 100644 pynitrokey/nethsm/client/paths/health_state/get.pyi create mode 100644 pynitrokey/nethsm/client/paths/health_state/get/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/health_state/get/operation.py create mode 100644 pynitrokey/nethsm/client/paths/health_state/get/responses/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/health_state/get/responses/response_200/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/health_state/get/responses/response_200/content/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/health_state/get/responses/response_200/content/application_json/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/health_state/get/responses/response_200/content/application_json/schema.py create mode 100644 pynitrokey/nethsm/client/paths/health_state/get/responses/response_406/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/info/get.py delete mode 100644 pynitrokey/nethsm/client/paths/info/get.pyi create mode 100644 pynitrokey/nethsm/client/paths/info/get/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/info/get/operation.py create mode 100644 pynitrokey/nethsm/client/paths/info/get/responses/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/info/get/responses/response_200/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/info/get/responses/response_200/content/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/info/get/responses/response_200/content/application_json/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/info/get/responses/response_200/content/application_json/schema.py create mode 100644 pynitrokey/nethsm/client/paths/info/get/responses/response_406/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/keys/get.py delete mode 100644 pynitrokey/nethsm/client/paths/keys/get.pyi create mode 100644 pynitrokey/nethsm/client/paths/keys/get/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/keys/get/operation.py create mode 100644 pynitrokey/nethsm/client/paths/keys/get/parameters/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/keys/get/parameters/parameter_0/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/keys/get/parameters/parameter_0/schema.py create mode 100644 pynitrokey/nethsm/client/paths/keys/get/query_parameters.py create mode 100644 pynitrokey/nethsm/client/paths/keys/get/responses/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/keys/get/responses/response_200/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/keys/get/responses/response_200/content/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/keys/get/responses/response_200/content/application_json/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/keys/get/responses/response_200/content/application_json/schema.py create mode 100644 pynitrokey/nethsm/client/paths/keys/get/responses/response_401/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/keys/get/responses/response_403/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/keys/get/responses/response_406/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/keys/get/responses/response_412/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/keys/get/security/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/keys/get/security/security_requirement_object_0.py delete mode 100644 pynitrokey/nethsm/client/paths/keys/post.py delete mode 100644 pynitrokey/nethsm/client/paths/keys/post.pyi create mode 100644 pynitrokey/nethsm/client/paths/keys/post/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/keys/post/operation.py create mode 100644 pynitrokey/nethsm/client/paths/keys/post/parameters/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/keys/post/parameters/parameter_0/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/keys/post/parameters/parameter_0/schema.py create mode 100644 pynitrokey/nethsm/client/paths/keys/post/parameters/parameter_1/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/keys/post/parameters/parameter_1/schema.py create mode 100644 pynitrokey/nethsm/client/paths/keys/post/query_parameters.py create mode 100644 pynitrokey/nethsm/client/paths/keys/post/request_body/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/keys/post/request_body/content/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/keys/post/request_body/content/application_json/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/keys/post/request_body/content/application_json/schema.py create mode 100644 pynitrokey/nethsm/client/paths/keys/post/request_body/content/application_x_pem_file/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/keys/post/request_body/content/application_x_pem_file/schema.py create mode 100644 pynitrokey/nethsm/client/paths/keys/post/responses/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/keys/post/responses/response_201/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/keys/post/responses/response_201/header_parameters.py create mode 100644 pynitrokey/nethsm/client/paths/keys/post/responses/response_201/headers/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/keys/post/responses/response_201/headers/header_location/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/keys/post/responses/response_201/headers/header_location/schema.py create mode 100644 pynitrokey/nethsm/client/paths/keys/post/responses/response_400/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/keys/post/responses/response_401/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/keys/post/responses/response_403/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/keys/post/responses/response_406/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/keys/post/responses/response_412/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/keys/post/security/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/keys/post/security/security_requirement_object_0.py delete mode 100644 pynitrokey/nethsm/client/paths/keys_generate/post.py delete mode 100644 pynitrokey/nethsm/client/paths/keys_generate/post.pyi create mode 100644 pynitrokey/nethsm/client/paths/keys_generate/post/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/keys_generate/post/operation.py create mode 100644 pynitrokey/nethsm/client/paths/keys_generate/post/request_body/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/keys_generate/post/request_body/content/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/keys_generate/post/request_body/content/application_json/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/keys_generate/post/request_body/content/application_json/schema.py create mode 100644 pynitrokey/nethsm/client/paths/keys_generate/post/responses/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/keys_generate/post/responses/response_201/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/keys_generate/post/responses/response_201/header_parameters.py create mode 100644 pynitrokey/nethsm/client/paths/keys_generate/post/responses/response_201/headers/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/keys_generate/post/responses/response_201/headers/header_location/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/keys_generate/post/responses/response_201/headers/header_location/schema.py create mode 100644 pynitrokey/nethsm/client/paths/keys_generate/post/responses/response_400/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/keys_generate/post/responses/response_401/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/keys_generate/post/responses/response_403/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/keys_generate/post/responses/response_406/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/keys_generate/post/responses/response_412/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/keys_generate/post/security/__init__.py create 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/delete.py delete mode 100644 pynitrokey/nethsm/client/paths/keys_key_id/delete.pyi create mode 100644 pynitrokey/nethsm/client/paths/keys_key_id/delete/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/keys_key_id/delete/operation.py create mode 100644 pynitrokey/nethsm/client/paths/keys_key_id/delete/parameters/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/keys_key_id/delete/parameters/parameter_0/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/keys_key_id/delete/parameters/parameter_0/schema.py create mode 100644 pynitrokey/nethsm/client/paths/keys_key_id/delete/path_parameters.py create mode 100644 pynitrokey/nethsm/client/paths/keys_key_id/delete/responses/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/keys_key_id/delete/responses/response_204/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/keys_key_id/delete/responses/response_401/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/keys_key_id/delete/responses/response_403/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/keys_key_id/delete/responses/response_404/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/keys_key_id/delete/responses/response_406/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/keys_key_id/delete/responses/response_412/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/keys_key_id/delete/security/__init__.py create 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.py delete mode 100644 pynitrokey/nethsm/client/paths/keys_key_id/get.pyi create mode 100644 pynitrokey/nethsm/client/paths/keys_key_id/get/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/keys_key_id/get/operation.py create mode 100644 pynitrokey/nethsm/client/paths/keys_key_id/get/parameters/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/keys_key_id/get/parameters/parameter_0/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/keys_key_id/get/parameters/parameter_0/schema.py create mode 100644 pynitrokey/nethsm/client/paths/keys_key_id/get/path_parameters.py create mode 100644 pynitrokey/nethsm/client/paths/keys_key_id/get/responses/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/keys_key_id/get/responses/response_200/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/keys_key_id/get/responses/response_200/content/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/keys_key_id/get/responses/response_200/content/application_json/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/keys_key_id/get/responses/response_200/content/application_json/schema.py create mode 100644 pynitrokey/nethsm/client/paths/keys_key_id/get/responses/response_400/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/keys_key_id/get/responses/response_401/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/keys_key_id/get/responses/response_403/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/keys_key_id/get/responses/response_404/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/keys_key_id/get/responses/response_406/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/keys_key_id/get/responses/response_412/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/keys_key_id/get/security/__init__.py create 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.py delete mode 100644 pynitrokey/nethsm/client/paths/keys_key_id/put.pyi create mode 100644 pynitrokey/nethsm/client/paths/keys_key_id/put/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/keys_key_id/put/operation.py create mode 100644 pynitrokey/nethsm/client/paths/keys_key_id/put/parameters/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/keys_key_id/put/parameters/parameter_0/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/keys_key_id/put/parameters/parameter_0/schema.py create mode 100644 pynitrokey/nethsm/client/paths/keys_key_id/put/parameters/parameter_1/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/keys_key_id/put/parameters/parameter_1/schema.py create mode 100644 pynitrokey/nethsm/client/paths/keys_key_id/put/parameters/parameter_2/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/keys_key_id/put/parameters/parameter_2/schema.py create mode 100644 pynitrokey/nethsm/client/paths/keys_key_id/put/path_parameters.py create mode 100644 pynitrokey/nethsm/client/paths/keys_key_id/put/query_parameters.py create mode 100644 pynitrokey/nethsm/client/paths/keys_key_id/put/request_body/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/keys_key_id/put/request_body/content/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/keys_key_id/put/request_body/content/application_json/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/keys_key_id/put/request_body/content/application_json/schema.py create mode 100644 pynitrokey/nethsm/client/paths/keys_key_id/put/request_body/content/application_x_pem_file/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/keys_key_id/put/request_body/content/application_x_pem_file/schema.py create mode 100644 pynitrokey/nethsm/client/paths/keys_key_id/put/responses/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/keys_key_id/put/responses/response_204/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/keys_key_id/put/responses/response_400/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/keys_key_id/put/responses/response_401/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/keys_key_id/put/responses/response_403/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/keys_key_id/put/responses/response_406/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/keys_key_id/put/responses/response_409/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/keys_key_id/put/responses/response_412/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/keys_key_id/put/security/__init__.py create 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/delete.py delete mode 100644 pynitrokey/nethsm/client/paths/keys_key_id_cert/delete.pyi create mode 100644 pynitrokey/nethsm/client/paths/keys_key_id_cert/delete/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/keys_key_id_cert/delete/operation.py create mode 100644 pynitrokey/nethsm/client/paths/keys_key_id_cert/delete/parameters/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/keys_key_id_cert/delete/parameters/parameter_0/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/keys_key_id_cert/delete/parameters/parameter_0/schema.py create mode 100644 pynitrokey/nethsm/client/paths/keys_key_id_cert/delete/path_parameters.py create mode 100644 pynitrokey/nethsm/client/paths/keys_key_id_cert/delete/responses/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/keys_key_id_cert/delete/responses/response_204/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/keys_key_id_cert/delete/responses/response_401/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/keys_key_id_cert/delete/responses/response_403/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/keys_key_id_cert/delete/responses/response_404/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/keys_key_id_cert/delete/responses/response_406/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/keys_key_id_cert/delete/responses/response_409/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/keys_key_id_cert/delete/responses/response_412/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/keys_key_id_cert/delete/security/__init__.py create 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.py delete mode 100644 pynitrokey/nethsm/client/paths/keys_key_id_cert/get.pyi create mode 100644 pynitrokey/nethsm/client/paths/keys_key_id_cert/get/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/keys_key_id_cert/get/operation.py create mode 100644 pynitrokey/nethsm/client/paths/keys_key_id_cert/get/parameters/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/keys_key_id_cert/get/parameters/parameter_0/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/keys_key_id_cert/get/parameters/parameter_0/schema.py create mode 100644 pynitrokey/nethsm/client/paths/keys_key_id_cert/get/path_parameters.py create mode 100644 pynitrokey/nethsm/client/paths/keys_key_id_cert/get/responses/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/keys_key_id_cert/get/responses/response_200/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/keys_key_id_cert/get/responses/response_200/content/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/keys_key_id_cert/get/responses/response_200/content/application_pgp_keys/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/keys_key_id_cert/get/responses/response_200/content/application_pgp_keys/schema.py create mode 100644 pynitrokey/nethsm/client/paths/keys_key_id_cert/get/responses/response_200/content/application_x_pem_file/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/keys_key_id_cert/get/responses/response_200/content/application_x_pem_file/schema.py create mode 100644 pynitrokey/nethsm/client/paths/keys_key_id_cert/get/responses/response_200/content/application_xx509_ca_cert/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/keys_key_id_cert/get/responses/response_200/content/application_xx509_ca_cert/schema.py create mode 100644 pynitrokey/nethsm/client/paths/keys_key_id_cert/get/responses/response_400/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/keys_key_id_cert/get/responses/response_401/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/keys_key_id_cert/get/responses/response_403/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/keys_key_id_cert/get/responses/response_404/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/keys_key_id_cert/get/responses/response_406/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/keys_key_id_cert/get/responses/response_412/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/keys_key_id_cert/get/security/__init__.py create 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.py delete mode 100644 pynitrokey/nethsm/client/paths/keys_key_id_cert/put.pyi create mode 100644 pynitrokey/nethsm/client/paths/keys_key_id_cert/put/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/keys_key_id_cert/put/operation.py create mode 100644 pynitrokey/nethsm/client/paths/keys_key_id_cert/put/parameters/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/keys_key_id_cert/put/parameters/parameter_0/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/keys_key_id_cert/put/parameters/parameter_0/schema.py create mode 100644 pynitrokey/nethsm/client/paths/keys_key_id_cert/put/path_parameters.py create mode 100644 pynitrokey/nethsm/client/paths/keys_key_id_cert/put/request_body/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/keys_key_id_cert/put/request_body/content/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/keys_key_id_cert/put/request_body/content/application_pgp_keys/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/keys_key_id_cert/put/request_body/content/application_pgp_keys/schema.py create mode 100644 pynitrokey/nethsm/client/paths/keys_key_id_cert/put/request_body/content/application_x_pem_file/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/keys_key_id_cert/put/request_body/content/application_x_pem_file/schema.py create mode 100644 pynitrokey/nethsm/client/paths/keys_key_id_cert/put/request_body/content/application_xx509_ca_cert/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/keys_key_id_cert/put/request_body/content/application_xx509_ca_cert/schema.py create mode 100644 pynitrokey/nethsm/client/paths/keys_key_id_cert/put/responses/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/keys_key_id_cert/put/responses/response_201/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/keys_key_id_cert/put/responses/response_401/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/keys_key_id_cert/put/responses/response_403/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/keys_key_id_cert/put/responses/response_406/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/keys_key_id_cert/put/responses/response_409/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/keys_key_id_cert/put/responses/response_412/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/keys_key_id_cert/put/security/__init__.py create 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/post.py delete mode 100644 pynitrokey/nethsm/client/paths/keys_key_id_csr_pem/post.pyi create mode 100644 pynitrokey/nethsm/client/paths/keys_key_id_csr_pem/post/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/keys_key_id_csr_pem/post/operation.py create mode 100644 pynitrokey/nethsm/client/paths/keys_key_id_csr_pem/post/parameters/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/keys_key_id_csr_pem/post/parameters/parameter_0/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/keys_key_id_csr_pem/post/parameters/parameter_0/schema.py create mode 100644 pynitrokey/nethsm/client/paths/keys_key_id_csr_pem/post/path_parameters.py create mode 100644 pynitrokey/nethsm/client/paths/keys_key_id_csr_pem/post/request_body/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/keys_key_id_csr_pem/post/request_body/content/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/keys_key_id_csr_pem/post/request_body/content/application_json/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/keys_key_id_csr_pem/post/request_body/content/application_json/schema.py create mode 100644 pynitrokey/nethsm/client/paths/keys_key_id_csr_pem/post/responses/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/keys_key_id_csr_pem/post/responses/response_200/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/keys_key_id_csr_pem/post/responses/response_200/content/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/keys_key_id_csr_pem/post/responses/response_200/content/application_x_pem_file/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/keys_key_id_csr_pem/post/responses/response_200/content/application_x_pem_file/schema.py create mode 100644 pynitrokey/nethsm/client/paths/keys_key_id_csr_pem/post/responses/response_400/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/keys_key_id_csr_pem/post/responses/response_401/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/keys_key_id_csr_pem/post/responses/response_403/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/keys_key_id_csr_pem/post/responses/response_404/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/keys_key_id_csr_pem/post/responses/response_406/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/keys_key_id_csr_pem/post/responses/response_412/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/keys_key_id_csr_pem/post/security/__init__.py create 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/post.py delete mode 100644 pynitrokey/nethsm/client/paths/keys_key_id_decrypt/post.pyi create mode 100644 pynitrokey/nethsm/client/paths/keys_key_id_decrypt/post/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/keys_key_id_decrypt/post/operation.py create mode 100644 pynitrokey/nethsm/client/paths/keys_key_id_decrypt/post/parameters/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/keys_key_id_decrypt/post/parameters/parameter_0/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/keys_key_id_decrypt/post/parameters/parameter_0/schema.py create mode 100644 pynitrokey/nethsm/client/paths/keys_key_id_decrypt/post/path_parameters.py create mode 100644 pynitrokey/nethsm/client/paths/keys_key_id_decrypt/post/request_body/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/keys_key_id_decrypt/post/request_body/content/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/keys_key_id_decrypt/post/request_body/content/application_json/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/keys_key_id_decrypt/post/request_body/content/application_json/schema.py create mode 100644 pynitrokey/nethsm/client/paths/keys_key_id_decrypt/post/responses/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/keys_key_id_decrypt/post/responses/response_200/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/keys_key_id_decrypt/post/responses/response_200/content/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/keys_key_id_decrypt/post/responses/response_200/content/application_json/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/keys_key_id_decrypt/post/responses/response_200/content/application_json/schema.py create mode 100644 pynitrokey/nethsm/client/paths/keys_key_id_decrypt/post/responses/response_400/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/keys_key_id_decrypt/post/responses/response_401/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/keys_key_id_decrypt/post/responses/response_403/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/keys_key_id_decrypt/post/responses/response_404/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/keys_key_id_decrypt/post/responses/response_406/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/keys_key_id_decrypt/post/responses/response_412/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/keys_key_id_decrypt/post/security/__init__.py create 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/post.py delete mode 100644 pynitrokey/nethsm/client/paths/keys_key_id_encrypt/post.pyi create mode 100644 pynitrokey/nethsm/client/paths/keys_key_id_encrypt/post/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/keys_key_id_encrypt/post/operation.py create mode 100644 pynitrokey/nethsm/client/paths/keys_key_id_encrypt/post/parameters/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/keys_key_id_encrypt/post/parameters/parameter_0/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/keys_key_id_encrypt/post/parameters/parameter_0/schema.py create mode 100644 pynitrokey/nethsm/client/paths/keys_key_id_encrypt/post/path_parameters.py create mode 100644 pynitrokey/nethsm/client/paths/keys_key_id_encrypt/post/request_body/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/keys_key_id_encrypt/post/request_body/content/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/keys_key_id_encrypt/post/request_body/content/application_json/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/keys_key_id_encrypt/post/request_body/content/application_json/schema.py create mode 100644 pynitrokey/nethsm/client/paths/keys_key_id_encrypt/post/responses/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/keys_key_id_encrypt/post/responses/response_200/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/keys_key_id_encrypt/post/responses/response_200/content/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/keys_key_id_encrypt/post/responses/response_200/content/application_json/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/keys_key_id_encrypt/post/responses/response_200/content/application_json/schema.py create mode 100644 pynitrokey/nethsm/client/paths/keys_key_id_encrypt/post/responses/response_400/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/keys_key_id_encrypt/post/responses/response_401/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/keys_key_id_encrypt/post/responses/response_403/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/keys_key_id_encrypt/post/responses/response_404/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/keys_key_id_encrypt/post/responses/response_406/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/keys_key_id_encrypt/post/responses/response_412/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/keys_key_id_encrypt/post/security/__init__.py create 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/get.py delete mode 100644 pynitrokey/nethsm/client/paths/keys_key_id_public_pem/get.pyi create mode 100644 pynitrokey/nethsm/client/paths/keys_key_id_public_pem/get/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/keys_key_id_public_pem/get/operation.py create mode 100644 pynitrokey/nethsm/client/paths/keys_key_id_public_pem/get/parameters/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/keys_key_id_public_pem/get/parameters/parameter_0/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/keys_key_id_public_pem/get/parameters/parameter_0/schema.py create mode 100644 pynitrokey/nethsm/client/paths/keys_key_id_public_pem/get/path_parameters.py create mode 100644 pynitrokey/nethsm/client/paths/keys_key_id_public_pem/get/responses/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/keys_key_id_public_pem/get/responses/response_200/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/keys_key_id_public_pem/get/responses/response_200/content/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/keys_key_id_public_pem/get/responses/response_200/content/application_x_pem_file/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/keys_key_id_public_pem/get/responses/response_200/content/application_x_pem_file/schema.py create mode 100644 pynitrokey/nethsm/client/paths/keys_key_id_public_pem/get/responses/response_400/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/keys_key_id_public_pem/get/responses/response_401/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/keys_key_id_public_pem/get/responses/response_403/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/keys_key_id_public_pem/get/responses/response_404/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/keys_key_id_public_pem/get/responses/response_406/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/keys_key_id_public_pem/get/responses/response_412/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/keys_key_id_public_pem/get/security/__init__.py create 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/delete.py delete mode 100644 pynitrokey/nethsm/client/paths/keys_key_id_restrictions_tags_tag/delete.pyi create mode 100644 pynitrokey/nethsm/client/paths/keys_key_id_restrictions_tags_tag/delete/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/keys_key_id_restrictions_tags_tag/delete/operation.py create mode 100644 pynitrokey/nethsm/client/paths/keys_key_id_restrictions_tags_tag/delete/parameters/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/keys_key_id_restrictions_tags_tag/delete/parameters/parameter_0/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/keys_key_id_restrictions_tags_tag/delete/parameters/parameter_0/schema.py create mode 100644 pynitrokey/nethsm/client/paths/keys_key_id_restrictions_tags_tag/delete/parameters/parameter_1/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/keys_key_id_restrictions_tags_tag/delete/parameters/parameter_1/schema.py create mode 100644 pynitrokey/nethsm/client/paths/keys_key_id_restrictions_tags_tag/delete/path_parameters.py create mode 100644 pynitrokey/nethsm/client/paths/keys_key_id_restrictions_tags_tag/delete/responses/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/keys_key_id_restrictions_tags_tag/delete/responses/response_204/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/keys_key_id_restrictions_tags_tag/delete/responses/response_401/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/keys_key_id_restrictions_tags_tag/delete/responses/response_403/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/keys_key_id_restrictions_tags_tag/delete/responses/response_404/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/keys_key_id_restrictions_tags_tag/delete/responses/response_406/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/keys_key_id_restrictions_tags_tag/delete/responses/response_412/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/keys_key_id_restrictions_tags_tag/delete/security/__init__.py create 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.py delete mode 100644 pynitrokey/nethsm/client/paths/keys_key_id_restrictions_tags_tag/put.pyi create mode 100644 pynitrokey/nethsm/client/paths/keys_key_id_restrictions_tags_tag/put/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/keys_key_id_restrictions_tags_tag/put/operation.py create mode 100644 pynitrokey/nethsm/client/paths/keys_key_id_restrictions_tags_tag/put/parameters/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/keys_key_id_restrictions_tags_tag/put/parameters/parameter_0/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/keys_key_id_restrictions_tags_tag/put/parameters/parameter_0/schema.py create mode 100644 pynitrokey/nethsm/client/paths/keys_key_id_restrictions_tags_tag/put/parameters/parameter_1/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/keys_key_id_restrictions_tags_tag/put/parameters/parameter_1/schema.py create mode 100644 pynitrokey/nethsm/client/paths/keys_key_id_restrictions_tags_tag/put/path_parameters.py create mode 100644 pynitrokey/nethsm/client/paths/keys_key_id_restrictions_tags_tag/put/responses/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/keys_key_id_restrictions_tags_tag/put/responses/response_204/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/keys_key_id_restrictions_tags_tag/put/responses/response_304/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/keys_key_id_restrictions_tags_tag/put/responses/response_400/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/keys_key_id_restrictions_tags_tag/put/responses/response_401/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/keys_key_id_restrictions_tags_tag/put/responses/response_403/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/keys_key_id_restrictions_tags_tag/put/responses/response_404/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/keys_key_id_restrictions_tags_tag/put/responses/response_406/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/keys_key_id_restrictions_tags_tag/put/responses/response_412/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/keys_key_id_restrictions_tags_tag/put/security/__init__.py create 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/post.py delete mode 100644 pynitrokey/nethsm/client/paths/keys_key_id_sign/post.pyi create mode 100644 pynitrokey/nethsm/client/paths/keys_key_id_sign/post/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/keys_key_id_sign/post/operation.py create mode 100644 pynitrokey/nethsm/client/paths/keys_key_id_sign/post/parameters/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/keys_key_id_sign/post/parameters/parameter_0/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/keys_key_id_sign/post/parameters/parameter_0/schema.py create mode 100644 pynitrokey/nethsm/client/paths/keys_key_id_sign/post/path_parameters.py create mode 100644 pynitrokey/nethsm/client/paths/keys_key_id_sign/post/request_body/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/keys_key_id_sign/post/request_body/content/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/keys_key_id_sign/post/request_body/content/application_json/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/keys_key_id_sign/post/request_body/content/application_json/schema.py create mode 100644 pynitrokey/nethsm/client/paths/keys_key_id_sign/post/responses/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/keys_key_id_sign/post/responses/response_200/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/keys_key_id_sign/post/responses/response_200/content/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/keys_key_id_sign/post/responses/response_200/content/application_json/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/keys_key_id_sign/post/responses/response_200/content/application_json/schema.py create mode 100644 pynitrokey/nethsm/client/paths/keys_key_id_sign/post/responses/response_400/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/keys_key_id_sign/post/responses/response_401/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/keys_key_id_sign/post/responses/response_403/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/keys_key_id_sign/post/responses/response_404/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/keys_key_id_sign/post/responses/response_406/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/keys_key_id_sign/post/responses/response_412/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/keys_key_id_sign/post/security/__init__.py create 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/post.py delete mode 100644 pynitrokey/nethsm/client/paths/lock/post.pyi create mode 100644 pynitrokey/nethsm/client/paths/lock/post/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/lock/post/operation.py create mode 100644 pynitrokey/nethsm/client/paths/lock/post/responses/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/lock/post/responses/response_204/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/lock/post/responses/response_401/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/lock/post/responses/response_403/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/lock/post/responses/response_406/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/lock/post/responses/response_412/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/lock/post/security/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/lock/post/security/security_requirement_object_0.py delete mode 100644 pynitrokey/nethsm/client/paths/metrics/get.py delete mode 100644 pynitrokey/nethsm/client/paths/metrics/get.pyi create mode 100644 pynitrokey/nethsm/client/paths/metrics/get/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/metrics/get/operation.py create mode 100644 pynitrokey/nethsm/client/paths/metrics/get/responses/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/metrics/get/responses/response_200/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/metrics/get/responses/response_200/content/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/metrics/get/responses/response_200/content/application_json/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/metrics/get/responses/response_200/content/application_json/schema.py create mode 100644 pynitrokey/nethsm/client/paths/metrics/get/responses/response_401/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/metrics/get/responses/response_403/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/metrics/get/responses/response_406/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/metrics/get/responses/response_412/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/metrics/get/security/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/metrics/get/security/security_requirement_object_0.py delete mode 100644 pynitrokey/nethsm/client/paths/provision/post.py delete mode 100644 pynitrokey/nethsm/client/paths/provision/post.pyi create mode 100644 pynitrokey/nethsm/client/paths/provision/post/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/provision/post/operation.py create mode 100644 pynitrokey/nethsm/client/paths/provision/post/request_body/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/provision/post/request_body/content/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/provision/post/request_body/content/application_json/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/provision/post/request_body/content/application_json/schema.py create mode 100644 pynitrokey/nethsm/client/paths/provision/post/responses/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/provision/post/responses/response_204/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/provision/post/responses/response_400/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/provision/post/responses/response_406/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/provision/post/responses/response_412/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/random/post.py delete mode 100644 pynitrokey/nethsm/client/paths/random/post.pyi create mode 100644 pynitrokey/nethsm/client/paths/random/post/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/random/post/operation.py create mode 100644 pynitrokey/nethsm/client/paths/random/post/request_body/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/random/post/request_body/content/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/random/post/request_body/content/application_json/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/random/post/request_body/content/application_json/schema.py create mode 100644 pynitrokey/nethsm/client/paths/random/post/responses/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/random/post/responses/response_200/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/random/post/responses/response_200/content/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/random/post/responses/response_200/content/application_json/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/random/post/responses/response_200/content/application_json/schema.py create mode 100644 pynitrokey/nethsm/client/paths/random/post/responses/response_400/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/random/post/responses/response_401/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/random/post/responses/response_403/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/random/post/responses/response_406/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/random/post/responses/response_412/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/random/post/security/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/random/post/security/security_requirement_object_0.py delete mode 100644 pynitrokey/nethsm/client/paths/system_backup/post.py delete mode 100644 pynitrokey/nethsm/client/paths/system_backup/post.pyi create mode 100644 pynitrokey/nethsm/client/paths/system_backup/post/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/system_backup/post/operation.py create mode 100644 pynitrokey/nethsm/client/paths/system_backup/post/responses/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/system_backup/post/responses/response_200/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/system_backup/post/responses/response_401/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/system_backup/post/responses/response_403/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/system_backup/post/responses/response_406/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/system_backup/post/responses/response_412/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/system_backup/post/security/__init__.py create 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/post.py delete mode 100644 pynitrokey/nethsm/client/paths/system_cancel_update/post.pyi create mode 100644 pynitrokey/nethsm/client/paths/system_cancel_update/post/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/system_cancel_update/post/operation.py create mode 100644 pynitrokey/nethsm/client/paths/system_cancel_update/post/responses/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/system_cancel_update/post/responses/response_204/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/system_cancel_update/post/responses/response_401/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/system_cancel_update/post/responses/response_403/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/system_cancel_update/post/responses/response_406/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/system_cancel_update/post/responses/response_412/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/system_cancel_update/post/security/__init__.py create 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/post.py delete mode 100644 pynitrokey/nethsm/client/paths/system_commit_update/post.pyi create mode 100644 pynitrokey/nethsm/client/paths/system_commit_update/post/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/system_commit_update/post/operation.py create mode 100644 pynitrokey/nethsm/client/paths/system_commit_update/post/responses/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/system_commit_update/post/responses/response_204/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/system_commit_update/post/responses/response_401/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/system_commit_update/post/responses/response_403/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/system_commit_update/post/responses/response_406/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/system_commit_update/post/responses/response_412/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/system_commit_update/post/security/__init__.py create 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/post.py delete mode 100644 pynitrokey/nethsm/client/paths/system_factory_reset/post.pyi create mode 100644 pynitrokey/nethsm/client/paths/system_factory_reset/post/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/system_factory_reset/post/operation.py create mode 100644 pynitrokey/nethsm/client/paths/system_factory_reset/post/responses/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/system_factory_reset/post/responses/response_204/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/system_factory_reset/post/responses/response_401/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/system_factory_reset/post/responses/response_403/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/system_factory_reset/post/responses/response_406/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/system_factory_reset/post/responses/response_412/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/system_factory_reset/post/security/__init__.py create 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/get.py delete mode 100644 pynitrokey/nethsm/client/paths/system_info/get.pyi create mode 100644 pynitrokey/nethsm/client/paths/system_info/get/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/system_info/get/operation.py create mode 100644 pynitrokey/nethsm/client/paths/system_info/get/responses/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/system_info/get/responses/response_200/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/system_info/get/responses/response_200/content/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/system_info/get/responses/response_200/content/application_json/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/system_info/get/responses/response_200/content/application_json/schema.py create mode 100644 pynitrokey/nethsm/client/paths/system_info/get/responses/response_401/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/system_info/get/responses/response_403/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/system_info/get/responses/response_406/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/system_info/get/responses/response_412/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/system_info/get/security/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/system_info/get/security/security_requirement_object_0.py delete mode 100644 pynitrokey/nethsm/client/paths/system_reboot/post.py delete mode 100644 pynitrokey/nethsm/client/paths/system_reboot/post.pyi create mode 100644 pynitrokey/nethsm/client/paths/system_reboot/post/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/system_reboot/post/operation.py create mode 100644 pynitrokey/nethsm/client/paths/system_reboot/post/responses/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/system_reboot/post/responses/response_204/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/system_reboot/post/responses/response_401/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/system_reboot/post/responses/response_403/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/system_reboot/post/responses/response_406/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/system_reboot/post/responses/response_412/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/system_reboot/post/security/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/system_reboot/post/security/security_requirement_object_0.py delete mode 100644 pynitrokey/nethsm/client/paths/system_restore/post.py delete mode 100644 pynitrokey/nethsm/client/paths/system_restore/post.pyi create mode 100644 pynitrokey/nethsm/client/paths/system_restore/post/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/system_restore/post/operation.py create mode 100644 pynitrokey/nethsm/client/paths/system_restore/post/parameters/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/system_restore/post/parameters/parameter_0/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/system_restore/post/parameters/parameter_0/schema.py create mode 100644 pynitrokey/nethsm/client/paths/system_restore/post/parameters/parameter_1/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/system_restore/post/parameters/parameter_1/schema.py create mode 100644 pynitrokey/nethsm/client/paths/system_restore/post/query_parameters.py create mode 100644 pynitrokey/nethsm/client/paths/system_restore/post/request_body/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/system_restore/post/request_body/content/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/system_restore/post/request_body/content/application_octet_stream/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/system_restore/post/request_body/content/application_octet_stream/schema.py create mode 100644 pynitrokey/nethsm/client/paths/system_restore/post/responses/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/system_restore/post/responses/response_204/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/system_restore/post/responses/response_400/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/system_restore/post/responses/response_406/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/system_restore/post/responses/response_412/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/system_shutdown/post.py delete mode 100644 pynitrokey/nethsm/client/paths/system_shutdown/post.pyi create mode 100644 pynitrokey/nethsm/client/paths/system_shutdown/post/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/system_shutdown/post/operation.py create mode 100644 pynitrokey/nethsm/client/paths/system_shutdown/post/responses/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/system_shutdown/post/responses/response_204/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/system_shutdown/post/responses/response_401/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/system_shutdown/post/responses/response_403/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/system_shutdown/post/responses/response_406/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/system_shutdown/post/responses/response_412/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/system_shutdown/post/security/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/system_shutdown/post/security/security_requirement_object_0.py delete mode 100644 pynitrokey/nethsm/client/paths/system_update/post.py delete mode 100644 pynitrokey/nethsm/client/paths/system_update/post.pyi create mode 100644 pynitrokey/nethsm/client/paths/system_update/post/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/system_update/post/operation.py create mode 100644 pynitrokey/nethsm/client/paths/system_update/post/request_body/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/system_update/post/request_body/content/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/system_update/post/request_body/content/application_octet_stream/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/system_update/post/request_body/content/application_octet_stream/schema.py create mode 100644 pynitrokey/nethsm/client/paths/system_update/post/responses/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/system_update/post/responses/response_200/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/system_update/post/responses/response_200/content/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/system_update/post/responses/response_200/content/application_json/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/system_update/post/responses/response_200/content/application_json/schema.py create mode 100644 pynitrokey/nethsm/client/paths/system_update/post/responses/response_400/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/system_update/post/responses/response_401/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/system_update/post/responses/response_403/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/system_update/post/responses/response_406/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/system_update/post/responses/response_409/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/system_update/post/responses/response_412/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/system_update/post/security/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/system_update/post/security/security_requirement_object_0.py delete mode 100644 pynitrokey/nethsm/client/paths/unlock/post.py delete mode 100644 pynitrokey/nethsm/client/paths/unlock/post.pyi create mode 100644 pynitrokey/nethsm/client/paths/unlock/post/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/unlock/post/operation.py create mode 100644 pynitrokey/nethsm/client/paths/unlock/post/request_body/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/unlock/post/request_body/content/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/unlock/post/request_body/content/application_json/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/unlock/post/request_body/content/application_json/schema.py create mode 100644 pynitrokey/nethsm/client/paths/unlock/post/responses/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/unlock/post/responses/response_204/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/unlock/post/responses/response_400/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/unlock/post/responses/response_403/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/unlock/post/responses/response_406/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/unlock/post/responses/response_412/__init__.py delete mode 100644 pynitrokey/nethsm/client/paths/users/get.py delete mode 100644 pynitrokey/nethsm/client/paths/users/get.pyi create mode 100644 pynitrokey/nethsm/client/paths/users/get/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/users/get/operation.py create mode 100644 pynitrokey/nethsm/client/paths/users/get/responses/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/users/get/responses/response_200/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/users/get/responses/response_200/content/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/users/get/responses/response_200/content/application_json/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/users/get/responses/response_200/content/application_json/schema.py create mode 100644 pynitrokey/nethsm/client/paths/users/get/responses/response_401/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/users/get/responses/response_403/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/users/get/responses/response_406/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/users/get/responses/response_412/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/users/get/security/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/users/get/security/security_requirement_object_0.py delete mode 100644 pynitrokey/nethsm/client/paths/users/post.py delete mode 100644 pynitrokey/nethsm/client/paths/users/post.pyi create mode 100644 pynitrokey/nethsm/client/paths/users/post/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/users/post/operation.py create mode 100644 pynitrokey/nethsm/client/paths/users/post/request_body/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/users/post/request_body/content/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/users/post/request_body/content/application_json/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/users/post/request_body/content/application_json/schema.py create mode 100644 pynitrokey/nethsm/client/paths/users/post/responses/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/users/post/responses/response_201/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/users/post/responses/response_400/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/users/post/responses/response_401/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/users/post/responses/response_403/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/users/post/responses/response_406/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/users/post/responses/response_412/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/users/post/security/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/users/post/security/security_requirement_object_0.py delete mode 100644 pynitrokey/nethsm/client/paths/users_user_id/delete.py delete mode 100644 pynitrokey/nethsm/client/paths/users_user_id/delete.pyi create mode 100644 pynitrokey/nethsm/client/paths/users_user_id/delete/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/users_user_id/delete/operation.py create mode 100644 pynitrokey/nethsm/client/paths/users_user_id/delete/parameters/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/users_user_id/delete/parameters/parameter_0/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/users_user_id/delete/parameters/parameter_0/schema.py create mode 100644 pynitrokey/nethsm/client/paths/users_user_id/delete/path_parameters.py create mode 100644 pynitrokey/nethsm/client/paths/users_user_id/delete/responses/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/users_user_id/delete/responses/response_204/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/users_user_id/delete/responses/response_401/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/users_user_id/delete/responses/response_403/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/users_user_id/delete/responses/response_404/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/users_user_id/delete/responses/response_406/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/users_user_id/delete/responses/response_412/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/users_user_id/delete/security/__init__.py create 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.py delete mode 100644 pynitrokey/nethsm/client/paths/users_user_id/get.pyi create mode 100644 pynitrokey/nethsm/client/paths/users_user_id/get/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/users_user_id/get/operation.py create mode 100644 pynitrokey/nethsm/client/paths/users_user_id/get/parameters/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/users_user_id/get/parameters/parameter_0/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/users_user_id/get/parameters/parameter_0/schema.py create mode 100644 pynitrokey/nethsm/client/paths/users_user_id/get/path_parameters.py create mode 100644 pynitrokey/nethsm/client/paths/users_user_id/get/responses/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/users_user_id/get/responses/response_200/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/users_user_id/get/responses/response_200/content/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/users_user_id/get/responses/response_200/content/application_json/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/users_user_id/get/responses/response_200/content/application_json/schema.py create mode 100644 pynitrokey/nethsm/client/paths/users_user_id/get/responses/response_400/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/users_user_id/get/responses/response_401/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/users_user_id/get/responses/response_403/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/users_user_id/get/responses/response_404/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/users_user_id/get/responses/response_406/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/users_user_id/get/responses/response_412/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/users_user_id/get/security/__init__.py create 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.py delete mode 100644 pynitrokey/nethsm/client/paths/users_user_id/put.pyi create mode 100644 pynitrokey/nethsm/client/paths/users_user_id/put/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/users_user_id/put/operation.py create mode 100644 pynitrokey/nethsm/client/paths/users_user_id/put/parameters/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/users_user_id/put/parameters/parameter_0/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/users_user_id/put/parameters/parameter_0/schema.py create mode 100644 pynitrokey/nethsm/client/paths/users_user_id/put/path_parameters.py create mode 100644 pynitrokey/nethsm/client/paths/users_user_id/put/request_body/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/users_user_id/put/request_body/content/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/users_user_id/put/request_body/content/application_json/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/users_user_id/put/request_body/content/application_json/schema.py create mode 100644 pynitrokey/nethsm/client/paths/users_user_id/put/responses/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/users_user_id/put/responses/response_201/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/users_user_id/put/responses/response_400/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/users_user_id/put/responses/response_401/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/users_user_id/put/responses/response_403/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/users_user_id/put/responses/response_406/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/users_user_id/put/responses/response_409/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/users_user_id/put/responses/response_412/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/users_user_id/put/security/__init__.py create 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/post.py delete mode 100644 pynitrokey/nethsm/client/paths/users_user_id_passphrase/post.pyi create mode 100644 pynitrokey/nethsm/client/paths/users_user_id_passphrase/post/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/users_user_id_passphrase/post/operation.py create mode 100644 pynitrokey/nethsm/client/paths/users_user_id_passphrase/post/parameters/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/users_user_id_passphrase/post/parameters/parameter_0/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/users_user_id_passphrase/post/parameters/parameter_0/schema.py create mode 100644 pynitrokey/nethsm/client/paths/users_user_id_passphrase/post/path_parameters.py create mode 100644 pynitrokey/nethsm/client/paths/users_user_id_passphrase/post/request_body/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/users_user_id_passphrase/post/request_body/content/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/users_user_id_passphrase/post/request_body/content/application_json/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/users_user_id_passphrase/post/request_body/content/application_json/schema.py create mode 100644 pynitrokey/nethsm/client/paths/users_user_id_passphrase/post/responses/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/users_user_id_passphrase/post/responses/response_204/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/users_user_id_passphrase/post/responses/response_400/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/users_user_id_passphrase/post/responses/response_401/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/users_user_id_passphrase/post/responses/response_403/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/users_user_id_passphrase/post/responses/response_404/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/users_user_id_passphrase/post/responses/response_406/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/users_user_id_passphrase/post/responses/response_412/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/users_user_id_passphrase/post/security/__init__.py create 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/get.py delete mode 100644 pynitrokey/nethsm/client/paths/users_user_id_tags/get.pyi create mode 100644 pynitrokey/nethsm/client/paths/users_user_id_tags/get/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/users_user_id_tags/get/operation.py create mode 100644 pynitrokey/nethsm/client/paths/users_user_id_tags/get/parameters/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/users_user_id_tags/get/parameters/parameter_0/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/users_user_id_tags/get/parameters/parameter_0/schema.py create mode 100644 pynitrokey/nethsm/client/paths/users_user_id_tags/get/path_parameters.py create mode 100644 pynitrokey/nethsm/client/paths/users_user_id_tags/get/responses/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/users_user_id_tags/get/responses/response_200/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/users_user_id_tags/get/responses/response_200/content/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/users_user_id_tags/get/responses/response_200/content/application_json/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/users_user_id_tags/get/responses/response_200/content/application_json/schema.py create mode 100644 pynitrokey/nethsm/client/paths/users_user_id_tags/get/responses/response_400/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/users_user_id_tags/get/responses/response_401/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/users_user_id_tags/get/responses/response_403/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/users_user_id_tags/get/responses/response_404/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/users_user_id_tags/get/responses/response_406/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/users_user_id_tags/get/responses/response_412/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/users_user_id_tags/get/security/__init__.py create 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/delete.py delete mode 100644 pynitrokey/nethsm/client/paths/users_user_id_tags_tag/delete.pyi create mode 100644 pynitrokey/nethsm/client/paths/users_user_id_tags_tag/delete/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/users_user_id_tags_tag/delete/operation.py create mode 100644 pynitrokey/nethsm/client/paths/users_user_id_tags_tag/delete/parameters/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/users_user_id_tags_tag/delete/parameters/parameter_0/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/users_user_id_tags_tag/delete/parameters/parameter_0/schema.py create mode 100644 pynitrokey/nethsm/client/paths/users_user_id_tags_tag/delete/parameters/parameter_1/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/users_user_id_tags_tag/delete/parameters/parameter_1/schema.py create mode 100644 pynitrokey/nethsm/client/paths/users_user_id_tags_tag/delete/path_parameters.py create mode 100644 pynitrokey/nethsm/client/paths/users_user_id_tags_tag/delete/responses/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/users_user_id_tags_tag/delete/responses/response_204/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/users_user_id_tags_tag/delete/responses/response_401/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/users_user_id_tags_tag/delete/responses/response_403/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/users_user_id_tags_tag/delete/responses/response_404/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/users_user_id_tags_tag/delete/responses/response_406/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/users_user_id_tags_tag/delete/responses/response_412/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/users_user_id_tags_tag/delete/security/__init__.py create 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.py delete mode 100644 pynitrokey/nethsm/client/paths/users_user_id_tags_tag/put.pyi create mode 100644 pynitrokey/nethsm/client/paths/users_user_id_tags_tag/put/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/users_user_id_tags_tag/put/operation.py create mode 100644 pynitrokey/nethsm/client/paths/users_user_id_tags_tag/put/parameters/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/users_user_id_tags_tag/put/parameters/parameter_0/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/users_user_id_tags_tag/put/parameters/parameter_0/schema.py create mode 100644 pynitrokey/nethsm/client/paths/users_user_id_tags_tag/put/parameters/parameter_1/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/users_user_id_tags_tag/put/parameters/parameter_1/schema.py create mode 100644 pynitrokey/nethsm/client/paths/users_user_id_tags_tag/put/path_parameters.py create mode 100644 pynitrokey/nethsm/client/paths/users_user_id_tags_tag/put/responses/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/users_user_id_tags_tag/put/responses/response_204/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/users_user_id_tags_tag/put/responses/response_304/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/users_user_id_tags_tag/put/responses/response_400/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/users_user_id_tags_tag/put/responses/response_401/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/users_user_id_tags_tag/put/responses/response_403/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/users_user_id_tags_tag/put/responses/response_404/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/users_user_id_tags_tag/put/responses/response_406/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/users_user_id_tags_tag/put/responses/response_412/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/users_user_id_tags_tag/put/security/__init__.py create mode 100644 pynitrokey/nethsm/client/paths/users_user_id_tags_tag/put/security/security_requirement_object_0.py create mode 100644 pynitrokey/nethsm/client/py.typed delete mode 100644 pynitrokey/nethsm/client/schemas.py create mode 100644 pynitrokey/nethsm/client/schemas/__init__.py create mode 100644 pynitrokey/nethsm/client/schemas/format.py create mode 100644 pynitrokey/nethsm/client/schemas/original_immutabledict.py create mode 100644 pynitrokey/nethsm/client/schemas/schema.py create mode 100644 pynitrokey/nethsm/client/schemas/schemas.py create mode 100644 pynitrokey/nethsm/client/schemas/validation.py create mode 100644 pynitrokey/nethsm/client/security_schemes.py create mode 100644 pynitrokey/nethsm/client/server.py create mode 100644 pynitrokey/nethsm/client/servers/__init__.py create mode 100644 pynitrokey/nethsm/client/servers/server_0.py create mode 100644 pynitrokey/nethsm/client/shared_imports/__init__.py create mode 100644 pynitrokey/nethsm/client/shared_imports/header_imports.py create mode 100644 pynitrokey/nethsm/client/shared_imports/operation_imports.py create mode 100644 pynitrokey/nethsm/client/shared_imports/response_imports.py create mode 100644 pynitrokey/nethsm/client/shared_imports/schema_imports.py create mode 100644 pynitrokey/nethsm/client/shared_imports/security_scheme_imports.py create mode 100644 pynitrokey/nethsm/client/shared_imports/server_imports.py diff --git a/docs/developer-guide.rst b/docs/developer-guide.rst index 45e94c32..8bb84cd5 100644 --- a/docs/developer-guide.rst +++ b/docs/developer-guide.rst @@ -99,3 +99,16 @@ Then, run the generation script, docker is required: 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`` diff --git a/nethsm-api.yaml b/nethsm-api.yaml index c14edf03..2bbbd646 100644 --- a/nethsm-api.yaml +++ b/nethsm-api.yaml @@ -2,7 +2,11 @@ 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 encoded values are Big Endian. + 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: @@ -14,12 +18,14 @@ paths: /info: get: responses: - '200': - description: '' + "200": + description: "" content: application/json: schema: - $ref: '#/components/schemas/InfoData' + $ref: "#/components/schemas/InfoData" + "406": + description: Content type in Accept header not supported. description: Information about the vendor and product. x-annotation-state: - Locked @@ -30,11 +36,15 @@ paths: /health/alive: get: responses: - '200': + "200": description: Yes, it is alive. - '412': + "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. + description: | + Retrieve wether NetHSM is alive (powered up). + This corresponds to the state *Locked* or *Unprovisioned*. x-annotation-role: - Public x-annotation-state: @@ -43,11 +53,15 @@ paths: /health/ready: get: responses: - '200': + "200": description: Yes, it is alive and ready. - '412': + "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. + description: | + Retrieve wether NetHSM is alive and ready to take traffic. + This corresponds to the state *Operational*. x-annotation-role: - Public x-annotation-state: @@ -55,12 +69,14 @@ paths: /health/state: get: responses: - '200': - description: '' + "200": + description: "" content: application/json: schema: - $ref: '#/components/schemas/HealthStateData' + $ref: "#/components/schemas/HealthStateData" + "406": + description: Content type in Accept header not supported. description: Retrieve the state of NetHSM. x-annotation-role: - Public @@ -71,19 +87,23 @@ paths: /metrics: get: responses: - '200': - description: '' + "200": + description: "" content: application/json: schema: - $ref: '#/components/schemas/MetricsData' - '401': + $ref: "#/components/schemas/MetricsData" + "401": description: Authentication required but none provided. - '403': + "403": description: Access denied. - '412': - description: Precondition failed (NetHSM was not Operational). - description: 'Get metrics. Precondition: NetHSM is Operational and a R-Metrics can be authenticated.' + "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: @@ -93,18 +113,20 @@ paths: /provision: post: responses: - '204': - description: Provisioning was successful, NetHSM is Operational now. - '400': + "204": + description: Provisioning was successful, NetHSM is *Operational* now. + "400": description: Malformed request data (e.g. malformed time, weak passphrase). - '412': - description: Precondition failed (NetHSM was not Unprovisioned). - description: Initial provisioning, only available in Unprovisioned state. + "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' + $ref: "#/components/schemas/ProvisionRequestData" required: true x-annotation-role: - Public @@ -113,20 +135,22 @@ paths: /unlock: post: responses: - '204': - description: Unlock was successful, NetHSM is Operational now. - '400': + "204": + description: Unlock was successful, NetHSM is *Operational* now. + "400": description: Bad request (invalid passphrase). - '403': + "403": description: Unlock failed (access denied). - '412': - description: Precondition failed (NetHSM was not Locked). - description: Brings a Locked NetHSM into Operational state. + "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' + $ref: "#/components/schemas/UnlockRequestData" required: true x-annotation-role: - Public @@ -135,15 +159,17 @@ paths: /lock: post: responses: - '204': - description: Lock was successful, NetHSM is Locked now. - '401': + "204": + description: Lock was successful, NetHSM is *Locked* now. + "401": description: Authentication required but none provided. - '403': + "403": description: Lock failed (access denied). - '412': - description: Precondition failed (NetHSM was not Operational). - description: Brings an Operational NetHSM into Locked state. + "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: @@ -153,24 +179,30 @@ paths: /random: post: responses: - '200': - description: Successful request for length random bytes. + "200": + description: Successful request for *length* random bytes. content: application/json: schema: - $ref: '#/components/schemas/RandomData' - '401': + $ref: "#/components/schemas/RandomData" + "400": + description: Bad request (invalid length). + "401": description: Authentication required but none provided. - '403': + "403": description: Access denied. - '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.' + "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' + $ref: "#/components/schemas/RandomRequestData" required: true security: - basic: [] @@ -181,19 +213,23 @@ paths: /keys: get: responses: - '200': + "200": description: Successful request for the list of keys. content: application/json: schema: - $ref: '#/components/schemas/KeyList' - '401': + $ref: "#/components/schemas/KeyList" + "401": description: Authentication required but none provided. - '403': + "403": description: Access denied. - '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. + "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 @@ -209,25 +245,38 @@ paths: - Operational post: responses: - '201': - description: Successful import of a private key. The response contains a Location header, e.g. "https://nethsm.local/v1/keys/I8mhHYJ1T3uk2lXrwXehVaw9KZzg7K". - '400': + "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': + "401": description: Authentication required but none provided. - '403': + "403": description: Access denied. - '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. + "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/x-pem-file: - schema: - $ref: '#/components/schemas/PemPrivateKey' application/json: schema: - $ref: '#/components/schemas/PrivateKey' + $ref: "#/components/schemas/PrivateKey" + application/x-pem-file: + schema: + $ref: "#/components/schemas/PemPrivateKey" required: true parameters: - name: mechanisms @@ -235,13 +284,13 @@ paths: schema: type: array items: - $ref: '#/components/schemas/KeyMechanism' + $ref: "#/components/schemas/KeyMechanism" - name: tags in: query schema: type: array items: - $ref: '#/components/schemas/ID' + $ref: "#/components/schemas/ID" security: - basic: [] x-annotation-role: @@ -251,22 +300,33 @@ paths: /keys/generate: post: responses: - '201': - description: Successful creation of new public and private key pair. Set Location header to the new KeyID. - '400': + "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': + "401": description: Authentication required but none provided. - '403': + "403": description: Access denied. - '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. + "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' + $ref: "#/components/schemas/KeyGenerateRequestData" required: true security: - basic: [] @@ -277,7 +337,7 @@ paths: /keys/{KeyID}: get: responses: - '200': + "200": description: | For response body with content type `application/json`: * *RSA* keys include `modulus` and `publicExponent` properties. @@ -288,10 +348,10 @@ paths: content: application/json: schema: - $ref: '#/components/schemas/PublicKey' + $ref: "#/components/schemas/PublicKey" examples: rsa: - summary: 'RSA' + summary: "RSA" value: mechanisms: - RSA_Signature_PSS_SHA256 @@ -303,9 +363,9 @@ paths: modulus: FhJQl11CiY0ifRHXeAqFh4rdSl6 publicExponent: FhJQl11CiY0ifRHXeAqFh4rdSl6 operations: 242 - + ecdsa: - summary: 'P* Keys' + summary: "P* Keys" value: mechanisms: - ECDSA_Signature @@ -313,11 +373,11 @@ paths: operations: 242 restrictions: tags: - - berlin + - berlin key: data: BMKlPJ60PNFgsekRwg7n5mTIJkWWy6XLy0ORj14HumKi5qH63JaJzFOWLxYiaB6KH0NOgEKb7rUt eddsa: - summary: 'Curve25519' + summary: "Curve25519" value: mechanisms: - EdDSA_Signature @@ -325,17 +385,32 @@ paths: operations: 242 restrictions: tags: - - berlin + - berlin key: data: htnjTKRUz3XnLys5YD2+bKvzXZuu9cvXKwsCnWdzR+4= - '401': + 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': + "403": description: Access denied. - '404': + "404": description: Key for KeyID not found. - '412': - description: Precondition failed (NetHSM was not Operational). + "406": + description: Content type in Accept header not supported. + "412": + description: Precondition failed (NetHSM was not *Operational*). description: Retrieve the public key. security: - basic: [] @@ -347,19 +422,24 @@ paths: x-test-value-KeyID: myKey1 put: responses: - '204': + "204": description: Successful import of a private key. - '400': + "400": description: Bad request (specified properties are invalid). - '401': + "401": description: Authentication required but none provided. - '403': + "403": description: Access denied. - '409': + "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. + "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`: @@ -370,12 +450,9 @@ paths: * *Curve25519* uses the `data` property. Keys are the raw (little endian) key. content: - application/x-pem-file: - schema: - $ref: '#/components/schemas/PemPrivateKey' application/json: schema: - $ref: '#/components/schemas/PrivateKey' + $ref: "#/components/schemas/PrivateKey" examples: rsa: summary: RSA @@ -412,6 +489,9 @@ paths: restrictions: tags: - berlin + application/x-pem-file: + schema: + $ref: "#/components/schemas/PemPrivateKey" required: true parameters: - name: mechanisms @@ -419,13 +499,13 @@ paths: schema: type: array items: - $ref: '#/components/schemas/KeyMechanism' + $ref: "#/components/schemas/KeyMechanism" - name: tags in: query schema: type: array items: - $ref: '#/components/schemas/ID' + $ref: "#/components/schemas/ID" security: - basic: [] x-annotation-role: @@ -435,16 +515,18 @@ paths: x-test-value-KeyID: MyNewKey delete: responses: - '204': + "204": description: Key was successfully deleted. - '401': + "401": description: Authentication required but none provided. - '403': + "403": description: Access denied. - '404': + "404": description: Key for KeyID not found. - '412': - description: Precondition failed (NetHSM was not Operational). + "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: [] @@ -462,22 +544,26 @@ paths: /keys/{KeyID}/public.pem: get: responses: - '200': + "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' - '401': + $ref: "#/components/schemas/PemPublicKey" + "400": + description: Invalid character in the KeyID. + "401": description: Authentication required but none provided. - '403': + "403": description: Access denied. - '404': + "404": description: Key for KeyID not found. - '412': - description: Precondition failed (NetHSM was not Operational). + "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: [] @@ -496,26 +582,30 @@ paths: /keys/{KeyID}/csr.pem: post: responses: - '200': + "200": description: Successful generation of certificate signing request. content: application/x-pem-file: schema: - $ref: '#/components/schemas/PemCSR' - '401': + $ref: "#/components/schemas/PemCSR" + "400": + description: Bad request (specified properties are invalid). + "401": description: Authentication required but none provided. - '403': + "403": description: Access denied. - '404': + "404": description: Key for KeyID not found. - '412': - description: Precondition failed (NetHSM was not Operational). + "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' + $ref: "#/components/schemas/DistinguishedName" required: true security: - basic: [] @@ -534,7 +624,7 @@ paths: /keys/{KeyID}/decrypt: post: responses: - '200': + "200": description: | For response body with content type `application/json`: * Mode `RAW` returns the raw binary data. @@ -543,21 +633,23 @@ paths: content: application/json: schema: - $ref: '#/components/schemas/DecryptData' - '400': + $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': + "401": description: Authentication required but none provided. - '403': + "403": description: Access denied. - '404': + "404": description: Key for KeyID not found. - '412': - description: Precondition failed (NetHSM was not Operational). + "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: | @@ -568,7 +660,7 @@ paths: content: application/json: schema: - $ref: '#/components/schemas/DecryptRequestData' + $ref: "#/components/schemas/DecryptRequestData" required: true security: - basic: [] @@ -586,28 +678,30 @@ paths: /keys/{KeyID}/encrypt: post: responses: - '200': - description: '' + "200": + description: "" content: application/json: schema: - $ref: '#/components/schemas/EncryptData' - '400': + $ref: "#/components/schemas/EncryptData" + "400": description: Bad Request, e.g. invalid mechanism. - '401': + "401": description: Authentication required but none provided. - '403': + "403": description: Access denied. - '404': + "404": description: Key for KeyID not found. - '412': - description: Precondition failed (NetHSM was not Operational). + "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' + $ref: "#/components/schemas/EncryptRequestData" required: true security: - basic: [] @@ -625,7 +719,7 @@ paths: /keys/{KeyID}/sign: post: responses: - '200': + "200": description: | For response body with content type `application/json`: * Mode `PKCS1` returns the PKCS1 padded signature @@ -638,8 +732,8 @@ paths: content: application/json: schema: - $ref: '#/components/schemas/SignData' - '400': + $ref: "#/components/schemas/SignData" + "400": description: | Bad Request, e.g. invalid signing mode. * Mode `PKCS1` returns failure if input is bigger than key size @@ -647,14 +741,16 @@ paths: 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': + "401": description: Authentication required but none provided. - '403': + "403": description: Access denied. - '404': + "404": description: Key for KeyID not found. - '412': - description: Precondition failed (NetHSM was not Operational). + "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: | @@ -670,7 +766,7 @@ paths: content: application/json: schema: - $ref: '#/components/schemas/SignRequestData' + $ref: "#/components/schemas/SignRequestData" required: true security: - basic: [] @@ -688,21 +784,33 @@ paths: /keys/{KeyID}/cert: get: responses: - '200': - description: '' + "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' - '401': + $ref: "#/components/schemas/PGPPrivateKey" + "400": + description: Invalid character in the KeyID. + "401": description: Authentication required but none provided. - '403': + "403": description: Access denied. - '404': + "404": description: Certificate for KeyID not found. - '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. + "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: @@ -713,28 +821,35 @@ paths: x-test-value-KeyID: myKey1 put: responses: - '201': + "201": description: Successful import of a certificate. - '401': + "401": description: Authentication required but none provided. - '403': + "403": description: Access denied. - '409': + "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. + "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' + $ref: "#/components/schemas/PemCert" application/x-x509-ca-cert: schema: type: string application/pgp-keys: schema: - $ref: '#/components/schemas/PGPPrivateKey' + $ref: "#/components/schemas/PGPPrivateKey" required: true security: - basic: [] @@ -745,16 +860,20 @@ paths: x-test-value-KeyID: myKey1 delete: responses: - '204': + "204": description: Successful deletion of a certificate. - '401': + "401": description: Authentication required but none provided. - '403': + "403": description: Access denied. - '404': + "404": description: Certificate with this KeyID not found. - '412': - description: Precondition failed (NetHSM was not Operational). + "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: [] @@ -773,20 +892,22 @@ paths: /keys/{KeyID}/restrictions/tags/{Tag}: put: responses: - '204': + "204": description: Successful addition of the tag. - '304': + "304": description: Tag is already present for this key. - '400': + "400": description: Bad request, tag format is invalid. - '401': + "401": description: Authentication required but none provided. - '403': + "403": description: Access denied. - '404': + "404": description: KeyID not found. - '412': - description: Precondition failed (NetHSM was not Operational). + "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: [] @@ -798,16 +919,18 @@ paths: x-test-value-Tag: MyNewTag delete: responses: - '204': + "204": description: Successful deletion of the tag. - '401': + "401": description: Authentication required but none provided. - '403': + "403": description: Access denied. - '404': + "404": description: Tag or keyID not found. - '412': - description: Precondition failed (NetHSM was not Operational). + "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: [] @@ -831,18 +954,20 @@ paths: /users: get: responses: - '200': - description: '' + "200": + description: "" content: application/json: schema: - $ref: '#/components/schemas/UserList' - '401': + $ref: "#/components/schemas/UserList" + "401": description: Authentication required but none provided. - '403': + "403": description: Access denied. - '412': - description: Precondition failed (NetHSM was not Operational). + "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: [] @@ -852,22 +977,27 @@ paths: - Operational post: responses: - '201': - description: Successful creation of user. The response contains a Location header, e.g. "https://nethsm.local/v1/users/I8mhHYJ1T3uk2lXrwXehVaw9KZzg7K". - '400': + "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': + "401": description: Authentication required but none provided. - '403': + "403": description: Access denied. - '412': - description: Precondition failed (NetHSM was not Operational). + "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' + $ref: "#/components/schemas/UserPostData" required: true security: - basic: [] @@ -878,21 +1008,26 @@ paths: /users/{UserID}: get: responses: - '200': - description: '' + "200": + description: "" content: application/json: schema: - $ref: '#/components/schemas/UserData' - '401': + $ref: "#/components/schemas/UserData" + + "400": + description: Invalid character in the UserID. + "401": description: Authentication required but none provided. - '403': + "403": description: Access denied. - '404': + "404": description: User for UserID not found. - '412': - description: Precondition failed (NetHSM was not Operational). - description: 'Get user info: name and role.' + "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: @@ -903,24 +1038,26 @@ paths: x-test-value-UserID: operator put: responses: - '201': + "201": description: Successful creation of user. - '400': + "400": description: Bad request (specified properties are invalid, e.g. weak passphrase). - '401': + "401": description: Authentication required but none provided. - '403': + "403": description: Access denied. - '409': + "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). + "412": + description: Precondition failed (NetHSM was not *Operational*). description: Create a user on keyfender. requestBody: content: application/json: schema: - $ref: '#/components/schemas/UserPostData' + $ref: "#/components/schemas/UserPostData" required: true security: - basic: [] @@ -931,16 +1068,18 @@ paths: x-test-value-UserID: newOperator delete: responses: - '204': + "204": description: Successful deletion of user. - '401': + "401": description: Authentication required but none provided. - '403': + "403": description: Access denied. - '404': + "404": description: User not found for this user-ID. - '412': - description: Precondition failed (NetHSM was not Operational). + "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: [] @@ -958,24 +1097,26 @@ paths: /users/{UserID}/passphrase: post: responses: - '204': + "204": description: Successful change of passphrase. - '400': + "400": description: Bad request - weak passphrase. - '401': + "401": description: Authentication required but none provided. - '403': + "403": description: Access denied. - '404': + "404": description: User not found for this user-ID. - '412': - description: Precondition failed (NetHSM was not Operational). + "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' + $ref: "#/components/schemas/UserPassphrasePostData" required: true security: - basic: [] @@ -994,20 +1135,24 @@ paths: /users/{UserID}/tags: get: responses: - '200': - description: '' + "200": + description: "" content: application/json: schema: - $ref: '#/components/schemas/TagList' - '401': + $ref: "#/components/schemas/TagList" + "400": + description: Invalid character in the UserID. + "401": description: Authentication required but none provided. - '403': + "403": description: Access denied. - '404': + "404": description: User not found for this user-ID. - '412': - description: Precondition failed (NetHSM was not Operational). + "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: [] @@ -1026,20 +1171,22 @@ paths: /users/{UserID}/tags/{Tag}: put: responses: - '204': + "204": description: Successful addition of the tag. - '304': + "304": description: Tag is already present for this UserID. - '400': + "400": description: Bad request, tag format is invalid or user is not an operator. - '401': + "401": description: Authentication required but none provided. - '403': + "403": description: Access denied. - '404': + "404": description: UserID not found. - '412': - description: Precondition failed (NetHSM was not Operational). + "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: [] @@ -1051,16 +1198,18 @@ paths: x-test-value-Tag: munich delete: responses: - '204': + "204": description: Successful deletion of the tag. - '401': + "401": description: Authentication required but none provided. - '403': + "403": description: Access denied. - '404': + "404": description: Tag or user not found. - '412': - description: Precondition failed (NetHSM was not Operational). + "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: [] @@ -1084,22 +1233,24 @@ paths: /config/unlock-passphrase: put: responses: - '204': + "204": description: Successful change of passphrase. - '400': + "400": description: Bad request - weak passphrase. - '401': + "401": description: Authentication required but none provided. - '403': + "403": description: Access denied. - '412': - description: Precondition failed (NetHSM was not Operational). + "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' + $ref: "#/components/schemas/UnlockPassphraseConfig" required: true security: - basic: [] @@ -1110,19 +1261,21 @@ paths: /config/unattended-boot: get: responses: - '200': + "200": description: Successful read of unattended boot configuration. content: application/json: schema: - $ref: '#/components/schemas/UnattendedBootConfig' - '401': + $ref: "#/components/schemas/UnattendedBootConfig" + "401": description: Authentication required but none provided. - '403': + "403": description: Access denied. - '412': - description: Precondition failed (NetHSM was not Operational). - description: 'Read unattended boot configuration: is it on or off?' + "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: @@ -1131,22 +1284,24 @@ paths: - Operational put: responses: - '204': + "204": description: Successful change of unattended boot mode. - '400': + "400": description: Bad request - invalid status setting. - '401': + "401": description: Authentication required but none provided. - '403': + "403": description: Access denied. - '412': - description: Precondition failed (NetHSM was not Operational). - description: 'Configure unattended boot: switch it on or off (flip the switch).' + "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' + $ref: "#/components/schemas/UnattendedBootConfig" required: true security: - basic: [] @@ -1157,18 +1312,20 @@ paths: /config/tls/public.pem: get: responses: - '200': + "200": description: Successful retrieval of public key. content: application/x-pem-file: schema: - $ref: '#/components/schemas/PemPublicKey' - '401': + $ref: "#/components/schemas/PemPublicKey" + "401": description: Authentication required but none provided. - '403': + "403": description: Access denied. - '412': - description: Precondition failed (NetHSM was not Operational). + "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: [] @@ -1179,18 +1336,22 @@ paths: /config/tls/cert.pem: get: responses: - '200': + "200": description: Successful retrieval of certificate. content: application/x-pem-file: schema: - $ref: '#/components/schemas/PemCert' - '401': + $ref: "#/components/schemas/PemCert" + "401": description: Authentication required but none provided. - '403': + "403": description: Access denied. - '412': - description: Precondition failed (NetHSM was not Operational). + "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: [] @@ -1200,20 +1361,24 @@ paths: - Operational put: responses: - '201': + "201": description: Successfully set certificate. - '401': + "400": + description: Certificate malformed. + "401": description: Authentication required but none provided. - '403': + "403": description: Access denied. - '412': - description: Precondition failed (NetHSM was not Operational). + "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' + $ref: "#/components/schemas/PemCert" required: true security: - basic: [] @@ -1224,24 +1389,26 @@ paths: /config/tls/csr.pem: post: responses: - '200': + "200": description: Successful generation of certificate signing request. content: application/x-pem-file: schema: - $ref: '#/components/schemas/PemCSR' - '401': + $ref: "#/components/schemas/PemCSR" + "401": description: Authentication required but none provided. - '403': + "403": description: Access denied. - '412': - description: Precondition failed (NetHSM was not Operational). + "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' + $ref: "#/components/schemas/DistinguishedName" required: true security: - basic: [] @@ -1252,22 +1419,24 @@ paths: /config/tls/generate: post: responses: - '204': + "204": description: Successful creation of new public and private key pair for NetHSM's https API. - '400': + "400": description: Bad request (specified properties are invalid). - '401': + "401": description: Authentication required but none provided. - '403': + "403": description: Access denied. - '412': - description: Precondition failed (NetHSM was not Operational). + "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' + $ref: "#/components/schemas/TlsKeyGenerateRequestData" required: true security: - basic: [] @@ -1278,18 +1447,20 @@ paths: /config/network: get: responses: - '200': + "200": description: Successful retrieval of network configuration. content: application/json: schema: - $ref: '#/components/schemas/NetworkConfig' - '401': + $ref: "#/components/schemas/NetworkConfig" + "401": description: Authentication required but none provided. - '403': + "403": description: Access denied. - '412': - description: Precondition failed (NetHSM was not Operational). + "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: [] @@ -1299,22 +1470,24 @@ paths: - Operational put: responses: - '204': + "204": description: Succesful update of network configuration. - '400': + "400": description: Bad request - invalid input format. - '401': + "401": description: Authentication required but none provided. - '403': + "403": description: Access denied. - '412': - description: Precondition failed (NetHSM was not Operational). + "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' + $ref: "#/components/schemas/NetworkConfig" required: true security: - basic: [] @@ -1325,19 +1498,24 @@ paths: /config/logging: get: responses: - '200': + "200": description: Successful retrieval of logging configuration. content: application/json: schema: - $ref: '#/components/schemas/LoggingConfig' - '401': + $ref: "#/components/schemas/LoggingConfig" + "401": description: Authentication required but none provided. - '403': + "403": description: Access denied. - '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. + "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: @@ -1346,22 +1524,24 @@ paths: - Operational put: responses: - '204': + "204": description: Succesful update of logging configuration. - '400': + "400": description: Bad request - invalid input format. - '401': + "401": description: Authentication required but none provided. - '403': + "403": description: Access denied. - '412': - description: Precondition failed (NetHSM was not Operational). + "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' + $ref: "#/components/schemas/LoggingConfig" required: true security: - basic: [] @@ -1372,22 +1552,24 @@ paths: /config/backup-passphrase: put: responses: - '204': + "204": description: Successful change of passphrase. - '400': + "400": description: Bad request - weak passphrase. - '401': + "401": description: Authentication required but none provided. - '403': + "403": description: Access denied. - '412': - description: Precondition failed (NetHSM was not Operational). + "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' + $ref: "#/components/schemas/BackupPassphraseConfig" required: true security: - basic: [] @@ -1398,18 +1580,20 @@ paths: /config/time: get: responses: - '200': + "200": description: Successful retrieval of system time. content: application/json: schema: - $ref: '#/components/schemas/TimeConfig' - '401': + $ref: "#/components/schemas/TimeConfig" + "401": description: Authentication required but none provided. - '403': + "403": description: Access denied. - '412': - description: Precondition failed (NetHSM was not Operational). + "406": + description: Content type in Accept header not supported. + "412": + description: Precondition failed (NetHSM was not *Operational*). description: Get system time. security: - basic: [] @@ -1419,22 +1603,24 @@ paths: - Operational put: responses: - '204': + "204": description: Succesful update of system time. - '400': + "400": description: Bad request - invalid input format. - '401': + "401": description: Authentication required but none provided. - '403': + "403": description: Access denied. - '412': - description: Precondition failed (NetHSM was not Operational). + "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' + $ref: "#/components/schemas/TimeConfig" required: true security: - basic: [] @@ -1445,19 +1631,22 @@ paths: /system/info: get: responses: - '200': + "200": description: Successful retrieval of system information. content: application/json: schema: - $ref: '#/components/schemas/SystemInfo' - '401': + $ref: "#/components/schemas/SystemInfo" + "401": description: Authentication required but none provided. - '403': + "403": description: Access denied. - '412': - description: Precondition failed (NetHSM was not Operational). - description: Get detailed system information, including firmware version, system software version, hardware version. + "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: @@ -1467,14 +1656,16 @@ paths: /system/reboot: post: responses: - '204': + "204": description: About to reboot NetHSM. - '401': + "401": description: Authentication required but none provided. - '403': + "403": description: Access denied. - '412': - description: Precondition failed (NetHSM was not Operational). + "406": + description: Content type in Accept header not supported. + "412": + description: Precondition failed (NetHSM was not *Operational*). description: Reboot NetHSM. security: - basic: [] @@ -1485,14 +1676,16 @@ paths: /system/shutdown: post: responses: - '204': + "204": description: About to shut down NetHSM. - '401': + "401": description: Authentication required but none provided. - '403': + "403": description: Access denied. - '412': - description: Precondition failed (NetHSM was not Operational). + "406": + description: Content type in Accept header not supported. + "412": + description: Precondition failed (NetHSM was not *Operational*). description: Shut down NetHSM. security: - basic: [] @@ -1503,14 +1696,16 @@ paths: /system/factory-reset: post: responses: - '204': + "204": description: About to reset NetHSM. - '401': + "401": description: Authentication required but none provided. - '403': + "403": description: Access denied. - '412': - description: Precondition failed (NetHSM was not Operational). + "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: [] @@ -1521,20 +1716,24 @@ paths: /system/update: post: responses: - '200': + "200": description: Successfully verified update image (authenticity, integrity, and version number). content: application/json: schema: - $ref: '#/components/schemas/SystemUpdateData' - '401': + $ref: "#/components/schemas/SystemUpdateData" + "400": + description: Update malformed. + "401": description: Authentication required but none provided. - '403': + "403": description: Access denied. - '409': + "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). + "412": + description: Precondition failed (NetHSM was not *Operational*). description: Update NetHSM software. requestBody: content: @@ -1551,14 +1750,18 @@ paths: /system/commit-update: post: responses: - '204': + "204": description: About to update NetHSM. - '401': + "401": description: Authentication required but none provided. - '403': + "403": description: Access denied. - '412': - description: Precondition failed (NetHSM was not Operational or update image is not present - call /update first). + "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: [] @@ -1569,14 +1772,18 @@ paths: /system/cancel-update: post: responses: - '204': + "204": description: Update successfully cancelled. - '401': + "401": description: Authentication required but none provided. - '403': + "403": description: Access denied. - '412': - description: Precondition failed (NetHSM was not Operational or update image is not present - call /update first). + "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: [] @@ -1587,14 +1794,18 @@ paths: /system/backup: post: responses: - '200': + "200": description: Successful retrieval of backup data. - '401': + "401": description: Authentication required but none provided. - '403': + "403": description: Access denied. - '412': - description: Precondition failed (NetHSM was not Operational or Backup Passphrase was not set). + "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: [] @@ -1605,13 +1816,19 @@ paths: /system/restore: post: responses: - '204': + "204": description: Successful restore from backup data. - '400': + "400": description: Bad request - restore did not apply. - '412': - description: Precondition failed (NetHSM was not Unprovisioned). - description: Restore the key store from a backup file. Only available in Unprovisioned state. + "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: @@ -1623,10 +1840,9 @@ paths: in: query required: true schema: - $ref: '#/components/schemas/Passphrase' + $ref: "#/components/schemas/Passphrase" - name: systemTime in: query - required: true schema: type: string format: date-time @@ -1634,6 +1850,7 @@ paths: - Public x-annotation-state: - Unprovisioned + - Operational components: schemas: Passphrase: @@ -1649,8 +1866,8 @@ components: type: string Switch: enum: - - 'on' - - 'off' + - "on" + - "off" type: string SystemState: enum: @@ -1746,21 +1963,21 @@ components: - key: KeyID type: array items: - $ref: '#/components/schemas/KeyItem' + $ref: "#/components/schemas/KeyItem" KeyItem: example: key: KeyID type: object properties: key: - $ref: '#/components/schemas/ID' + $ref: "#/components/schemas/ID" required: - key KeyRestrictions: type: object properties: tags: - $ref: '#/components/schemas/TagList' + $ref: "#/components/schemas/TagList" UserList: example: - user: admin @@ -1769,12 +1986,12 @@ components: - user: operator type: array items: - $ref: '#/components/schemas/UserItem' + $ref: "#/components/schemas/UserItem" UserItem: type: object properties: user: - $ref: '#/components/schemas/ID' + $ref: "#/components/schemas/ID" required: - user TagList: @@ -1783,11 +2000,11 @@ components: - frankfurt type: array items: - $ref: '#/components/schemas/ID' + $ref: "#/components/schemas/ID" KeyMechanisms: type: array items: - $ref: '#/components/schemas/KeyMechanism' + $ref: "#/components/schemas/KeyMechanism" PrivateKey: example: mechanisms: @@ -1803,13 +2020,13 @@ components: type: object properties: mechanisms: - $ref: '#/components/schemas/KeyMechanisms' + $ref: "#/components/schemas/KeyMechanisms" type: - $ref: '#/components/schemas/KeyType' + $ref: "#/components/schemas/KeyType" key: - $ref: '#/components/schemas/KeyPrivateData' + $ref: "#/components/schemas/KeyPrivateData" restrictions: - $ref: '#/components/schemas/KeyRestrictions' + $ref: "#/components/schemas/KeyRestrictions" required: - mechanisms - type @@ -1818,13 +2035,13 @@ components: type: object properties: primeP: - $ref: '#/components/schemas/Base64' + $ref: "#/components/schemas/Base64" primeQ: - $ref: '#/components/schemas/Base64' + $ref: "#/components/schemas/Base64" publicExponent: - $ref: '#/components/schemas/Base64' + $ref: "#/components/schemas/Base64" data: - $ref: '#/components/schemas/Base64' + $ref: "#/components/schemas/Base64" PublicKey: example: mechanisms: @@ -1840,40 +2057,40 @@ components: type: object properties: mechanisms: - $ref: '#/components/schemas/KeyMechanisms' + $ref: "#/components/schemas/KeyMechanisms" type: - $ref: '#/components/schemas/KeyType' + $ref: "#/components/schemas/KeyType" restrictions: - $ref: '#/components/schemas/KeyRestrictions' + $ref: "#/components/schemas/KeyRestrictions" key: - anyOf: - - $ref: '#/components/schemas/KeyPublicData' - - type: object - nullable: true + $ref: "#/components/schemas/KeyPublicData" operations: type: integer required: - mechanisms - type - restrictions - - key - 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' + $ref: "#/components/schemas/Base64" publicExponent: - $ref: '#/components/schemas/Base64' + $ref: "#/components/schemas/Base64" data: - $ref: '#/components/schemas/Base64' + $ref: "#/components/schemas/Base64" DistinguishedName: example: countryName: DE - stateOrProvinceName: '' + stateOrProvinceName: "" localityName: Berlin organizationName: Nitrokey - organizationalUnitName: '' + organizationalUnitName: "" commonName: nethsm.local emailAddress: info@nitrokey.com type: object @@ -1913,7 +2130,7 @@ components: type: object properties: state: - $ref: '#/components/schemas/SystemState' + $ref: "#/components/schemas/SystemState" required: - state MetricsData: @@ -1925,13 +2142,13 @@ components: example: unlockPassphrase: UnlockPassphrase adminPassphrase: Administrator - systemTime: '2018-10-30T11:20:50Z' + systemTime: "2018-10-30T11:20:50Z" type: object properties: unlockPassphrase: - $ref: '#/components/schemas/Passphrase' + $ref: "#/components/schemas/Passphrase" adminPassphrase: - $ref: '#/components/schemas/Passphrase' + $ref: "#/components/schemas/Passphrase" systemTime: type: string format: date-time @@ -1945,7 +2162,7 @@ components: type: object properties: passphrase: - $ref: '#/components/schemas/Passphrase' + $ref: "#/components/schemas/Passphrase" required: - passphrase RandomRequestData: @@ -1965,7 +2182,7 @@ components: type: object properties: random: - $ref: '#/components/schemas/Base64' + $ref: "#/components/schemas/Base64" required: - random KeyGenerateRequestData: @@ -1978,17 +2195,17 @@ components: type: object properties: mechanisms: - $ref: '#/components/schemas/KeyMechanisms' + $ref: "#/components/schemas/KeyMechanisms" type: - $ref: '#/components/schemas/KeyType' + $ref: "#/components/schemas/KeyType" length: minimum: 128 maximum: 8192 type: integer id: - $ref: '#/components/schemas/ID' + $ref: "#/components/schemas/ID" restrictions: - $ref: '#/components/schemas/KeyRestrictions' + $ref: "#/components/schemas/KeyRestrictions" required: - mechanisms - type @@ -1999,7 +2216,7 @@ components: type: object properties: type: - $ref: '#/components/schemas/TlsKeyType' + $ref: "#/components/schemas/TlsKeyType" length: minimum: 128 maximum: 8192 @@ -2014,11 +2231,11 @@ components: type: object properties: mode: - $ref: '#/components/schemas/EncryptMode' + $ref: "#/components/schemas/EncryptMode" message: - $ref: '#/components/schemas/Base64' + $ref: "#/components/schemas/Base64" iv: - $ref: '#/components/schemas/Base64' + $ref: "#/components/schemas/Base64" required: - mode - message @@ -2029,9 +2246,9 @@ components: type: object properties: encrypted: - $ref: '#/components/schemas/Base64' + $ref: "#/components/schemas/Base64" iv: - $ref: '#/components/schemas/Base64' + $ref: "#/components/schemas/Base64" required: - encrypted - iv @@ -2042,11 +2259,11 @@ components: type: object properties: mode: - $ref: '#/components/schemas/DecryptMode' + $ref: "#/components/schemas/DecryptMode" encrypted: - $ref: '#/components/schemas/Base64' + $ref: "#/components/schemas/Base64" iv: - $ref: '#/components/schemas/Base64' + $ref: "#/components/schemas/Base64" required: - mode - encrypted @@ -2056,7 +2273,7 @@ components: type: object properties: decrypted: - $ref: '#/components/schemas/Base64' + $ref: "#/components/schemas/Base64" required: - decrypted SignRequestData: @@ -2066,9 +2283,9 @@ components: type: object properties: mode: - $ref: '#/components/schemas/SignMode' + $ref: "#/components/schemas/SignMode" message: - $ref: '#/components/schemas/Base64' + $ref: "#/components/schemas/Base64" required: - mode - message @@ -2078,7 +2295,7 @@ components: type: object properties: signature: - $ref: '#/components/schemas/Base64' + $ref: "#/components/schemas/Base64" required: - signature UserPostData: @@ -2091,9 +2308,9 @@ components: realName: type: string role: - $ref: '#/components/schemas/UserRole' + $ref: "#/components/schemas/UserRole" passphrase: - $ref: '#/components/schemas/Passphrase' + $ref: "#/components/schemas/Passphrase" required: - realName - role @@ -2107,7 +2324,7 @@ components: realName: type: string role: - $ref: '#/components/schemas/UserRole' + $ref: "#/components/schemas/UserRole" required: - realName - role @@ -2117,7 +2334,7 @@ components: type: object properties: passphrase: - $ref: '#/components/schemas/Passphrase' + $ref: "#/components/schemas/Passphrase" required: - passphrase UnlockPassphraseConfig: @@ -2126,16 +2343,16 @@ components: type: object properties: passphrase: - $ref: '#/components/schemas/Passphrase' + $ref: "#/components/schemas/Passphrase" required: - passphrase UnattendedBootConfig: example: - status: 'off' + status: "off" type: object properties: status: - $ref: '#/components/schemas/Switch' + $ref: "#/components/schemas/Switch" required: - status NetworkConfig: @@ -2167,7 +2384,7 @@ components: port: type: integer logLevel: - $ref: '#/components/schemas/LogLevel' + $ref: "#/components/schemas/LogLevel" required: - ipAddress - port @@ -2178,12 +2395,12 @@ components: type: object properties: passphrase: - $ref: '#/components/schemas/Passphrase' + $ref: "#/components/schemas/Passphrase" required: - passphrase TimeConfig: example: - time: '2018-10-30T11:20:50Z' + time: "2018-10-30T11:20:50Z" type: object properties: time: @@ -2193,25 +2410,41 @@ components: - time SystemInfo: example: - firmwareVersion: N/A - softwareVersion: '1.7' - hardwareVersion: N/A - buildTag: TAG-NN-g1234567-dirty + 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: - firmwareVersion: - type: string softwareVersion: type: string + softwareBuild: + type: string + firmwareVersion: + type: string hardwareVersion: type: string - buildTag: + deviceId: type: string + akPub: + type: object + pcr: + type: object required: - - firmwareVersion - softwareVersion + - softwareBuild + - firmwareVersion - hardwareVersion - - buildTag + - deviceId + - akPub + - pcr SystemUpdateData: example: releaseNotes: Some new feature is available. diff --git a/pynitrokey/nethsm/__init__.py b/pynitrokey/nethsm/__init__.py index 2199152f..761d7f30 100644 --- a/pynitrokey/nethsm/__init__.py +++ b/pynitrokey/nethsm/__init__.py @@ -17,7 +17,6 @@ from . import client from .client import ApiException -from .client.model.passphrase import Passphrase class Role(enum.Enum): @@ -191,9 +190,9 @@ def _handle_api_exception(e, messages={}, roles=[], state=None): else: message = f"Unexpected API error {e.status}: {e.reason}" - if e.body: + if e.api_response: try: - body = json.loads(e.body) + body = json.loads(e.api_response.response.data) if "message" in body: message += "\n" + body["message"] except json.JSONDecodeError: @@ -209,14 +208,29 @@ def __init__(self, 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 - base_url = f"https://{host}/api/{version}" - config = client.Configuration( - host=base_url, username=username, 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) @@ -269,10 +283,10 @@ def get_user_id_from_location(self, headers): return user_id_match[1] def unlock(self, passphrase): - from .client.model.unlock_request_data import UnlockRequestData + from .client.components.schema.unlock_request_data import UnlockRequestDataDict - request_body = UnlockRequestData( - passphrase=Passphrase(passphrase), + request_body = UnlockRequestDataDict( + passphrase=passphrase, ) try: self.get_api().unlock_post(request_body) @@ -296,11 +310,13 @@ def lock(self): ) def provision(self, unlock_passphrase, admin_passphrase, system_time): - from .client.model.provision_request_data import ProvisionRequestData + from .client.components.schema.provision_request_data import ( + ProvisionRequestDataDict, + ) - request_body = ProvisionRequestData( - unlockPassphrase=Passphrase(unlock_passphrase), - adminPassphrase=Passphrase(admin_passphrase), + request_body = ProvisionRequestDataDict( + unlockPassphrase=unlock_passphrase, + adminPassphrase=admin_passphrase, systemTime=system_time, ) try: @@ -326,9 +342,9 @@ def list_users(self): ) def get_user(self, user_id): - from .client.paths.users_user_id.get import RequestPathParams + from .client.paths.users_user_id.get.path_parameters import PathParametersDict - path_params = RequestPathParams({"UserID": user_id}) + path_params = PathParametersDict(UserID=user_id) try: response = self.get_api().users_user_id_get(path_params=path_params) return User( @@ -347,18 +363,17 @@ def get_user(self, user_id): ) def add_user(self, real_name, role, passphrase, user_id=None): - from .client.model.user_post_data import UserPostData - from .client.model.user_role import UserRole - from .client.paths.users_user_id.put import RequestPathParams + from .client.components.schema.user_post_data import UserPostDataDict + from .client.paths.users_user_id.put.path_parameters import PathParametersDict - body = UserPostData( + body = UserPostDataDict( realName=real_name, - role=UserRole(role), - passphrase=Passphrase(passphrase), + role=role, + passphrase=passphrase, ) try: if user_id: - path_params = RequestPathParams({"UserID": 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: @@ -376,10 +391,12 @@ def add_user(self, real_name, role, passphrase, user_id=None): ) def delete_user(self, user_id): - from .client.paths.users_user_id.delete import RequestPathParams + from .client.paths.users_user_id.delete.path_parameters import ( + PathParametersDict, + ) try: - path_params = RequestPathParams({"UserID": user_id}) + path_params = PathParametersDict(UserID=user_id) self.get_api().users_user_id_delete(path_params=path_params) except ApiException as e: _handle_api_exception( @@ -392,11 +409,15 @@ def delete_user(self, user_id): ) def set_passphrase(self, user_id, passphrase): - from .client.model.user_passphrase_post_data import UserPassphrasePostData - from .client.paths.users_user_id_passphrase.post import RequestPathParams + from .client.components.schema.user_passphrase_post_data import ( + UserPassphrasePostDataDict, + ) + from .client.paths.users_user_id_passphrase.post.path_parameters import ( + PathParametersDict, + ) - path_params = RequestPathParams({"UserID": user_id}) - body = UserPassphrasePostData(passphrase=Passphrase(passphrase)) + 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 @@ -413,9 +434,11 @@ def set_passphrase(self, user_id, passphrase): ) def list_operator_tags(self, user_id): - from .client.paths.users_user_id_tags.get import RequestPathParams + from .client.paths.users_user_id_tags.get.path_parameters import ( + PathParametersDict, + ) - path_params = RequestPathParams({"UserID": user_id}) + path_params = PathParametersDict(UserID=user_id) try: response = self.get_api().users_user_id_tags_get(path_params=path_params) return response.body @@ -430,9 +453,11 @@ def list_operator_tags(self, user_id): ) def add_operator_tag(self, user_id, tag): - from .client.paths.users_user_id_tags_tag.put import RequestPathParams + from .client.paths.users_user_id_tags_tag.put.path_parameters import ( + PathParametersDict, + ) - path_params = RequestPathParams({"UserID": user_id, "Tag": tag}) + 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: @@ -447,9 +472,11 @@ def add_operator_tag(self, user_id, tag): ) def delete_operator_tag(self, user_id, tag): - from .client.paths.users_user_id_tags_tag.delete import RequestPathParams + from .client.paths.users_user_id_tags_tag.delete.path_parameters import ( + PathParametersDict, + ) - path_params = RequestPathParams({"UserID": user_id, "Tag": tag}) + 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: @@ -463,11 +490,11 @@ def delete_operator_tag(self, user_id, tag): ) def add_key_tag(self, key_id, tag): - from .client.paths.keys_key_id_restrictions_tags_tag.put import ( - RequestPathParams, + from .client.paths.keys_key_id_restrictions_tags_tag.put.path_parameters import ( + PathParametersDict, ) - path_params = RequestPathParams({"KeyID": key_id, "Tag": tag}) + path_params = PathParametersDict(KeyID=key_id, Tag=tag) try: return self.get_api().keys_key_id_restrictions_tags_tag_put( path_params=path_params @@ -485,11 +512,11 @@ def add_key_tag(self, key_id, tag): ) def delete_key_tag(self, key_id, tag): - from .client.paths.keys_key_id_restrictions_tags_tag.delete import ( - RequestPathParams, + from .client.paths.keys_key_id_restrictions_tags_tag.delete.path_parameters import ( + PathParametersDict, ) - path_params = RequestPathParams({"KeyID": key_id, "Tag": tag}) + path_params = PathParametersDict(KeyID=key_id, Tag=tag) try: return self.get_api().keys_key_id_restrictions_tags_tag_delete( path_params=path_params @@ -519,9 +546,9 @@ def get_state(self): _handle_api_exception(e) def get_random_data(self, n): - from .client.model.random_request_data import RandomRequestData + from .client.components.schema.random_request_data import RandomRequestDataDict - body = RandomRequestData(length=n) + body = RandomRequestDataDict(length=n) try: response = self.get_api().random_post(body=body) return response.body["random"] @@ -536,11 +563,11 @@ def get_metrics(self): _handle_api_exception(e, state=State.OPERATIONAL, roles=[Role.METRICS]) def list_keys(self, filter): - from .client.paths.keys.get import RequestQueryParams + from .client.paths.keys.get.query_parameters import QueryParametersDict try: if filter: - query_params = RequestQueryParams({"filter": filter}) + query_params = QueryParametersDict(filter=filter) response = self.get_api().keys_get(query_params=query_params) else: response = self.get_api().keys_get() @@ -553,9 +580,9 @@ def list_keys(self, filter): ) def get_key(self, key_id): - from .client.paths.keys_key_id.get import RequestPathParams + from .client.paths.keys_key_id.get.path_parameters import PathParametersDict - path_params = RequestPathParams({"KeyID": key_id}) + path_params = PathParametersDict(KeyID=key_id) try: response = self.get_api().keys_key_id_get(path_params=path_params) key = response.body @@ -582,9 +609,11 @@ def get_key(self, key_id): ) def get_key_public_key(self, key_id): - from .client.paths.keys_key_id_public_pem.get import RequestPathParams + from .client.paths.keys_key_id_public_pem.get.path_parameters import ( + PathParametersDict, + ) - path_params = RequestPathParams({"KeyID": key_id}) + path_params = PathParametersDict(KeyID=key_id) try: response = self.get_api().keys_key_id_public_pem_get( path_params=path_params, skip_deserialization=True @@ -603,52 +632,54 @@ def get_key_public_key(self, key_id): def add_key( self, key_id, type, mechanisms, tags, prime_p, prime_q, public_exponent, data ): - from .client.model.key_mechanism import KeyMechanism - from .client.model.key_mechanisms import KeyMechanisms - from .client.model.key_private_data import KeyPrivateData - from .client.model.key_restrictions import KeyRestrictions - from .client.model.key_type import KeyType - from .client.model.private_key import PrivateKey - from .client.model.tag_list import TagList - from .client.paths.keys_key_id.put import RequestPathParams - - path_params = RequestPathParams({"KeyID": key_id}) + 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 = KeyPrivateData( - prime_p=prime_p, - prime_q=prime_q, - public_exponent=public_exponent, + key_data = KeyPrivateDataDict( + primeP=prime_p, + primeQ=prime_q, + publicExponent=public_exponent, ) else: - key_data = KeyPrivateData(data=data) + key_data = KeyPrivateDataDict(data=data) if tags: - body = PrivateKey( - type=KeyType(type), - mechanisms=KeyMechanisms( - [KeyMechanism(mechanism) for mechanism in mechanisms] - ), + body = PrivateKeyDict( + type=type, + mechanisms=mechanisms, key=key_data, - restrictions=KeyRestrictions(tags=TagList([tag for tag in tags])), + restrictions=KeyRestrictionsDict( + tags=TagListTuple([tag for tag in tags]) + ), ) else: - body = PrivateKey( - type=KeyType(type), - mechanisms=KeyMechanisms( - [KeyMechanism(mechanism) for mechanism in mechanisms] - ), + 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" + 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" + body=body, + content_type="application/json", + skip_deserialization=True, ) return self.get_key_id_from_location(response.response.getheaders()) except ApiException as e: @@ -663,9 +694,9 @@ def add_key( ) def delete_key(self, key_id): - from .client.paths.keys_key_id.delete import RequestPathParams + from .client.paths.keys_key_id.delete.path_parameters import PathParametersDict - path_params = RequestPathParams({"KeyID": key_id}) + path_params = PathParametersDict(KeyID=key_id) try: self.get_api().keys_key_id_delete(path_params=path_params) except ApiException as e: @@ -679,30 +710,28 @@ def delete_key(self, key_id): ) def generate_key(self, type, mechanisms, length, key_id): - from .client.model.key_generate_request_data import KeyGenerateRequestData - from .client.model.key_mechanism import KeyMechanism - from .client.model.key_mechanisms import KeyMechanisms - from .client.model.key_type import KeyType + from .client.components.schema.key_generate_request_data import ( + KeyGenerateRequestDataDict, + ) + from .client.components.schema.key_mechanisms import KeyMechanismsTuple if key_id: - body = KeyGenerateRequestData( - type=KeyType(type), - mechanisms=KeyMechanisms( - [KeyMechanism(mechanism) for mechanism in mechanisms] - ), + body = KeyGenerateRequestDataDict( + type=type, + mechanisms=KeyMechanismsTuple(mechanisms), length=length, id=key_id, ) else: - body = KeyGenerateRequestData( - type=KeyType(type), - mechanisms=KeyMechanisms( - [KeyMechanism(mechanism) for mechanism in mechanisms] - ), + body = KeyGenerateRequestDataDict( + type=type, + mechanisms=KeyMechanismsTuple(mechanisms), length=length, ) try: - response = self.get_api().keys_generate_post(body=body) + 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() ) @@ -773,8 +802,16 @@ def get_certificate(self): def get_key_certificate(self, key_id): try: - response = self.request("GET", f"keys/{key_id}/cert") - return response.content.decode("utf-8") + 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, @@ -819,9 +856,11 @@ def set_key_certificate(self, key_id, cert, mime_type): ) def delete_key_certificate(self, key_id): - from .client.paths.keys_key_id_cert.delete import RequestPathParams + from .client.paths.keys_key_id_cert.delete.path_parameters import ( + PathParametersDict, + ) - path_params = RequestPathParams({"KeyID": key_id}) + path_params = PathParametersDict(KeyID=key_id) try: return self.get_api().keys_key_id_cert_delete(path_params=path_params) except ApiException as e: @@ -869,19 +908,18 @@ def generate_tls_key( type, length, ): - from .client.model.tls_key_generate_request_data import ( - TlsKeyGenerateRequestData, + from .client.components.schema.tls_key_generate_request_data import ( + TlsKeyGenerateRequestDataDict, ) - from .client.model.tls_key_type import TlsKeyType if type == "RSA": - body = TlsKeyGenerateRequestData( - type=TlsKeyType(type), + body = TlsKeyGenerateRequestDataDict( + type=type, length=length, ) else: - body = TlsKeyGenerateRequestData( - type=TlsKeyType(type), + body = TlsKeyGenerateRequestDataDict( + type=type, ) try: @@ -902,9 +940,11 @@ def key_csr( common_name, email_address, ): - from .client.paths.keys_key_id_csr_pem.post import RequestPathParams + from .client.paths.keys_key_id_csr_pem.post.path_parameters import ( + PathParametersDict, + ) - path_params = RequestPathParams({"KeyID": key_id}) + path_params = PathParametersDict(KeyID=key_id) body = { "countryName": country, "stateOrProvinceName": state_or_province, @@ -930,9 +970,11 @@ def key_csr( ) def set_backup_passphrase(self, passphrase): - from .client.model.backup_passphrase_config import BackupPassphraseConfig + from .client.components.schema.backup_passphrase_config import ( + BackupPassphraseConfigDict, + ) - body = BackupPassphraseConfig(passphrase=Passphrase(passphrase)) + body = BackupPassphraseConfigDict(passphrase=passphrase) try: self.get_api().config_backup_passphrase_put(body=body) except ApiException as e: @@ -946,9 +988,11 @@ def set_backup_passphrase(self, passphrase): ) def set_unlock_passphrase(self, passphrase): - from .client.model.unlock_passphrase_config import UnlockPassphraseConfig + from .client.components.schema.unlock_passphrase_config import ( + UnlockPassphraseConfigDict, + ) - body = UnlockPassphraseConfig(passphrase=Passphrase(passphrase)) + body = UnlockPassphraseConfigDict(passphrase=passphrase) try: self.get_api().config_unlock_passphrase_put(body=body) except ApiException as e: @@ -962,12 +1006,9 @@ def set_unlock_passphrase(self, passphrase): ) def set_logging_config(self, ip_address, port, log_level): - from .client.model.log_level import LogLevel - from .client.model.logging_config import LoggingConfig + from .client.components.schema.logging_config import LoggingConfigDict - body = LoggingConfig( - ipAddress=ip_address, port=port, logLevel=LogLevel(log_level) - ) + body = LoggingConfigDict(ipAddress=ip_address, port=port, logLevel=log_level) try: self.get_api().config_logging_put(body=body) except ApiException as e: @@ -981,9 +1022,9 @@ def set_logging_config(self, ip_address, port, log_level): ) def set_network_config(self, ip_address, netmask, gateway): - from .client.model.network_config import NetworkConfig + from .client.components.schema.network_config import NetworkConfigDict - body = NetworkConfig(ipAddress=ip_address, netmask=netmask, gateway=gateway) + body = NetworkConfigDict(ipAddress=ip_address, netmask=netmask, gateway=gateway) try: self.get_api().config_network_put(body=body) except ApiException as e: @@ -997,9 +1038,9 @@ def set_network_config(self, ip_address, netmask, gateway): ) def set_time(self, time): - from .client.model.time_config import TimeConfig + from .client.components.schema.time_config import TimeConfigDict - body = TimeConfig(time=time) + body = TimeConfigDict(time=time) try: self.get_api().config_time_put(body=body) except ApiException as e: @@ -1013,10 +1054,11 @@ def set_time(self, time): ) def set_unattended_boot(self, status): - from .client.model.switch import Switch - from .client.model.unattended_boot_config import UnattendedBootConfig + from .client.components.schema.unattended_boot_config import ( + UnattendedBootConfigDict, + ) - body = UnattendedBootConfig(status=Switch(status)) + body = UnattendedBootConfigDict(status=status) try: self.get_api().config_unattended_boot_put(body=body) except ApiException as e: @@ -1036,7 +1078,7 @@ def get_system_info(self): firmware_version=response.body["firmwareVersion"], software_version=response.body["softwareVersion"], hardware_version=response.body["hardwareVersion"], - build_tag=response.body["buildTag"], + build_tag=response.body["softwareBuild"], ) except ApiException as e: _handle_api_exception( @@ -1047,8 +1089,8 @@ def get_system_info(self): def backup(self): try: - response = self.request("POST", "system/backup") - return response.content + response = self.get_api().system_backup_post() + return response.response.data except ApiException as e: _handle_api_exception( e, @@ -1138,15 +1180,15 @@ def factory_reset(self): ) def encrypt(self, key_id, data, mode, iv): - from .client.model.base64 import Base64 - from .client.model.encrypt_mode import EncryptMode - from .client.model.encrypt_request_data import EncryptRequestData - from .client.paths.keys_key_id_encrypt.post import RequestPathParams - - path_params = RequestPathParams({"KeyID": key_id}) - body = EncryptRequestData( - message=Base64(data), mode=EncryptMode(mode), iv=Base64(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 @@ -1164,18 +1206,19 @@ def encrypt(self, key_id, data, mode, iv): ) def decrypt(self, key_id, data, mode, iv): - from .client.model.base64 import Base64 - from .client.model.decrypt_mode import DecryptMode - from .client.model.decrypt_request_data import DecryptRequestData - from .client.paths.keys_key_id_decrypt.post import RequestPathParams + from .client.components.schema.decrypt_request_data import ( + DecryptRequestDataDict, + ) + from .client.paths.keys_key_id_decrypt.post.path_parameters import ( + PathParametersDict, + ) - path_params = RequestPathParams({"KeyID": key_id}) + body = DecryptRequestDataDict(encrypted=data, mode=mode, iv=iv) - body = DecryptRequestData( - encrypted=Base64(data), mode=DecryptMode(mode), iv=Base64(iv) - ) if len(iv) == 0: - body = DecryptRequestData(encrypted=Base64(data), mode=DecryptMode(mode)) + 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 @@ -1193,13 +1236,13 @@ def decrypt(self, key_id, data, mode, iv): ) def sign(self, key_id, data, mode): - from .client.model.base64 import Base64 - from .client.model.sign_mode import SignMode - from .client.model.sign_request_data import SignRequestData - from .client.paths.keys_key_id_sign.post import RequestPathParams + from .client.components.schema.sign_request_data import SignRequestDataDict + from .client.paths.keys_key_id_sign.post.path_parameters import ( + PathParametersDict, + ) - path_params = RequestPathParams({"KeyID": key_id}) - body = SignRequestData(message=Base64(data), mode=SignMode(mode)) + 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 diff --git a/pynitrokey/nethsm/client/__init__.py b/pynitrokey/nethsm/client/__init__.py index c83da1ed..4d7946be 100644 --- a/pynitrokey/nethsm/client/__init__.py +++ b/pynitrokey/nethsm/client/__init__.py @@ -4,11 +4,9 @@ """ 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 encoded values are Big Endian. # noqa: E501 - + 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://openapi-generator.tech + Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator """ __version__ = "1.0.0" @@ -17,7 +15,7 @@ from pynitrokey.nethsm.client.api_client import ApiClient # import Configuration -from pynitrokey.nethsm.client.configuration import Configuration +from pynitrokey.nethsm.client.configurations.api_configuration import ApiConfiguration # import exceptions from pynitrokey.nethsm.client.exceptions import OpenApiException diff --git a/pynitrokey/nethsm/client/api_client.py b/pynitrokey/nethsm/client/api_client.py index 31db328a..5cec9937 100644 --- a/pynitrokey/nethsm/client/api_client.py +++ b/pynitrokey/nethsm/client/api_client.py @@ -1,80 +1,56 @@ # 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 encoded values are Big Endian. # noqa: E501 - + 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://openapi-generator.tech + Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator """ -from dataclasses import dataclass -from decimal import Decimal +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.pool import ThreadPool +from multiprocessing import pool import re import tempfile import typing import typing_extensions +from urllib import parse import urllib3 -from urllib3._collections import HTTPHeaderDict -from urllib.parse import urlparse, quote -from urllib3.fields import RequestField as RequestFieldBase - -import frozendict - -from pynitrokey.nethsm.client import rest -from pynitrokey.nethsm.client.configuration import Configuration -from pynitrokey.nethsm.client.exceptions import ApiTypeError, ApiValueError -from pynitrokey.nethsm.client.schemas import ( - NoneClass, - BoolClass, - Schema, - FileIO, - BinarySchema, - date, - datetime, - none_type, - Unset, - unset, -) - - -class RequestField(RequestFieldBase): - def __eq__(self, other): - if not isinstance(other, RequestField): - return False - return self.__dict__ == other.__dict__ +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): + def default(self, obj: typing.Any): if isinstance(obj, str): return str(obj) elif isinstance(obj, float): - return float(obj) + return obj + elif isinstance(obj, bool): + # must be before int check + return obj elif isinstance(obj, int): - return int(obj) - elif isinstance(obj, Decimal): - if obj.as_tuple().exponent >= 0: - return int(obj) - return float(obj) - elif isinstance(obj, NoneClass): + return obj + elif obj is None: return None - elif isinstance(obj, BoolClass): - return bool(obj) - elif isinstance(obj, (dict, frozendict.frozendict)): + 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 ApiValueError('Unable to prepare type {} for serialization'.format(obj.__class__.__name__)) + raise exceptions.ApiValueError('Unable to prepare type {} for serialization'.format(obj.__class__.__name__)) class ParameterInType(enum.Enum): @@ -94,18 +70,16 @@ class ParameterStyle(enum.Enum): 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 __init__(self, prefix: str, separator: str): - self.prefix = prefix - self.separator = separator - self.first = True - if separator in {'.', '|', '%20'}: - item_separator = separator - else: - item_separator = ',' - self.item_separator = item_separator + def __post_init__(self): + self.item_separator = self.separator if self.separator in {'.', '|', '%20'} else ',' def __iter__(self): return self @@ -118,10 +92,6 @@ def __next__(self): class ParameterSerializerBase: - @classmethod - def _get_default_explode(cls, style: ParameterStyle) -> bool: - return False - @staticmethod def __ref6570_item_value(in_data: typing.Any, percent_encode: bool): """ @@ -135,9 +105,9 @@ def __ref6570_item_value(in_data: typing.Any, percent_encode: bool): """ if type(in_data) in {str, float, int}: if percent_encode: - return quote(str(in_data)) + return parse.quote(str(in_data)) return str(in_data) - elif isinstance(in_data, none_type): + 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: @@ -146,7 +116,7 @@ def __ref6570_item_value(in_data: typing.Any, percent_encode: bool): 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 ApiValueError('Unable to generate a ref6570 item representation of {}'.format(in_data)) + raise exceptions.ApiValueError('Unable to generate a ref6570 item representation of {}'.format(in_data)) @staticmethod def _to_dict(name: str, value: str): @@ -254,7 +224,7 @@ def _ref6570_expansion( var_name_piece, named_parameter_expansion ) - elif isinstance(in_data, none_type): + 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): @@ -278,18 +248,13 @@ def _ref6570_expansion( named_parameter_expansion ) # bool, bytes, etc - raise ApiValueError('Unable to generate a ref6570 representation of {}'.format(in_data)) + raise exceptions.ApiValueError('Unable to generate a ref6570 representation of {}'.format(in_data)) class StyleFormSerializer(ParameterSerializerBase): @classmethod - def _get_default_explode(cls, style: ParameterStyle) -> bool: - if style is ParameterStyle.FORM: - return True - return super()._get_default_explode(style) - def _serialize_form( - self, + cls, in_data: typing.Union[None, int, float, str, bool, dict, list], name: str, explode: bool, @@ -298,7 +263,7 @@ def _serialize_form( ) -> str: if prefix_separator_iterator is None: prefix_separator_iterator = PrefixSeparatorIterator('', '&') - return self._ref6570_expansion( + return cls._ref6570_expansion( variable_name=name, in_data=in_data, explode=explode, @@ -309,15 +274,16 @@ def _serialize_form( class StyleSimpleSerializer(ParameterSerializerBase): + @classmethod def _serialize_simple( - self, + 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 self._ref6570_expansion( + return cls._ref6570_expansion( variable_name=name, in_data=in_data, explode=explode, @@ -325,6 +291,19 @@ def _serialize_simple( 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: """ @@ -343,159 +322,142 @@ def _content_type_is_json(cls, content_type: str) -> bool: return False -@dataclass +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): - name: str in_type: ParameterInType required: bool style: typing.Optional[ParameterStyle] explode: typing.Optional[bool] allow_reserved: typing.Optional[bool] - schema: typing.Optional[typing.Type[Schema]] - content: typing.Optional[typing.Dict[str, typing.Type[Schema]]] - - __style_to_in_type = { - ParameterStyle.MATRIX: {ParameterInType.PATH}, - ParameterStyle.LABEL: {ParameterInType.PATH}, - ParameterStyle.FORM: {ParameterInType.QUERY, ParameterInType.COOKIE}, - ParameterStyle.SIMPLE: {ParameterInType.PATH, ParameterInType.HEADER}, - ParameterStyle.SPACE_DELIMITED: {ParameterInType.QUERY}, - ParameterStyle.PIPE_DELIMITED: {ParameterInType.QUERY}, - ParameterStyle.DEEP_OBJECT: {ParameterInType.QUERY}, - } - __in_type_to_default_style = { - ParameterInType.QUERY: ParameterStyle.FORM, - ParameterInType.PATH: ParameterStyle.SIMPLE, - ParameterInType.HEADER: ParameterStyle.SIMPLE, - ParameterInType.COOKIE: ParameterStyle.FORM, - } - __disallowed_header_names = {'Accept', 'Content-Type', 'Authorization'} - _json_encoder = JSONEncoder() + schema: typing.Optional[typing.Type[schemas.Schema]] + content: typing.Optional[typing.Dict[str, typing.Type[MediaType]]] - @classmethod - def __verify_style_to_in_type(cls, style: typing.Optional[ParameterStyle], in_type: ParameterInType): - if style is None: - return - in_type_set = cls.__style_to_in_type[style] - if in_type not in in_type_set: - raise ValueError( - 'Invalid style and in_type combination. For style={} only in_type={} are allowed'.format( - style, in_type_set - ) - ) + _json_encoder = JSONEncoder() - def __init__( - self, - name: str, - in_type: ParameterInType, - required: bool = False, - style: typing.Optional[ParameterStyle] = None, - explode: bool = False, - allow_reserved: typing.Optional[bool] = None, - schema: typing.Optional[typing.Type[Schema]] = None, - content: typing.Optional[typing.Dict[str, typing.Type[Schema]]] = None - ): - if schema is None and content is None: - raise ValueError('Value missing; Pass in either schema or content') - if schema and content: - raise ValueError('Too many values provided. Both schema and content were provided. Only one may be input') - if name in self.__disallowed_header_names and in_type is ParameterInType.HEADER: - raise ValueError('Invalid name, name may not be one of {}'.format(self.__disallowed_header_names)) - self.__verify_style_to_in_type(style, in_type) - if content is None and style is None: - style = self.__in_type_to_default_style[in_type] - if content is not None and in_type in self.__in_type_to_default_style and len(content) != 1: - raise ValueError('Invalid content length, content length must equal 1') - self.in_type = in_type - self.name = name - self.required = required - self.style = style - self.explode = explode - self.allow_reserved = allow_reserved - self.schema = schema - self.content = content + 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( - self, + 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=self._json_encoder.compact_separators) + 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 - def __init__( - self, - name: str, - required: bool = False, - style: typing.Optional[ParameterStyle] = None, - explode: bool = False, - allow_reserved: typing.Optional[bool] = None, - schema: typing.Optional[typing.Type[Schema]] = None, - content: typing.Optional[typing.Dict[str, typing.Type[Schema]]] = None - ): - super().__init__( - name, - in_type=ParameterInType.PATH, - required=required, - style=style, - explode=explode, - allow_reserved=allow_reserved, - schema=schema, - content=content - ) - + @classmethod def __serialize_label( - self, + cls, in_data: typing.Union[None, int, float, str, bool, dict, list] ) -> typing.Dict[str, str]: prefix_separator_iterator = PrefixSeparatorIterator('.', '.') - value = self._ref6570_expansion( - variable_name=self.name, + value = cls._ref6570_expansion( + variable_name=cls.name, in_data=in_data, - explode=self.explode, + explode=cls.explode, percent_encode=True, prefix_separator_iterator=prefix_separator_iterator ) - return self._to_dict(self.name, value) + return cls._to_dict(cls.name, value) + @classmethod def __serialize_matrix( - self, + cls, in_data: typing.Union[None, int, float, str, bool, dict, list] ) -> typing.Dict[str, str]: prefix_separator_iterator = PrefixSeparatorIterator(';', ';') - value = self._ref6570_expansion( - variable_name=self.name, + value = cls._ref6570_expansion( + variable_name=cls.name, in_data=in_data, - explode=self.explode, + explode=cls.explode, percent_encode=True, prefix_separator_iterator=prefix_separator_iterator ) - return self._to_dict(self.name, value) + return cls._to_dict(cls.name, value) + @classmethod def __serialize_simple( - self, + cls, in_data: typing.Union[None, int, float, str, bool, dict, list], ) -> typing.Dict[str, str]: - value = self._serialize_simple( + value = cls._serialize_simple( in_data=in_data, - name=self.name, - explode=self.explode, + name=cls.name, + explode=cls.explode, percent_encode=True ) - return self._to_dict(self.name, value) + return cls._to_dict(cls.name, value) + @classmethod def serialize( - self, - in_data: typing.Union[ - Schema, Decimal, int, float, str, date, datetime, None, bool, list, tuple, dict, frozendict.frozendict] + cls, + in_data: _SERIALIZE_TYPES, + skip_validation: bool = False ) -> typing.Dict[str, str]: - if self.schema: - cast_in_data = self.schema(in_data) - cast_in_data = self._json_encoder.default(cast_in_data) + 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: @@ -505,114 +467,111 @@ def serialize( matrix -> path returns path_params """ - if self.style: - if self.style is ParameterStyle.SIMPLE: - return self.__serialize_simple(cast_in_data) - elif self.style is ParameterStyle.LABEL: - return self.__serialize_label(cast_in_data) - elif self.style is ParameterStyle.MATRIX: - return self.__serialize_matrix(cast_in_data) - # self.content will be length one - for content_type, schema in self.content.items(): - cast_in_data = schema(in_data) - cast_in_data = self._json_encoder.default(cast_in_data) - if self._content_type_is_json(content_type): - value = self._serialize_json(cast_in_data) - return self._to_dict(self.name, value) - raise NotImplementedError('Serialization of {} has not yet been implemented'.format(content_type)) + 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 - def __init__( - self, - name: str, - required: bool = False, - style: typing.Optional[ParameterStyle] = None, - explode: typing.Optional[bool] = None, - allow_reserved: typing.Optional[bool] = None, - schema: typing.Optional[typing.Type[Schema]] = None, - content: typing.Optional[typing.Dict[str, typing.Type[Schema]]] = None - ): - used_style = ParameterStyle.FORM if style is None else style - used_explode = self._get_default_explode(used_style) if explode is None else explode - - super().__init__( - name, - in_type=ParameterInType.QUERY, - required=required, - style=used_style, - explode=used_explode, - allow_reserved=allow_reserved, - schema=schema, - content=content - ) - + @classmethod def __serialize_space_delimited( - self, + cls, in_data: typing.Union[None, int, float, str, bool, dict, list], - prefix_separator_iterator: typing.Optional[PrefixSeparatorIterator] + prefix_separator_iterator: typing.Optional[PrefixSeparatorIterator], + explode: bool ) -> typing.Dict[str, str]: if prefix_separator_iterator is None: - prefix_separator_iterator = self.get_prefix_separator_iterator() - value = self._ref6570_expansion( - variable_name=self.name, + prefix_separator_iterator = cls.get_prefix_separator_iterator() + value = cls._ref6570_expansion( + variable_name=cls.name, in_data=in_data, - explode=self.explode, + explode=explode, percent_encode=True, prefix_separator_iterator=prefix_separator_iterator ) - return self._to_dict(self.name, value) + return cls._to_dict(cls.name, value) + @classmethod def __serialize_pipe_delimited( - self, + cls, in_data: typing.Union[None, int, float, str, bool, dict, list], - prefix_separator_iterator: typing.Optional[PrefixSeparatorIterator] + prefix_separator_iterator: typing.Optional[PrefixSeparatorIterator], + explode: bool ) -> typing.Dict[str, str]: if prefix_separator_iterator is None: - prefix_separator_iterator = self.get_prefix_separator_iterator() - value = self._ref6570_expansion( - variable_name=self.name, + prefix_separator_iterator = cls.get_prefix_separator_iterator() + value = cls._ref6570_expansion( + variable_name=cls.name, in_data=in_data, - explode=self.explode, + explode=explode, percent_encode=True, prefix_separator_iterator=prefix_separator_iterator ) - return self._to_dict(self.name, value) + return cls._to_dict(cls.name, value) + @classmethod def __serialize_form( - self, + cls, in_data: typing.Union[None, int, float, str, bool, dict, list], - prefix_separator_iterator: typing.Optional[PrefixSeparatorIterator] + prefix_separator_iterator: typing.Optional[PrefixSeparatorIterator], + explode: bool ) -> typing.Dict[str, str]: if prefix_separator_iterator is None: - prefix_separator_iterator = self.get_prefix_separator_iterator() - value = self._serialize_form( + prefix_separator_iterator = cls.get_prefix_separator_iterator() + value = cls._serialize_form( in_data, - name=self.name, - explode=self.explode, + name=cls.name, + explode=explode, percent_encode=True, prefix_separator_iterator=prefix_separator_iterator ) - return self._to_dict(self.name, value) + return cls._to_dict(cls.name, value) - def get_prefix_separator_iterator(self) -> typing.Optional[PrefixSeparatorIterator]: - if self.style is ParameterStyle.FORM: + @classmethod + def get_prefix_separator_iterator(cls) -> PrefixSeparatorIterator: + if cls.style is ParameterStyle.FORM: return PrefixSeparatorIterator('?', '&') - elif self.style is ParameterStyle.SPACE_DELIMITED: + elif cls.style is ParameterStyle.SPACE_DELIMITED: return PrefixSeparatorIterator('', '%20') - elif self.style is ParameterStyle.PIPE_DELIMITED: + elif cls.style is ParameterStyle.PIPE_DELIMITED: return PrefixSeparatorIterator('', '|') + raise ValueError(f'No iterator possible for style={cls.style}') + @classmethod def serialize( - self, - in_data: typing.Union[ - Schema, Decimal, int, float, str, date, datetime, None, bool, list, tuple, dict, frozendict.frozendict], - prefix_separator_iterator: typing.Optional[PrefixSeparatorIterator] = None + cls, + in_data: _SERIALIZE_TYPES, + prefix_separator_iterator: typing.Optional[PrefixSeparatorIterator] = None, + skip_validation: bool = False ) -> typing.Dict[str, str]: - if self.schema: - cast_in_data = self.schema(in_data) - cast_in_data = self._json_encoder.default(cast_in_data) + 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: @@ -626,218 +585,212 @@ def serialize( deepObject -> query, https://github.com/OAI/OpenAPI-Specification/issues/1706 returns fields """ - if self.style: + if cls.style: # TODO update query ones to omit setting values when [] {} or None is input - if self.style is ParameterStyle.FORM: - return self.__serialize_form(cast_in_data, prefix_separator_iterator) - elif self.style is ParameterStyle.SPACE_DELIMITED: - return self.__serialize_space_delimited(cast_in_data, prefix_separator_iterator) - elif self.style is ParameterStyle.PIPE_DELIMITED: - return self.__serialize_pipe_delimited(cast_in_data, prefix_separator_iterator) - # self.content will be length one + 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 = self.get_prefix_separator_iterator() - for content_type, schema in self.content.items(): - cast_in_data = schema(in_data) - cast_in_data = self._json_encoder.default(cast_in_data) - if self._content_type_is_json(content_type): - value = self._serialize_json(cast_in_data, eliminate_whitespace=True) - return self._to_dict( - self.name, - next(prefix_separator_iterator) + self.name + '=' + quote(value) + 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) ) - raise NotImplementedError('Serialization of {} has not yet been implemented'.format(content_type)) + 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 - def __init__( - self, - name: str, - required: bool = False, - style: typing.Optional[ParameterStyle] = None, - explode: typing.Optional[bool] = None, - allow_reserved: typing.Optional[bool] = None, - schema: typing.Optional[typing.Type[Schema]] = None, - content: typing.Optional[typing.Dict[str, typing.Type[Schema]]] = None - ): - used_style = ParameterStyle.FORM if style is None and content is None and schema else style - used_explode = self._get_default_explode(used_style) if explode is None else explode - - super().__init__( - name, - in_type=ParameterInType.COOKIE, - required=required, - style=used_style, - explode=used_explode, - allow_reserved=allow_reserved, - schema=schema, - content=content - ) - + @classmethod def serialize( - self, - in_data: typing.Union[ - Schema, Decimal, int, float, str, date, datetime, None, bool, list, tuple, dict, frozendict.frozendict] + cls, + in_data: _SERIALIZE_TYPES, + skip_validation: bool = False ) -> typing.Dict[str, str]: - if self.schema: - cast_in_data = self.schema(in_data) - cast_in_data = self._json_encoder.default(cast_in_data) + 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 self.style: + if cls.style: """ TODO add escaping of comma, space, equals or turn encoding on """ - value = self._serialize_form( + explode = cls.explode if cls.explode is not None else cls.style == ParameterStyle.FORM + value = cls._serialize_form( cast_in_data, - explode=self.explode, - name=self.name, + explode=explode, + name=cls.name, percent_encode=False, prefix_separator_iterator=PrefixSeparatorIterator('', '&') ) - return self._to_dict(self.name, value) - # self.content will be length one - for content_type, schema in self.content.items(): - cast_in_data = schema(in_data) - cast_in_data = self._json_encoder.default(cast_in_data) - if self._content_type_is_json(content_type): - value = self._serialize_json(cast_in_data) - return self._to_dict(self.name, value) - raise NotImplementedError('Serialization of {} has not yet been implemented'.format(content_type)) - - -class HeaderParameter(ParameterBase, StyleSimpleSerializer): - def __init__( - self, - name: str, - required: bool = False, - style: typing.Optional[ParameterStyle] = None, - explode: bool = False, - allow_reserved: typing.Optional[bool] = None, - schema: typing.Optional[typing.Type[Schema]] = None, - content: typing.Optional[typing.Dict[str, typing.Type[Schema]]] = None - ): - super().__init__( - name, - in_type=ParameterInType.HEADER, - required=required, - style=style, - explode=explode, - allow_reserved=allow_reserved, - schema=schema, - content=content - ) + 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], ...]) -> HTTPHeaderDict: + def __to_headers(in_data: typing.Tuple[typing.Tuple[str, str], ...]) -> _collections.HTTPHeaderDict: data = tuple(t for t in in_data if t) - headers = HTTPHeaderDict() + headers = _collections.HTTPHeaderDict() if not data: return headers headers.extend(data) return headers - def serialize( - self, - in_data: typing.Union[ - Schema, Decimal, int, float, str, date, datetime, None, bool, list, tuple, dict, frozendict.frozendict] - ) -> HTTPHeaderDict: - if self.schema: - cast_in_data = self.schema(in_data) - cast_in_data = self._json_encoder.default(cast_in_data) + @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 self.style: - value = self._serialize_simple(cast_in_data, self.name, self.explode, False) - return self.__to_headers(((self.name, value),)) - # self.content will be length one - for content_type, schema in self.content.items(): - cast_in_data = schema(in_data) - cast_in_data = self._json_encoder.default(cast_in_data) - if self._content_type_is_json(content_type): - value = self._serialize_json(cast_in_data) - return self.__to_headers(((self.name, value),)) - raise NotImplementedError('Serialization of {} has not yet been implemented'.format(content_type)) - + 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') -class Encoding: - def __init__( - self, - content_type: str, - headers: typing.Optional[typing.Dict[str, HeaderParameter]] = None, - style: typing.Optional[ParameterStyle] = None, - explode: bool = False, - allow_reserved: bool = False, + @classmethod + def deserialize( + cls, + in_data: str, + name: str ): - self.content_type = content_type - self.headers = headers - self.style = style - self.explode = explode - self.allow_reserved = allow_reserved + 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') -@dataclass -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[Schema]] = None - encoding: typing.Optional[typing.Dict[str, Encoding]] = None +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 + ) -@dataclass -class ApiResponse: - response: urllib3.HTTPResponse - body: typing.Union[Unset, Schema] - headers: typing.Union[Unset, typing.List[HeaderParameter]] - def __init__( - self, - response: urllib3.HTTPResponse, - body: typing.Union[Unset, typing.Type[Schema]], - headers: typing.Union[Unset, typing.List[HeaderParameter]] - ): - """ - pycharm needs this to prevent 'Unexpected argument' warnings - """ - self.response = response - self.body = body - self.headers = headers +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 + ) -@dataclass -class ApiResponseWithoutDeserialization(ApiResponse): - response: urllib3.HTTPResponse - body: typing.Union[Unset, typing.Type[Schema]] = unset - headers: typing.Union[Unset, typing.List[HeaderParameter]] = unset +T = typing.TypeVar("T", bound=api_response.ApiResponse) -class OpenApiResponse(JSONDetector): +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 - def __init__( - self, - response_cls: typing.Type[ApiResponse] = ApiResponse, - content: typing.Optional[typing.Dict[str, MediaType]] = None, - headers: typing.Optional[typing.List[HeaderParameter]] = None, - ): - self.headers = headers - if content is not None and len(content) == 0: - raise ValueError('Invalid value for content, the content dict must have >= 1 entry') - self.content = content - self.response_cls = response_cls + @classmethod + @abc.abstractmethod + def get_response(cls, response, headers, body) -> T: ... @staticmethod def __deserialize_json(response: urllib3.HTTPResponse) -> typing.Any: @@ -848,7 +801,7 @@ def __deserialize_json(response: urllib3.HTTPResponse) -> typing.Any: def __file_name_from_response_url(response_url: typing.Optional[str]) -> typing.Optional[str]: if response_url is None: return None - url_path = urlparse(response_url).path + url_path = parse.urlparse(response_url).path if url_path: path_basename = os.path.basename(url_path) if path_basename: @@ -866,8 +819,9 @@ def __file_name_from_content_disposition(cls, content_disposition: typing.Option return None return match.group(1) + @classmethod def __deserialize_application_octet_stream( - self, response: urllib3.HTTPResponse + cls, response: urllib3.HTTPResponse ) -> typing.Union[bytes, io.BufferedReader]: """ urllib3 use cases: @@ -877,8 +831,8 @@ def __deserialize_application_octet_stream( """ if response.supports_chunked_reads(): file_name = ( - self.__file_name_from_content_disposition(response.headers.get('content-disposition')) - or self.__file_name_from_response_url(response.geturl()) + 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: @@ -886,13 +840,13 @@ def __deserialize_application_octet_stream( else: path = os.path.join(tempfile.gettempdir(), file_name) - with open(path, 'wb') as new_file: + with open(path, 'wb') as write_file: chunk_size = 1024 while True: data = response.read(chunk_size) if not data: break - new_file.write(data) + write_file.write(data) # release_conn is needed for streaming connections only response.release_conn() new_file = open(path, 'rb') @@ -914,52 +868,64 @@ def __deserialize_multipart_form_data( for part in msg.get_payload() } - def deserialize(self, response: urllib3.HTTPResponse, configuration: Configuration) -> ApiResponse: - content_type = response.getheader('content-type') - deserialized_body = unset + @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 = unset - if self.headers is not None: - # TODO add header deserialiation here - pass - - if self.content is not None: - if content_type not in self.content: - raise ApiValueError( + 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(self.content))} are defined for status_code={str(response.status)}" + f"when only {str(set(cls.content))} are defined for status_code={str(response.status)}" ) - body_schema = self.content[content_type].schema + body_schema = cls.content[content_type].schema if body_schema is None: # some specs do not define response content media type schemas - return self.response_cls( + return cls.get_response( response=response, headers=deserialized_headers, - body=unset + body=schemas.unset ) - if self._content_type_is_json(content_type): - body_data = self.__deserialize_json(response) + if cls._content_type_is_json(content_type): + body_data = cls.__deserialize_json(response) elif content_type == 'application/octet-stream': - body_data = self.__deserialize_application_octet_stream(response) + body_data = cls.__deserialize_application_octet_stream(response) elif content_type.startswith('multipart/form-data'): - body_data = self.__deserialize_multipart_form_data(response) + 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)) - deserialized_body = body_schema.from_openapi_data_oapg( - body_data, _configuration=configuration) + 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 self.response_cls( + return cls.get_response( response=response, headers=deserialized_headers, body=deserialized_body ) +@dataclasses.dataclass class ApiClient: """Generic API client for OpenAPI client library builds. @@ -968,42 +934,29 @@ class ApiClient: the methods and models for each application are generated from the OpenAPI templates. - NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech + 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: .Configuration object for this client - :param header_name: a header to pass when making calls to the API. - :param header_value: a header value to pass when making calls to - the API. - :param cookie: a cookie to include in the header when making calls - to the API + :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. """ - - _pool = None - - def __init__( - self, - configuration: typing.Optional[Configuration] = None, - header_name: typing.Optional[str] = None, - header_value: typing.Optional[str] = None, - cookie: typing.Optional[str] = None, - pool_threads: int = 1 - ): - if configuration is None: - configuration = Configuration() - self.configuration = configuration - self.pool_threads = pool_threads - - self.rest_client = rest.RESTClientObject(configuration) - self.default_headers = HTTPHeaderDict() - if header_name is not None: - self.default_headers[header_name] = header_value - self.cookie = cookie - # Set default User-Agent. - self.user_agent = 'OpenAPI-Generator/1.0.0/python' + 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 @@ -1026,98 +979,41 @@ def pool(self): """ if self._pool is None: atexit.register(self.close) - self._pool = ThreadPool(self.pool_threads) + self._pool = pool.ThreadPool(self.pool_threads) return self._pool - @property - def user_agent(self): - """User agent for this API client""" - return self.default_headers['User-Agent'] - - @user_agent.setter - def user_agent(self, value): - self.default_headers['User-Agent'] = value - - def set_default_header(self, header_name, header_value): + 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, - headers: typing.Optional[HTTPHeaderDict] = None, - body: typing.Optional[typing.Union[str, bytes]] = None, - fields: typing.Optional[typing.Tuple[typing.Tuple[str, str], ...]] = None, - auth_settings: typing.Optional[typing.List[str]] = None, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - host: typing.Optional[str] = None, - ) -> urllib3.HTTPResponse: - - # header parameters - used_headers = HTTPHeaderDict(self.default_headers) - if self.cookie: - headers['Cookie'] = self.cookie - - # auth setting - self.update_params_for_auth(used_headers, - auth_settings, resource_path, method, body) - - # must happen after cookie setting and auth setting in case user is overriding those - if headers: - used_headers.update(headers) - - # request url - if host is None: - url = self.configuration.host + resource_path - else: - # use server/host defined in path or operation instead - url = host + resource_path - - # perform request and return response - response = self.request( - method, - url, - headers=used_headers, - fields=fields, - body=body, - stream=stream, - timeout=timeout, - ) - return response - def call_api( self, resource_path: str, method: str, - headers: typing.Optional[HTTPHeaderDict] = None, - body: typing.Optional[typing.Union[str, bytes]] = None, - fields: typing.Optional[typing.Tuple[typing.Tuple[str, str], ...]] = None, - auth_settings: typing.Optional[typing.List[str]] = None, - async_req: typing.Optional[bool] = None, + 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.Optional[typing.Union[int, typing.Tuple]] = None, - host: typing.Optional[str] = None, + timeout: typing.Union[int, float, typing.Tuple, None] = None, ) -> urllib3.HTTPResponse: """Makes the HTTP request (synchronous) and returns deserialized data. - To make an async_req request, set the async_req parameter. - :param resource_path: Path to method endpoint. :param method: Method to call. :param 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 auth_settings: Auth Settings names for the request. + 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 - :type async_req: bool, optional TODO remove, unused :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 filesystme file and the BinarySchema - instance will also inherit from FileSchema and FileIO + 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 @@ -1126,293 +1022,309 @@ def call_api( (connection, read) timeouts. :param host: api endpoint host :return: - If async_req parameter is True, - the request will be called asynchronously. - The method will return the request thread. - If parameter async_req is False or missing, - then the method will return the response directly. + 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 - if not async_req: - return self.__call_api( - resource_path, - method, - headers, - body, - fields, - auth_settings, - stream, - timeout, - host, - ) + # auth setting + self.update_params_for_auth( + used_headers, + security_requirement_object, + resource_path, + method, + body, + query_params_suffix + ) - return self.pool.apply_async( - self.__call_api, - ( - resource_path, - method, - headers, - body, - json, - fields, - auth_settings, - stream, - timeout, - host, - ) + # 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[HTTPHeaderDict] = None, - fields: typing.Optional[typing.Tuple[typing.Tuple[str, str], ...]] = None, - body: typing.Optional[typing.Union[str, bytes]] = None, + 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.Optional[typing.Union[int, typing.Tuple]] = None, + 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, + if method == "get": + return self.rest_client.get(url, stream=stream, timeout=timeout, headers=headers) - elif method == "HEAD": - return self.rest_client.HEAD(url, + elif method == "head": + return self.rest_client.head(url, stream=stream, timeout=timeout, headers=headers) - elif method == "OPTIONS": - return self.rest_client.OPTIONS(url, + 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, + 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, + 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, + 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, + elif method == "delete": + return self.rest_client.delete(url, headers=headers, stream=stream, timeout=timeout, body=body) else: - raise ApiValueError( + raise exceptions.ApiValueError( "http method must be `GET`, `HEAD`, `OPTIONS`," " `POST`, `PATCH`, `PUT` or `DELETE`." ) - def update_params_for_auth(self, headers, auth_settings, - resource_path, method, body): + 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 auth_settings: Authentication setting identifiers list. + :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 auth_settings: + if not security_requirement_object: + # optional auth cause, use no auth return - - for auth in auth_settings: - auth_setting = self.configuration.auth_settings().get(auth) - if not auth_setting: - continue - if auth_setting['in'] == 'cookie': - headers.add('Cookie', auth_setting['value']) - elif auth_setting['in'] == 'header': - if auth_setting['type'] != 'http-signature': - headers.add(auth_setting['key'], auth_setting['value']) - elif auth_setting['in'] == 'query': - """ TODO implement auth in query - need to pass in prefix_separator_iterator - and need to output resource_path with query params added - """ - raise ApiValueError("Auth in query not yet implemented") - else: - raise ApiValueError( - 'Authentication token must be in `query` or `header`' + 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 Generator - Ref: https://openapi-generator.tech + """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. """ - - def __init__(self, api_client: typing.Optional[ApiClient] = None): - if api_client is None: - api_client = ApiClient() - self.api_client = api_client + api_client: ApiClient = dataclasses.field(default_factory=lambda: ApiClient()) @staticmethod - def _verify_typed_dict_inputs_oapg(cls: typing.Type[typing_extensions.TypedDict], data: typing.Dict[str, typing.Any]): - """ - Ensures that: - - required keys are present - - additional properties are not input - - value stored under required keys do not have the value unset - Note: detailed value checking is done in schema classes - """ - missing_required_keys = [] - required_keys_with_unset_values = [] - for required_key in cls.__required_keys__: - if required_key not in data: - missing_required_keys.append(required_key) - continue - value = data[required_key] - if value is unset: - required_keys_with_unset_values.append(required_key) - if missing_required_keys: - raise ApiTypeError( - '{} missing {} required arguments: {}'.format( - cls.__name__, len(missing_required_keys), missing_required_keys - ) - ) - if required_keys_with_unset_values: - raise ApiValueError( - '{} contains invalid unset values for {} required keys: {}'.format( - cls.__name__, len(required_keys_with_unset_values), required_keys_with_unset_values + 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 - disallowed_additional_keys = [] - for key in data: - if key in cls.__required_keys__ or key in cls.__optional_keys__: - continue - disallowed_additional_keys.append(key) - if disallowed_additional_keys: - raise ApiTypeError( - '{} got {} unexpected keyword arguments: {}'.format( - cls.__name__, len(disallowed_additional_keys), disallowed_additional_keys - ) - ) + @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 - def _get_host_oapg( - self, - operation_id: str, - servers: typing.Tuple[typing.Dict[str, str], ...] = tuple(), - host_index: typing.Optional[int] = None - ) -> typing.Optional[str]: - configuration = self.api_client.configuration - try: - if host_index is None: - index = configuration.server_operation_index.get( - operation_id, configuration.server_index - ) - else: - index = host_index - server_variables = configuration.server_operation_variables.get( - operation_id, configuration.server_variables - ) - host = configuration.get_host_from_settings( - index, variables=server_variables, servers=servers + @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 ) - except IndexError: - if servers: - raise ApiValueError( - "Invalid host index. Must be 0 <= index < %s" % - len(servers) - ) - host = None - return host -class SerializedRequestBody(typing_extensions.TypedDict, total=False): +class SerializedRequestBody(typing.TypedDict, total=False): body: typing.Union[str, bytes] - fields: typing.Tuple[typing.Union[RequestField, typing.Tuple[str, str]], ...] + fields: typing.Tuple[rest.RequestField, ...] class RequestBody(StyleFormSerializer, JSONDetector): """ A request body parameter - content: content_type to MediaType Schema info + content: content_type to MediaType schemas.Schema info """ __json_encoder = JSONEncoder() + content: typing.Dict[str, typing.Type[MediaType]] + required: bool = False - def __init__( - self, - content: typing.Dict[str, MediaType], - required: bool = False, - ): - self.required = required - if len(content) == 0: - raise ValueError('Invalid value for content, the content dict must have >= 1 entry') - self.content = content - + @classmethod def __serialize_json( - self, - in_data: typing.Any - ) -> typing.Dict[str, bytes]: - in_data = self.__json_encoder.default(in_data) + 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 dict(body=json_str) + return {'body': json_str} @staticmethod - def __serialize_text_plain(in_data: typing.Any) -> typing.Dict[str, str]: - if isinstance(in_data, frozendict.frozendict): - raise ValueError('Unable to serialize type frozendict.frozendict to text/plain') - elif isinstance(in_data, tuple): - raise ValueError('Unable to serialize type tuple to text/plain') - elif isinstance(in_data, NoneClass): - raise ValueError('Unable to serialize type NoneClass to text/plain') - elif isinstance(in_data, BoolClass): - raise ValueError('Unable to serialize type BoolClass to text/plain') - return dict(body=str(in_data)) - - def __multipart_json_item(self, key: str, value: Schema) -> RequestField: - json_value = self.__json_encoder.default(value) - return RequestField(name=key, data=json.dumps(json_value), headers={'Content-Type': 'application/json'}) - - def __multipart_form_item(self, key: str, value: Schema) -> RequestField: + 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): - return RequestField(name=key, data=str(value), headers={'Content-Type': 'text/plain'}) + request_field = rest.RequestField(name=key, data=str(value)) + request_field.make_multipart(content_type='text/plain') elif isinstance(value, bytes): - return RequestField(name=key, data=value, headers={'Content-Type': 'application/octet-stream'}) - elif isinstance(value, FileIO): - request_field = RequestField( - name=key, - data=value.read(), - filename=os.path.basename(value.name), - headers={'Content-Type': 'application/octet-stream'} - ) + 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() - return request_field else: - return self.__multipart_json_item(key=key, value=value) + request_field = cls.__multipart_json_item(key=key, value=value) + return request_field + @classmethod def __serialize_multipart_form_data( - self, in_data: Schema - ) -> typing.Dict[str, typing.Tuple[RequestField, ...]]: - if not isinstance(in_data, frozendict.frozendict): - raise ValueError(f'Unable to serialize {in_data} to multipart/form-data because it is not a dict of 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 @@ -1430,43 +1342,43 @@ def __serialize_multipart_form_data( for key, value in in_data.items(): if isinstance(value, tuple): if value: - # values use explode = True, so the code makes a RequestField for each item with name=key + # values use explode = True, so the code makes a rest.RequestField for each item with name=key for item in value: - request_field = self.__multipart_form_item(key=key, value=item) + 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 = self.__multipart_json_item(key=key, value=value) + request_field = cls.__multipart_json_item(key=key, value=value) # type: ignore fields.append(request_field) else: - request_field = self.__multipart_form_item(key=key, value=value) + request_field = cls.__multipart_form_item(key=key, value=value) fields.append(request_field) - return dict(fields=tuple(fields)) + return {'fields': tuple(fields)} - def __serialize_application_octet_stream(self, in_data: BinarySchema) -> typing.Dict[str, bytes]: + @staticmethod + def __serialize_application_octet_stream(in_data: typing.Union[schemas.FileIO, bytes]) -> SerializedRequestBody: if isinstance(in_data, bytes): - return dict(body=in_data) - # FileIO type - result = dict(body=in_data.read()) + return {'body': in_data} + # schemas.FileIO type + used_in_data = in_data.read() in_data.close() - return result + return {'body': used_in_data} + @classmethod def __serialize_application_x_www_form_data( - self, in_data: typing.Any + cls, in_data: schemas.immutabledict[str, _JSON_TYPES] ) -> SerializedRequestBody: """ POST submission of form data in body """ - if not isinstance(in_data, frozendict.frozendict): - raise ValueError( - f'Unable to serialize {in_data} to application/x-www-form-urlencoded because it is not a dict of data') - cast_in_data = self.__json_encoder.default(in_data) - value = self._serialize_form(cast_in_data, name='', explode=True, percent_encode=True) - return dict(body=value) + 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( - self, in_data: typing.Any, content_type: str + 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 @@ -1477,23 +1389,31 @@ def serialize( - body for application/json - encode_multipart and fields for multipart/form-data """ - media_type = self.content[content_type] - if isinstance(in_data, media_type.schema): - cast_in_data = in_data - elif isinstance(in_data, (dict, frozendict.frozendict)) and in_data: - cast_in_data = media_type.schema(**in_data) - else: - cast_in_data = media_type.schema(in_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 self._content_type_is_json(content_type): - return self.__serialize_json(cast_in_data) + 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': - return self.__serialize_text_plain(cast_in_data) + 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': - return self.__serialize_multipart_form_data(cast_in_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': - return self.__serialize_application_x_www_form_data(cast_in_data) + 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': - return self.__serialize_application_octet_stream(cast_in_data) + 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 new file mode 100644 index 00000000..08845665 --- /dev/null +++ b/pynitrokey/nethsm/client/api_response.py @@ -0,0 +1,28 @@ +# 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/path_to_api.py b/pynitrokey/nethsm/client/apis/path_to_api.py index 969c3838..32973686 100644 --- a/pynitrokey/nethsm/client/apis/path_to_api.py +++ b/pynitrokey/nethsm/client/apis/path_to_api.py @@ -1,143 +1,143 @@ +import typing import typing_extensions -from pynitrokey.nethsm.client.paths import PathValues -from pynitrokey.nethsm.client.apis.paths.info import Info +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.metrics import Metrics -from pynitrokey.nethsm.client.apis.paths.provision import Provision -from pynitrokey.nethsm.client.apis.paths.unlock import Unlock -from pynitrokey.nethsm.client.apis.paths.lock import Lock -from pynitrokey.nethsm.client.apis.paths.random import Random +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_public_pem import KeysKeyIDPublicPem +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_sign import KeysKeyIDSign -from pynitrokey.nethsm.client.apis.paths.keys_key_id_cert import KeysKeyIDCert +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 -from pynitrokey.nethsm.client.apis.paths.config_unlock_passphrase import ConfigUnlockPassphrase -from pynitrokey.nethsm.client.apis.paths.config_unattended_boot import ConfigUnattendedBoot -from pynitrokey.nethsm.client.apis.paths.config_tls_public_pem import ConfigTlsPublicPem -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_network import ConfigNetwork -from pynitrokey.nethsm.client.apis.paths.config_logging import ConfigLogging -from pynitrokey.nethsm.client.apis.paths.config_backup_passphrase import ConfigBackupPassphrase -from pynitrokey.nethsm.client.apis.paths.config_time import ConfigTime -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_shutdown import SystemShutdown -from pynitrokey.nethsm.client.apis.paths.system_factory_reset import SystemFactoryReset -from pynitrokey.nethsm.client.apis.paths.system_update import SystemUpdate -from pynitrokey.nethsm.client.apis.paths.system_commit_update import SystemCommitUpdate -from pynitrokey.nethsm.client.apis.paths.system_cancel_update import SystemCancelUpdate -from pynitrokey.nethsm.client.apis.paths.system_backup import SystemBackup -from pynitrokey.nethsm.client.apis.paths.system_restore import SystemRestore -PathToApi = typing_extensions.TypedDict( +PathToApi = typing.TypedDict( 'PathToApi', { - PathValues.INFO: Info, - PathValues.HEALTH_ALIVE: HealthAlive, - PathValues.HEALTH_READY: HealthReady, - PathValues.HEALTH_STATE: HealthState, - PathValues.METRICS: Metrics, - PathValues.PROVISION: Provision, - PathValues.UNLOCK: Unlock, - PathValues.LOCK: Lock, - PathValues.RANDOM: Random, - PathValues.KEYS: Keys, - PathValues.KEYS_GENERATE: KeysGenerate, - PathValues.KEYS_KEY_ID: KeysKeyID, - PathValues.KEYS_KEY_ID_PUBLIC_PEM: KeysKeyIDPublicPem, - PathValues.KEYS_KEY_ID_CSR_PEM: KeysKeyIDCsrPem, - PathValues.KEYS_KEY_ID_DECRYPT: KeysKeyIDDecrypt, - PathValues.KEYS_KEY_ID_ENCRYPT: KeysKeyIDEncrypt, - PathValues.KEYS_KEY_ID_SIGN: KeysKeyIDSign, - PathValues.KEYS_KEY_ID_CERT: KeysKeyIDCert, - PathValues.KEYS_KEY_ID_RESTRICTIONS_TAGS_TAG: KeysKeyIDRestrictionsTagsTag, - PathValues.USERS: Users, - PathValues.USERS_USER_ID: UsersUserID, - PathValues.USERS_USER_ID_PASSPHRASE: UsersUserIDPassphrase, - PathValues.USERS_USER_ID_TAGS: UsersUserIDTags, - PathValues.USERS_USER_ID_TAGS_TAG: UsersUserIDTagsTag, - PathValues.CONFIG_UNLOCKPASSPHRASE: ConfigUnlockPassphrase, - PathValues.CONFIG_UNATTENDEDBOOT: ConfigUnattendedBoot, - PathValues.CONFIG_TLS_PUBLIC_PEM: ConfigTlsPublicPem, - PathValues.CONFIG_TLS_CERT_PEM: ConfigTlsCertPem, - PathValues.CONFIG_TLS_CSR_PEM: ConfigTlsCsrPem, - PathValues.CONFIG_TLS_GENERATE: ConfigTlsGenerate, - PathValues.CONFIG_NETWORK: ConfigNetwork, - PathValues.CONFIG_LOGGING: ConfigLogging, - PathValues.CONFIG_BACKUPPASSPHRASE: ConfigBackupPassphrase, - PathValues.CONFIG_TIME: ConfigTime, - PathValues.SYSTEM_INFO: SystemInfo, - PathValues.SYSTEM_REBOOT: SystemReboot, - PathValues.SYSTEM_SHUTDOWN: SystemShutdown, - PathValues.SYSTEM_FACTORYRESET: SystemFactoryReset, - PathValues.SYSTEM_UPDATE: SystemUpdate, - PathValues.SYSTEM_COMMITUPDATE: SystemCommitUpdate, - PathValues.SYSTEM_CANCELUPDATE: SystemCancelUpdate, - PathValues.SYSTEM_BACKUP: SystemBackup, - PathValues.SYSTEM_RESTORE: SystemRestore, + "/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( { - PathValues.INFO: Info, - PathValues.HEALTH_ALIVE: HealthAlive, - PathValues.HEALTH_READY: HealthReady, - PathValues.HEALTH_STATE: HealthState, - PathValues.METRICS: Metrics, - PathValues.PROVISION: Provision, - PathValues.UNLOCK: Unlock, - PathValues.LOCK: Lock, - PathValues.RANDOM: Random, - PathValues.KEYS: Keys, - PathValues.KEYS_GENERATE: KeysGenerate, - PathValues.KEYS_KEY_ID: KeysKeyID, - PathValues.KEYS_KEY_ID_PUBLIC_PEM: KeysKeyIDPublicPem, - PathValues.KEYS_KEY_ID_CSR_PEM: KeysKeyIDCsrPem, - PathValues.KEYS_KEY_ID_DECRYPT: KeysKeyIDDecrypt, - PathValues.KEYS_KEY_ID_ENCRYPT: KeysKeyIDEncrypt, - PathValues.KEYS_KEY_ID_SIGN: KeysKeyIDSign, - PathValues.KEYS_KEY_ID_CERT: KeysKeyIDCert, - PathValues.KEYS_KEY_ID_RESTRICTIONS_TAGS_TAG: KeysKeyIDRestrictionsTagsTag, - PathValues.USERS: Users, - PathValues.USERS_USER_ID: UsersUserID, - PathValues.USERS_USER_ID_PASSPHRASE: UsersUserIDPassphrase, - PathValues.USERS_USER_ID_TAGS: UsersUserIDTags, - PathValues.USERS_USER_ID_TAGS_TAG: UsersUserIDTagsTag, - PathValues.CONFIG_UNLOCKPASSPHRASE: ConfigUnlockPassphrase, - PathValues.CONFIG_UNATTENDEDBOOT: ConfigUnattendedBoot, - PathValues.CONFIG_TLS_PUBLIC_PEM: ConfigTlsPublicPem, - PathValues.CONFIG_TLS_CERT_PEM: ConfigTlsCertPem, - PathValues.CONFIG_TLS_CSR_PEM: ConfigTlsCsrPem, - PathValues.CONFIG_TLS_GENERATE: ConfigTlsGenerate, - PathValues.CONFIG_NETWORK: ConfigNetwork, - PathValues.CONFIG_LOGGING: ConfigLogging, - PathValues.CONFIG_BACKUPPASSPHRASE: ConfigBackupPassphrase, - PathValues.CONFIG_TIME: ConfigTime, - PathValues.SYSTEM_INFO: SystemInfo, - PathValues.SYSTEM_REBOOT: SystemReboot, - PathValues.SYSTEM_SHUTDOWN: SystemShutdown, - PathValues.SYSTEM_FACTORYRESET: SystemFactoryReset, - PathValues.SYSTEM_UPDATE: SystemUpdate, - PathValues.SYSTEM_COMMITUPDATE: SystemCommitUpdate, - PathValues.SYSTEM_CANCELUPDATE: SystemCancelUpdate, - PathValues.SYSTEM_BACKUP: SystemBackup, - PathValues.SYSTEM_RESTORE: SystemRestore, + "/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 index ef33a530..d320af26 100644 --- a/pynitrokey/nethsm/client/apis/paths/__init__.py +++ b/pynitrokey/nethsm/client/apis/paths/__init__.py @@ -1,3 +1,3 @@ # 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 +# 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 index 33fd1a83..c5b78229 100644 --- a/pynitrokey/nethsm/client/apis/paths/config_backup_passphrase.py +++ b/pynitrokey/nethsm/client/apis/paths/config_backup_passphrase.py @@ -1,7 +1,13 @@ -from pynitrokey.nethsm.client.paths.config_backup_passphrase.put import ApiForput +# 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, + ApiForPut, ): pass diff --git a/pynitrokey/nethsm/client/apis/paths/config_logging.py b/pynitrokey/nethsm/client/apis/paths/config_logging.py index e419a491..380d8ed7 100644 --- a/pynitrokey/nethsm/client/apis/paths/config_logging.py +++ b/pynitrokey/nethsm/client/apis/paths/config_logging.py @@ -1,9 +1,15 @@ -from pynitrokey.nethsm.client.paths.config_logging.get import ApiForget -from pynitrokey.nethsm.client.paths.config_logging.put import ApiForput +# 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, + ApiForGet, + ApiForPut, ): pass diff --git a/pynitrokey/nethsm/client/apis/paths/config_network.py b/pynitrokey/nethsm/client/apis/paths/config_network.py index 1ffc449a..d5010bbb 100644 --- a/pynitrokey/nethsm/client/apis/paths/config_network.py +++ b/pynitrokey/nethsm/client/apis/paths/config_network.py @@ -1,9 +1,15 @@ -from pynitrokey.nethsm.client.paths.config_network.get import ApiForget -from pynitrokey.nethsm.client.paths.config_network.put import ApiForput +# 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, + ApiForGet, + ApiForPut, ): pass diff --git a/pynitrokey/nethsm/client/apis/paths/config_time.py b/pynitrokey/nethsm/client/apis/paths/config_time.py index 9290b750..723c693e 100644 --- a/pynitrokey/nethsm/client/apis/paths/config_time.py +++ b/pynitrokey/nethsm/client/apis/paths/config_time.py @@ -1,9 +1,15 @@ -from pynitrokey.nethsm.client.paths.config_time.get import ApiForget -from pynitrokey.nethsm.client.paths.config_time.put import ApiForput +# 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, + 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 index 179f0435..05ab4ec1 100644 --- a/pynitrokey/nethsm/client/apis/paths/config_tls_cert_pem.py +++ b/pynitrokey/nethsm/client/apis/paths/config_tls_cert_pem.py @@ -1,9 +1,15 @@ -from pynitrokey.nethsm.client.paths.config_tls_cert_pem.get import ApiForget -from pynitrokey.nethsm.client.paths.config_tls_cert_pem.put import ApiForput +# 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, + 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 index b991b8cb..0b05ffc5 100644 --- a/pynitrokey/nethsm/client/apis/paths/config_tls_csr_pem.py +++ b/pynitrokey/nethsm/client/apis/paths/config_tls_csr_pem.py @@ -1,7 +1,13 @@ -from pynitrokey.nethsm.client.paths.config_tls_csr_pem.post import ApiForpost +# 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, + ApiForPost, ): pass diff --git a/pynitrokey/nethsm/client/apis/paths/config_tls_generate.py b/pynitrokey/nethsm/client/apis/paths/config_tls_generate.py index 1a45a2bf..01f7c23c 100644 --- a/pynitrokey/nethsm/client/apis/paths/config_tls_generate.py +++ b/pynitrokey/nethsm/client/apis/paths/config_tls_generate.py @@ -1,7 +1,13 @@ -from pynitrokey.nethsm.client.paths.config_tls_generate.post import ApiForpost +# 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, + 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 index c0613d83..6ac66b00 100644 --- a/pynitrokey/nethsm/client/apis/paths/config_tls_public_pem.py +++ b/pynitrokey/nethsm/client/apis/paths/config_tls_public_pem.py @@ -1,7 +1,13 @@ -from pynitrokey.nethsm.client.paths.config_tls_public_pem.get import ApiForget +# 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, + ApiForGet, ): pass diff --git a/pynitrokey/nethsm/client/apis/paths/config_unattended_boot.py b/pynitrokey/nethsm/client/apis/paths/config_unattended_boot.py index 57426540..c564b353 100644 --- a/pynitrokey/nethsm/client/apis/paths/config_unattended_boot.py +++ b/pynitrokey/nethsm/client/apis/paths/config_unattended_boot.py @@ -1,9 +1,15 @@ -from pynitrokey.nethsm.client.paths.config_unattended_boot.get import ApiForget -from pynitrokey.nethsm.client.paths.config_unattended_boot.put import ApiForput +# 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, + 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 index a56a5f32..39a58689 100644 --- a/pynitrokey/nethsm/client/apis/paths/config_unlock_passphrase.py +++ b/pynitrokey/nethsm/client/apis/paths/config_unlock_passphrase.py @@ -1,7 +1,13 @@ -from pynitrokey.nethsm.client.paths.config_unlock_passphrase.put import ApiForput +# 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, + ApiForPut, ): pass diff --git a/pynitrokey/nethsm/client/apis/paths/health_alive.py b/pynitrokey/nethsm/client/apis/paths/health_alive.py index 01585c71..2f7b9c52 100644 --- a/pynitrokey/nethsm/client/apis/paths/health_alive.py +++ b/pynitrokey/nethsm/client/apis/paths/health_alive.py @@ -1,7 +1,13 @@ -from pynitrokey.nethsm.client.paths.health_alive.get import ApiForget +# 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, + ApiForGet, ): pass diff --git a/pynitrokey/nethsm/client/apis/paths/health_ready.py b/pynitrokey/nethsm/client/apis/paths/health_ready.py index dc1de8a5..f657e970 100644 --- a/pynitrokey/nethsm/client/apis/paths/health_ready.py +++ b/pynitrokey/nethsm/client/apis/paths/health_ready.py @@ -1,7 +1,13 @@ -from pynitrokey.nethsm.client.paths.health_ready.get import ApiForget +# 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, + ApiForGet, ): pass diff --git a/pynitrokey/nethsm/client/apis/paths/health_state.py b/pynitrokey/nethsm/client/apis/paths/health_state.py index c209a414..1aaef88a 100644 --- a/pynitrokey/nethsm/client/apis/paths/health_state.py +++ b/pynitrokey/nethsm/client/apis/paths/health_state.py @@ -1,7 +1,13 @@ -from pynitrokey.nethsm.client.paths.health_state.get import ApiForget +# 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, + ApiForGet, ): pass diff --git a/pynitrokey/nethsm/client/apis/paths/info.py b/pynitrokey/nethsm/client/apis/paths/info.py index 23f77ebb..1e08c694 100644 --- a/pynitrokey/nethsm/client/apis/paths/info.py +++ b/pynitrokey/nethsm/client/apis/paths/info.py @@ -1,7 +1,13 @@ -from pynitrokey.nethsm.client.paths.info.get import ApiForget +# 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, + ApiForGet, ): pass diff --git a/pynitrokey/nethsm/client/apis/paths/keys.py b/pynitrokey/nethsm/client/apis/paths/keys.py index 1c88c5bc..4dfc8474 100644 --- a/pynitrokey/nethsm/client/apis/paths/keys.py +++ b/pynitrokey/nethsm/client/apis/paths/keys.py @@ -1,9 +1,15 @@ -from pynitrokey.nethsm.client.paths.keys.get import ApiForget -from pynitrokey.nethsm.client.paths.keys.post import ApiForpost +# 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, + ApiForGet, + ApiForPost, ): pass diff --git a/pynitrokey/nethsm/client/apis/paths/keys_generate.py b/pynitrokey/nethsm/client/apis/paths/keys_generate.py index 19f18737..ed75583b 100644 --- a/pynitrokey/nethsm/client/apis/paths/keys_generate.py +++ b/pynitrokey/nethsm/client/apis/paths/keys_generate.py @@ -1,7 +1,13 @@ -from pynitrokey.nethsm.client.paths.keys_generate.post import ApiForpost +# 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, + ApiForPost, ): pass diff --git a/pynitrokey/nethsm/client/apis/paths/keys_key_id.py b/pynitrokey/nethsm/client/apis/paths/keys_key_id.py index 3723981f..d6618efb 100644 --- a/pynitrokey/nethsm/client/apis/paths/keys_key_id.py +++ b/pynitrokey/nethsm/client/apis/paths/keys_key_id.py @@ -1,11 +1,17 @@ -from pynitrokey.nethsm.client.paths.keys_key_id.get import ApiForget -from pynitrokey.nethsm.client.paths.keys_key_id.put import ApiForput -from pynitrokey.nethsm.client.paths.keys_key_id.delete import ApiFordelete +# 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( - ApiForget, - ApiForput, - ApiFordelete, + 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 index 963e4de4..605da2a9 100644 --- a/pynitrokey/nethsm/client/apis/paths/keys_key_id_cert.py +++ b/pynitrokey/nethsm/client/apis/paths/keys_key_id_cert.py @@ -1,11 +1,17 @@ -from pynitrokey.nethsm.client.paths.keys_key_id_cert.get import ApiForget -from pynitrokey.nethsm.client.paths.keys_key_id_cert.put import ApiForput -from pynitrokey.nethsm.client.paths.keys_key_id_cert.delete import ApiFordelete +# 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( - ApiForget, - ApiForput, - ApiFordelete, + 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 index 9aa750fc..0f0d5dfb 100644 --- a/pynitrokey/nethsm/client/apis/paths/keys_key_id_csr_pem.py +++ b/pynitrokey/nethsm/client/apis/paths/keys_key_id_csr_pem.py @@ -1,7 +1,13 @@ -from pynitrokey.nethsm.client.paths.keys_key_id_csr_pem.post import ApiForpost +# 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, + 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 index d8d103e9..45ec1cfa 100644 --- a/pynitrokey/nethsm/client/apis/paths/keys_key_id_decrypt.py +++ b/pynitrokey/nethsm/client/apis/paths/keys_key_id_decrypt.py @@ -1,7 +1,13 @@ -from pynitrokey.nethsm.client.paths.keys_key_id_decrypt.post import ApiForpost +# 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, + 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 index ab9ae487..c0cef419 100644 --- a/pynitrokey/nethsm/client/apis/paths/keys_key_id_encrypt.py +++ b/pynitrokey/nethsm/client/apis/paths/keys_key_id_encrypt.py @@ -1,7 +1,13 @@ -from pynitrokey.nethsm.client.paths.keys_key_id_encrypt.post import ApiForpost +# 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, + 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 index 308726e4..cd9488ee 100644 --- a/pynitrokey/nethsm/client/apis/paths/keys_key_id_public_pem.py +++ b/pynitrokey/nethsm/client/apis/paths/keys_key_id_public_pem.py @@ -1,7 +1,13 @@ -from pynitrokey.nethsm.client.paths.keys_key_id_public_pem.get import ApiForget +# 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, + 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 index 74c89c20..c29c440f 100644 --- 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 @@ -1,9 +1,15 @@ -from pynitrokey.nethsm.client.paths.keys_key_id_restrictions_tags_tag.put import ApiForput -from pynitrokey.nethsm.client.paths.keys_key_id_restrictions_tags_tag.delete import ApiFordelete +# 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( - ApiForput, - ApiFordelete, + 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 index 72be9ee3..e4b8cef9 100644 --- a/pynitrokey/nethsm/client/apis/paths/keys_key_id_sign.py +++ b/pynitrokey/nethsm/client/apis/paths/keys_key_id_sign.py @@ -1,7 +1,13 @@ -from pynitrokey.nethsm.client.paths.keys_key_id_sign.post import ApiForpost +# 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, + ApiForPost, ): pass diff --git a/pynitrokey/nethsm/client/apis/paths/lock.py b/pynitrokey/nethsm/client/apis/paths/lock.py index 22f5c219..a6d542f3 100644 --- a/pynitrokey/nethsm/client/apis/paths/lock.py +++ b/pynitrokey/nethsm/client/apis/paths/lock.py @@ -1,7 +1,13 @@ -from pynitrokey.nethsm.client.paths.lock.post import ApiForpost +# 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, + ApiForPost, ): pass diff --git a/pynitrokey/nethsm/client/apis/paths/metrics.py b/pynitrokey/nethsm/client/apis/paths/metrics.py index 31a1ce7d..7897c423 100644 --- a/pynitrokey/nethsm/client/apis/paths/metrics.py +++ b/pynitrokey/nethsm/client/apis/paths/metrics.py @@ -1,7 +1,13 @@ -from pynitrokey.nethsm.client.paths.metrics.get import ApiForget +# 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, + ApiForGet, ): pass diff --git a/pynitrokey/nethsm/client/apis/paths/provision.py b/pynitrokey/nethsm/client/apis/paths/provision.py index 59030832..1ea09b29 100644 --- a/pynitrokey/nethsm/client/apis/paths/provision.py +++ b/pynitrokey/nethsm/client/apis/paths/provision.py @@ -1,7 +1,13 @@ -from pynitrokey.nethsm.client.paths.provision.post import ApiForpost +# 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, + ApiForPost, ): pass diff --git a/pynitrokey/nethsm/client/apis/paths/random.py b/pynitrokey/nethsm/client/apis/paths/random.py index a4b042d9..68ef2e24 100644 --- a/pynitrokey/nethsm/client/apis/paths/random.py +++ b/pynitrokey/nethsm/client/apis/paths/random.py @@ -1,7 +1,13 @@ -from pynitrokey.nethsm.client.paths.random.post import ApiForpost +# 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, + ApiForPost, ): pass diff --git a/pynitrokey/nethsm/client/apis/paths/system_backup.py b/pynitrokey/nethsm/client/apis/paths/system_backup.py index eb7ce210..007f170d 100644 --- a/pynitrokey/nethsm/client/apis/paths/system_backup.py +++ b/pynitrokey/nethsm/client/apis/paths/system_backup.py @@ -1,7 +1,13 @@ -from pynitrokey.nethsm.client.paths.system_backup.post import ApiForpost +# 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, + ApiForPost, ): pass diff --git a/pynitrokey/nethsm/client/apis/paths/system_cancel_update.py b/pynitrokey/nethsm/client/apis/paths/system_cancel_update.py index 06cb5afc..aeec7aaa 100644 --- a/pynitrokey/nethsm/client/apis/paths/system_cancel_update.py +++ b/pynitrokey/nethsm/client/apis/paths/system_cancel_update.py @@ -1,7 +1,13 @@ -from pynitrokey.nethsm.client.paths.system_cancel_update.post import ApiForpost +# 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, + ApiForPost, ): pass diff --git a/pynitrokey/nethsm/client/apis/paths/system_commit_update.py b/pynitrokey/nethsm/client/apis/paths/system_commit_update.py index a2896393..e1b8905f 100644 --- a/pynitrokey/nethsm/client/apis/paths/system_commit_update.py +++ b/pynitrokey/nethsm/client/apis/paths/system_commit_update.py @@ -1,7 +1,13 @@ -from pynitrokey.nethsm.client.paths.system_commit_update.post import ApiForpost +# 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, + ApiForPost, ): pass diff --git a/pynitrokey/nethsm/client/apis/paths/system_factory_reset.py b/pynitrokey/nethsm/client/apis/paths/system_factory_reset.py index 21b59404..2fec559c 100644 --- a/pynitrokey/nethsm/client/apis/paths/system_factory_reset.py +++ b/pynitrokey/nethsm/client/apis/paths/system_factory_reset.py @@ -1,7 +1,13 @@ -from pynitrokey.nethsm.client.paths.system_factory_reset.post import ApiForpost +# 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, + ApiForPost, ): pass diff --git a/pynitrokey/nethsm/client/apis/paths/system_info.py b/pynitrokey/nethsm/client/apis/paths/system_info.py index bd65d084..e7f595b5 100644 --- a/pynitrokey/nethsm/client/apis/paths/system_info.py +++ b/pynitrokey/nethsm/client/apis/paths/system_info.py @@ -1,7 +1,13 @@ -from pynitrokey.nethsm.client.paths.system_info.get import ApiForget +# 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, + ApiForGet, ): pass diff --git a/pynitrokey/nethsm/client/apis/paths/system_reboot.py b/pynitrokey/nethsm/client/apis/paths/system_reboot.py index 75e19c2c..8cac6031 100644 --- a/pynitrokey/nethsm/client/apis/paths/system_reboot.py +++ b/pynitrokey/nethsm/client/apis/paths/system_reboot.py @@ -1,7 +1,13 @@ -from pynitrokey.nethsm.client.paths.system_reboot.post import ApiForpost +# 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, + ApiForPost, ): pass diff --git a/pynitrokey/nethsm/client/apis/paths/system_restore.py b/pynitrokey/nethsm/client/apis/paths/system_restore.py index 59b9fb67..8e514069 100644 --- a/pynitrokey/nethsm/client/apis/paths/system_restore.py +++ b/pynitrokey/nethsm/client/apis/paths/system_restore.py @@ -1,7 +1,13 @@ -from pynitrokey.nethsm.client.paths.system_restore.post import ApiForpost +# 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, + ApiForPost, ): pass diff --git a/pynitrokey/nethsm/client/apis/paths/system_shutdown.py b/pynitrokey/nethsm/client/apis/paths/system_shutdown.py index 4f952768..202a7f84 100644 --- a/pynitrokey/nethsm/client/apis/paths/system_shutdown.py +++ b/pynitrokey/nethsm/client/apis/paths/system_shutdown.py @@ -1,7 +1,13 @@ -from pynitrokey.nethsm.client.paths.system_shutdown.post import ApiForpost +# 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, + ApiForPost, ): pass diff --git a/pynitrokey/nethsm/client/apis/paths/system_update.py b/pynitrokey/nethsm/client/apis/paths/system_update.py index 5d93f313..773f0a8d 100644 --- a/pynitrokey/nethsm/client/apis/paths/system_update.py +++ b/pynitrokey/nethsm/client/apis/paths/system_update.py @@ -1,7 +1,13 @@ -from pynitrokey.nethsm.client.paths.system_update.post import ApiForpost +# 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, + ApiForPost, ): pass diff --git a/pynitrokey/nethsm/client/apis/paths/unlock.py b/pynitrokey/nethsm/client/apis/paths/unlock.py index 47462690..8caed8cd 100644 --- a/pynitrokey/nethsm/client/apis/paths/unlock.py +++ b/pynitrokey/nethsm/client/apis/paths/unlock.py @@ -1,7 +1,13 @@ -from pynitrokey.nethsm.client.paths.unlock.post import ApiForpost +# 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, + ApiForPost, ): pass diff --git a/pynitrokey/nethsm/client/apis/paths/users.py b/pynitrokey/nethsm/client/apis/paths/users.py index 46c801bc..af575546 100644 --- a/pynitrokey/nethsm/client/apis/paths/users.py +++ b/pynitrokey/nethsm/client/apis/paths/users.py @@ -1,9 +1,15 @@ -from pynitrokey.nethsm.client.paths.users.get import ApiForget -from pynitrokey.nethsm.client.paths.users.post import ApiForpost +# 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, + 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 index 71d46641..66afcb78 100644 --- a/pynitrokey/nethsm/client/apis/paths/users_user_id.py +++ b/pynitrokey/nethsm/client/apis/paths/users_user_id.py @@ -1,11 +1,17 @@ -from pynitrokey.nethsm.client.paths.users_user_id.get import ApiForget -from pynitrokey.nethsm.client.paths.users_user_id.put import ApiForput -from pynitrokey.nethsm.client.paths.users_user_id.delete import ApiFordelete +# 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( - ApiForget, - ApiForput, - ApiFordelete, + 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 index 2d95eee3..a582774d 100644 --- a/pynitrokey/nethsm/client/apis/paths/users_user_id_passphrase.py +++ b/pynitrokey/nethsm/client/apis/paths/users_user_id_passphrase.py @@ -1,7 +1,13 @@ -from pynitrokey.nethsm.client.paths.users_user_id_passphrase.post import ApiForpost +# 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, + 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 index c130c9e9..d0b8843b 100644 --- a/pynitrokey/nethsm/client/apis/paths/users_user_id_tags.py +++ b/pynitrokey/nethsm/client/apis/paths/users_user_id_tags.py @@ -1,7 +1,13 @@ -from pynitrokey.nethsm.client.paths.users_user_id_tags.get import ApiForget +# 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, + 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 index 418e2892..0540b1de 100644 --- a/pynitrokey/nethsm/client/apis/paths/users_user_id_tags_tag.py +++ b/pynitrokey/nethsm/client/apis/paths/users_user_id_tags_tag.py @@ -1,9 +1,15 @@ -from pynitrokey.nethsm.client.paths.users_user_id_tags_tag.put import ApiForput -from pynitrokey.nethsm.client.paths.users_user_id_tags_tag.delete import ApiFordelete +# 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( - ApiForput, - ApiFordelete, + ApiForDelete, + ApiForPut, ): pass diff --git a/pynitrokey/nethsm/client/apis/tag_to_api.py b/pynitrokey/nethsm/client/apis/tag_to_api.py index 54f659b0..6016f291 100644 --- a/pynitrokey/nethsm/client/apis/tag_to_api.py +++ b/pynitrokey/nethsm/client/apis/tag_to_api.py @@ -1,17 +1,17 @@ +import typing import typing_extensions -from pynitrokey.nethsm.client.apis.tags import TagValues from pynitrokey.nethsm.client.apis.tags.default_api import DefaultApi -TagToApi = typing_extensions.TypedDict( +TagToApi = typing.TypedDict( 'TagToApi', { - TagValues.DEFAULT: DefaultApi, + "default": typing.Type[DefaultApi], } ) tag_to_api = TagToApi( { - TagValues.DEFAULT: DefaultApi, + "default": DefaultApi, } ) diff --git a/pynitrokey/nethsm/client/apis/tags/__init__.py b/pynitrokey/nethsm/client/apis/tags/__init__.py index d73d5451..88df0dd3 100644 --- a/pynitrokey/nethsm/client/apis/tags/__init__.py +++ b/pynitrokey/nethsm/client/apis/tags/__init__.py @@ -1,9 +1,3 @@ # 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 - -import enum - - -class TagValues(str, enum.Enum): - DEFAULT = "default" +# 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 index e7c98fa6..9fd291f1 100644 --- a/pynitrokey/nethsm/client/apis/tags/default_api.py +++ b/pynitrokey/nethsm/client/apis/tags/default_api.py @@ -1,136 +1,131 @@ # 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 encoded values are Big Endian. # noqa: E501 - - The version of the OpenAPI document: v1 - Generated by: https://openapi-generator.tech + Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator """ -from pynitrokey.nethsm.client.paths.config_backup_passphrase.put import ConfigBackupPassphrasePut -from pynitrokey.nethsm.client.paths.config_logging.get import ConfigLoggingGet -from pynitrokey.nethsm.client.paths.config_logging.put import ConfigLoggingPut -from pynitrokey.nethsm.client.paths.config_network.get import ConfigNetworkGet -from pynitrokey.nethsm.client.paths.config_network.put import ConfigNetworkPut -from pynitrokey.nethsm.client.paths.config_time.get import ConfigTimeGet -from pynitrokey.nethsm.client.paths.config_time.put import ConfigTimePut -from pynitrokey.nethsm.client.paths.config_tls_cert_pem.get import ConfigTlsCertPemGet -from pynitrokey.nethsm.client.paths.config_tls_cert_pem.put import ConfigTlsCertPemPut -from pynitrokey.nethsm.client.paths.config_tls_csr_pem.post import ConfigTlsCsrPemPost -from pynitrokey.nethsm.client.paths.config_tls_generate.post import ConfigTlsGeneratePost -from pynitrokey.nethsm.client.paths.config_tls_public_pem.get import ConfigTlsPublicPemGet -from pynitrokey.nethsm.client.paths.config_unattended_boot.get import ConfigUnattendedBootGet -from pynitrokey.nethsm.client.paths.config_unattended_boot.put import ConfigUnattendedBootPut -from pynitrokey.nethsm.client.paths.config_unlock_passphrase.put import ConfigUnlockPassphrasePut -from pynitrokey.nethsm.client.paths.health_alive.get import HealthAliveGet -from pynitrokey.nethsm.client.paths.health_ready.get import HealthReadyGet -from pynitrokey.nethsm.client.paths.health_state.get import HealthStateGet -from pynitrokey.nethsm.client.paths.info.get import InfoGet -from pynitrokey.nethsm.client.paths.keys_generate.post import KeysGeneratePost -from pynitrokey.nethsm.client.paths.keys.get import KeysGet -from pynitrokey.nethsm.client.paths.keys_key_id_cert.delete import KeysKeyIdCertDelete -from pynitrokey.nethsm.client.paths.keys_key_id_cert.get import KeysKeyIdCertGet -from pynitrokey.nethsm.client.paths.keys_key_id_cert.put import KeysKeyIdCertPut -from pynitrokey.nethsm.client.paths.keys_key_id_csr_pem.post import KeysKeyIdCsrPemPost -from pynitrokey.nethsm.client.paths.keys_key_id_decrypt.post import KeysKeyIdDecryptPost -from pynitrokey.nethsm.client.paths.keys_key_id.delete import KeysKeyIdDelete -from pynitrokey.nethsm.client.paths.keys_key_id_encrypt.post import KeysKeyIdEncryptPost -from pynitrokey.nethsm.client.paths.keys_key_id.get import KeysKeyIdGet -from pynitrokey.nethsm.client.paths.keys_key_id_public_pem.get import KeysKeyIdPublicPemGet -from pynitrokey.nethsm.client.paths.keys_key_id.put import KeysKeyIdPut -from pynitrokey.nethsm.client.paths.keys_key_id_restrictions_tags_tag.delete import KeysKeyIdRestrictionsTagsTagDelete -from pynitrokey.nethsm.client.paths.keys_key_id_restrictions_tags_tag.put import KeysKeyIdRestrictionsTagsTagPut -from pynitrokey.nethsm.client.paths.keys_key_id_sign.post import KeysKeyIdSignPost -from pynitrokey.nethsm.client.paths.keys.post import KeysPost -from pynitrokey.nethsm.client.paths.lock.post import LockPost -from pynitrokey.nethsm.client.paths.metrics.get import MetricsGet -from pynitrokey.nethsm.client.paths.provision.post import ProvisionPost -from pynitrokey.nethsm.client.paths.random.post import RandomPost -from pynitrokey.nethsm.client.paths.system_backup.post import SystemBackupPost -from pynitrokey.nethsm.client.paths.system_cancel_update.post import SystemCancelUpdatePost -from pynitrokey.nethsm.client.paths.system_commit_update.post import SystemCommitUpdatePost -from pynitrokey.nethsm.client.paths.system_factory_reset.post import SystemFactoryResetPost -from pynitrokey.nethsm.client.paths.system_info.get import SystemInfoGet -from pynitrokey.nethsm.client.paths.system_reboot.post import SystemRebootPost -from pynitrokey.nethsm.client.paths.system_restore.post import SystemRestorePost -from pynitrokey.nethsm.client.paths.system_shutdown.post import SystemShutdownPost -from pynitrokey.nethsm.client.paths.system_update.post import SystemUpdatePost -from pynitrokey.nethsm.client.paths.unlock.post import UnlockPost -from pynitrokey.nethsm.client.paths.users.get import UsersGet -from pynitrokey.nethsm.client.paths.users.post import UsersPost -from pynitrokey.nethsm.client.paths.users_user_id.delete import UsersUserIdDelete -from pynitrokey.nethsm.client.paths.users_user_id.get import UsersUserIdGet -from pynitrokey.nethsm.client.paths.users_user_id_passphrase.post import UsersUserIdPassphrasePost -from pynitrokey.nethsm.client.paths.users_user_id.put import UsersUserIdPut -from pynitrokey.nethsm.client.paths.users_user_id_tags.get import UsersUserIdTagsGet -from pynitrokey.nethsm.client.paths.users_user_id_tags_tag.delete import UsersUserIdTagsTagDelete -from pynitrokey.nethsm.client.paths.users_user_id_tags_tag.put import UsersUserIdTagsTagPut +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( - ConfigBackupPassphrasePut, - ConfigLoggingGet, - ConfigLoggingPut, - ConfigNetworkGet, - ConfigNetworkPut, - ConfigTimeGet, - ConfigTimePut, - ConfigTlsCertPemGet, - ConfigTlsCertPemPut, + KeysKeyIDCsrPemPost, + SystemFactoryResetPost, + SystemCommitUpdatePost, + SystemUpdatePost, + SystemInfoGet, ConfigTlsCsrPemPost, ConfigTlsGeneratePost, - ConfigTlsPublicPemGet, + KeysKeyIDDecryptPost, + UsersUserIDTagsGet, + ConfigTlsCertPemGet, + ConfigTlsCertPemPut, + SystemBackupPost, + ProvisionPost, + KeysKeyIDSignPost, + HealthStateGet, + KeysKeyIDCertDelete, + KeysKeyIDCertGet, + KeysKeyIDCertPut, + KeysKeyIDEncryptPost, + SystemCancelUpdatePost, + KeysKeyIDPublicPemGet, + ConfigUnlockPassphrasePut, + SystemRebootPost, + KeysKeyIDRestrictionsTagsTagDelete, + KeysKeyIDRestrictionsTagsTagPut, + UnlockPost, + ConfigLoggingGet, + ConfigLoggingPut, + LockPost, ConfigUnattendedBootGet, ConfigUnattendedBootPut, - ConfigUnlockPassphrasePut, - HealthAliveGet, - HealthReadyGet, - HealthStateGet, - InfoGet, KeysGeneratePost, + ConfigTlsPublicPemGet, + InfoGet, + ConfigBackupPassphrasePut, + HealthReadyGet, + ConfigTimeGet, + ConfigTimePut, + SystemShutdownPost, + ConfigNetworkGet, + ConfigNetworkPut, + KeysKeyIDDelete, + KeysKeyIDGet, + KeysKeyIDPut, + HealthAliveGet, + MetricsGet, + UsersUserIDPassphrasePost, + UsersUserIDDelete, + UsersUserIDGet, + UsersUserIDPut, + SystemRestorePost, + UsersUserIDTagsTagDelete, + UsersUserIDTagsTagPut, KeysGet, - KeysKeyIdCertDelete, - KeysKeyIdCertGet, - KeysKeyIdCertPut, - KeysKeyIdCsrPemPost, - KeysKeyIdDecryptPost, - KeysKeyIdDelete, - KeysKeyIdEncryptPost, - KeysKeyIdGet, - KeysKeyIdPublicPemGet, - KeysKeyIdPut, - KeysKeyIdRestrictionsTagsTagDelete, - KeysKeyIdRestrictionsTagsTagPut, - KeysKeyIdSignPost, KeysPost, - LockPost, - MetricsGet, - ProvisionPost, RandomPost, - SystemBackupPost, - SystemCancelUpdatePost, - SystemCommitUpdatePost, - SystemFactoryResetPost, - SystemInfoGet, - SystemRebootPost, - SystemRestorePost, - SystemShutdownPost, - SystemUpdatePost, - UnlockPost, UsersGet, UsersPost, - UsersUserIdDelete, - UsersUserIdGet, - UsersUserIdPassphrasePost, - UsersUserIdPut, - UsersUserIdTagsGet, - UsersUserIdTagsTagDelete, - UsersUserIdTagsTagPut, ): - """NOTE: This class is auto generated by OpenAPI Generator - Ref: https://openapi-generator.tech + """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. """ diff --git a/pynitrokey/nethsm/client/components/__init__.py b/pynitrokey/nethsm/client/components/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/pynitrokey/nethsm/client/components/request_bodies/__init__.py b/pynitrokey/nethsm/client/components/request_bodies/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/pynitrokey/nethsm/client/components/responses/__init__.py b/pynitrokey/nethsm/client/components/responses/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/pynitrokey/nethsm/client/model/__init__.py b/pynitrokey/nethsm/client/components/schema/__init__.py similarity index 80% rename from pynitrokey/nethsm/client/model/__init__.py rename to pynitrokey/nethsm/client/components/schema/__init__.py index 8a9814c8..f33acd4d 100644 --- a/pynitrokey/nethsm/client/model/__init__.py +++ b/pynitrokey/nethsm/client/components/schema/__init__.py @@ -2,4 +2,4 @@ # 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.models import ModelA, ModelB +# 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 new file mode 100644 index 00000000..169767df --- /dev/null +++ b/pynitrokey/nethsm/client/components/schema/backup_passphrase_config.py @@ -0,0 +1,103 @@ +# 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 new file mode 100644 index 00000000..1389b2ae --- /dev/null +++ b/pynitrokey/nethsm/client/components/schema/base64.py @@ -0,0 +1,29 @@ +# 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 new file mode 100644 index 00000000..d0a866be --- /dev/null +++ b/pynitrokey/nethsm/client/components/schema/decrypt_data.py @@ -0,0 +1,103 @@ +# 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 new file mode 100644 index 00000000..25dec7dd --- /dev/null +++ b/pynitrokey/nethsm/client/components/schema/decrypt_mode.py @@ -0,0 +1,183 @@ +# 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 new file mode 100644 index 00000000..c55f8c1a --- /dev/null +++ b/pynitrokey/nethsm/client/components/schema/decrypt_request_data.py @@ -0,0 +1,148 @@ +# 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 new file mode 100644 index 00000000..6a8ce334 --- /dev/null +++ b/pynitrokey/nethsm/client/components/schema/distinguished_name.py @@ -0,0 +1,216 @@ +# 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 new file mode 100644 index 00000000..92bd65a1 --- /dev/null +++ b/pynitrokey/nethsm/client/components/schema/encrypt_data.py @@ -0,0 +1,116 @@ +# 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 new file mode 100644 index 00000000..af4a5a0c --- /dev/null +++ b/pynitrokey/nethsm/client/components/schema/encrypt_mode.py @@ -0,0 +1,71 @@ +# 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 new file mode 100644 index 00000000..ba48176d --- /dev/null +++ b/pynitrokey/nethsm/client/components/schema/encrypt_request_data.py @@ -0,0 +1,140 @@ +# 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 new file mode 100644 index 00000000..fb1dec44 --- /dev/null +++ b/pynitrokey/nethsm/client/components/schema/health_state_data.py @@ -0,0 +1,107 @@ +# 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 new file mode 100644 index 00000000..34e982b3 --- /dev/null +++ b/pynitrokey/nethsm/client/components/schema/id.py @@ -0,0 +1,31 @@ +# 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 new file mode 100644 index 00000000..a8f14419 --- /dev/null +++ b/pynitrokey/nethsm/client/components/schema/info_data.py @@ -0,0 +1,116 @@ +# 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 new file mode 100644 index 00000000..cf384ccc --- /dev/null +++ b/pynitrokey/nethsm/client/components/schema/key_generate_request_data.py @@ -0,0 +1,199 @@ +# 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 new file mode 100644 index 00000000..110bf3ed --- /dev/null +++ b/pynitrokey/nethsm/client/components/schema/key_item.py @@ -0,0 +1,103 @@ +# 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 new file mode 100644 index 00000000..af59d0d0 --- /dev/null +++ b/pynitrokey/nethsm/client/components/schema/key_list.py @@ -0,0 +1,75 @@ +# 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 new file mode 100644 index 00000000..cdad023d --- /dev/null +++ b/pynitrokey/nethsm/client/components/schema/key_mechanism.py @@ -0,0 +1,323 @@ +# 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 new file mode 100644 index 00000000..6df03560 --- /dev/null +++ b/pynitrokey/nethsm/client/components/schema/key_mechanisms.py @@ -0,0 +1,109 @@ +# 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 new file mode 100644 index 00000000..d0dbf592 --- /dev/null +++ b/pynitrokey/nethsm/client/components/schema/key_private_data.py @@ -0,0 +1,162 @@ +# 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 new file mode 100644 index 00000000..384e815e --- /dev/null +++ b/pynitrokey/nethsm/client/components/schema/key_public_data.py @@ -0,0 +1,149 @@ +# 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 new file mode 100644 index 00000000..e94f3e6b --- /dev/null +++ b/pynitrokey/nethsm/client/components/schema/key_restrictions.py @@ -0,0 +1,111 @@ +# 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 new file mode 100644 index 00000000..071e5c3a --- /dev/null +++ b/pynitrokey/nethsm/client/components/schema/key_type.py @@ -0,0 +1,155 @@ +# 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 new file mode 100644 index 00000000..13fb4018 --- /dev/null +++ b/pynitrokey/nethsm/client/components/schema/log_level.py @@ -0,0 +1,113 @@ +# 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 new file mode 100644 index 00000000..a289b133 --- /dev/null +++ b/pynitrokey/nethsm/client/components/schema/logging_config.py @@ -0,0 +1,134 @@ +# 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 new file mode 100644 index 00000000..9f7081ce --- /dev/null +++ b/pynitrokey/nethsm/client/components/schema/metrics_data.py @@ -0,0 +1,13 @@ +# 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 new file mode 100644 index 00000000..a1bf4c2a --- /dev/null +++ b/pynitrokey/nethsm/client/components/schema/network_config.py @@ -0,0 +1,129 @@ +# 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 new file mode 100644 index 00000000..8964a06b --- /dev/null +++ b/pynitrokey/nethsm/client/components/schema/passphrase.py @@ -0,0 +1,27 @@ +# 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 new file mode 100644 index 00000000..6c8bd22e --- /dev/null +++ b/pynitrokey/nethsm/client/components/schema/pem_cert.py @@ -0,0 +1,13 @@ +# 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 new file mode 100644 index 00000000..4f5f3f5a --- /dev/null +++ b/pynitrokey/nethsm/client/components/schema/pem_csr.py @@ -0,0 +1,13 @@ +# 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 new file mode 100644 index 00000000..84ac2613 --- /dev/null +++ b/pynitrokey/nethsm/client/components/schema/pem_private_key.py @@ -0,0 +1,13 @@ +# 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 new file mode 100644 index 00000000..a64343bc --- /dev/null +++ b/pynitrokey/nethsm/client/components/schema/pem_public_key.py @@ -0,0 +1,13 @@ +# 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 new file mode 100644 index 00000000..93bf5826 --- /dev/null +++ b/pynitrokey/nethsm/client/components/schema/pgp_private_key.py @@ -0,0 +1,13 @@ +# 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 new file mode 100644 index 00000000..0ec3601d --- /dev/null +++ b/pynitrokey/nethsm/client/components/schema/private_key.py @@ -0,0 +1,168 @@ +# 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 new file mode 100644 index 00000000..b23f8ee9 --- /dev/null +++ b/pynitrokey/nethsm/client/components/schema/provision_request_data.py @@ -0,0 +1,132 @@ +# 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 new file mode 100644 index 00000000..d108cbec --- /dev/null +++ b/pynitrokey/nethsm/client/components/schema/public_key.py @@ -0,0 +1,181 @@ +# 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 new file mode 100644 index 00000000..0d292c06 --- /dev/null +++ b/pynitrokey/nethsm/client/components/schema/random_data.py @@ -0,0 +1,103 @@ +# 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 new file mode 100644 index 00000000..4a629295 --- /dev/null +++ b/pynitrokey/nethsm/client/components/schema/random_request_data.py @@ -0,0 +1,114 @@ +# 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 new file mode 100644 index 00000000..cad7ac68 --- /dev/null +++ b/pynitrokey/nethsm/client/components/schema/sign_data.py @@ -0,0 +1,103 @@ +# 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 new file mode 100644 index 00000000..cd27e7ba --- /dev/null +++ b/pynitrokey/nethsm/client/components/schema/sign_mode.py @@ -0,0 +1,183 @@ +# 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 new file mode 100644 index 00000000..317174b5 --- /dev/null +++ b/pynitrokey/nethsm/client/components/schema/sign_request_data.py @@ -0,0 +1,127 @@ +# 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 new file mode 100644 index 00000000..28b391a7 --- /dev/null +++ b/pynitrokey/nethsm/client/components/schema/switch.py @@ -0,0 +1,85 @@ +# 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 new file mode 100644 index 00000000..e47056cd --- /dev/null +++ b/pynitrokey/nethsm/client/components/schema/system_info.py @@ -0,0 +1,187 @@ +# 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 new file mode 100644 index 00000000..b8961737 --- /dev/null +++ b/pynitrokey/nethsm/client/components/schema/system_state.py @@ -0,0 +1,99 @@ +# 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 new file mode 100644 index 00000000..bab89cbb --- /dev/null +++ b/pynitrokey/nethsm/client/components/schema/system_update_data.py @@ -0,0 +1,103 @@ +# 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 new file mode 100644 index 00000000..10702ef2 --- /dev/null +++ b/pynitrokey/nethsm/client/components/schema/tag_list.py @@ -0,0 +1,69 @@ +# 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 new file mode 100644 index 00000000..03c6dd48 --- /dev/null +++ b/pynitrokey/nethsm/client/components/schema/time_config.py @@ -0,0 +1,106 @@ +# 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 new file mode 100644 index 00000000..339a3877 --- /dev/null +++ b/pynitrokey/nethsm/client/components/schema/tls_key_generate_request_data.py @@ -0,0 +1,145 @@ +# 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 new file mode 100644 index 00000000..a3a79937 --- /dev/null +++ b/pynitrokey/nethsm/client/components/schema/tls_key_type.py @@ -0,0 +1,141 @@ +# 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 new file mode 100644 index 00000000..96491d93 --- /dev/null +++ b/pynitrokey/nethsm/client/components/schema/unattended_boot_config.py @@ -0,0 +1,106 @@ +# 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 new file mode 100644 index 00000000..81619778 --- /dev/null +++ b/pynitrokey/nethsm/client/components/schema/unlock_passphrase_config.py @@ -0,0 +1,103 @@ +# 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 new file mode 100644 index 00000000..4ae30bbb --- /dev/null +++ b/pynitrokey/nethsm/client/components/schema/unlock_request_data.py @@ -0,0 +1,103 @@ +# 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 new file mode 100644 index 00000000..ac5c9bf2 --- /dev/null +++ b/pynitrokey/nethsm/client/components/schema/user_data.py @@ -0,0 +1,121 @@ +# 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 new file mode 100644 index 00000000..43231c78 --- /dev/null +++ b/pynitrokey/nethsm/client/components/schema/user_item.py @@ -0,0 +1,103 @@ +# 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 new file mode 100644 index 00000000..e922d674 --- /dev/null +++ b/pynitrokey/nethsm/client/components/schema/user_list.py @@ -0,0 +1,75 @@ +# 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 new file mode 100644 index 00000000..e440da71 --- /dev/null +++ b/pynitrokey/nethsm/client/components/schema/user_passphrase_post_data.py @@ -0,0 +1,103 @@ +# 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 new file mode 100644 index 00000000..10510521 --- /dev/null +++ b/pynitrokey/nethsm/client/components/schema/user_post_data.py @@ -0,0 +1,135 @@ +# 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 new file mode 100644 index 00000000..485da32d --- /dev/null +++ b/pynitrokey/nethsm/client/components/schema/user_role.py @@ -0,0 +1,113 @@ +# 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 new file mode 100644 index 00000000..cb598e62 --- /dev/null +++ b/pynitrokey/nethsm/client/components/schemas/__init__.py @@ -0,0 +1,69 @@ +# 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 new file mode 100644 index 00000000..e69de29b diff --git a/pynitrokey/nethsm/client/components/security_schemes/security_scheme_basic.py b/pynitrokey/nethsm/client/components/security_schemes/security_scheme_basic.py new file mode 100644 index 00000000..d55fef01 --- /dev/null +++ b/pynitrokey/nethsm/client/components/security_schemes/security_scheme_basic.py @@ -0,0 +1,14 @@ +# 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/configuration.py b/pynitrokey/nethsm/client/configuration.py deleted file mode 100644 index 78cf1877..00000000 --- a/pynitrokey/nethsm/client/configuration.py +++ /dev/null @@ -1,474 +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 encoded values are Big Endian. # noqa: E501 - - The version of the OpenAPI document: v1 - Generated by: https://openapi-generator.tech -""" - -import copy -import logging -import multiprocessing -import sys -import urllib3 - -from http import client as http_client -from pynitrokey.nethsm.client.exceptions import ApiValueError - - -JSON_SCHEMA_VALIDATION_KEYWORDS = { - 'multipleOf', 'maximum', 'exclusiveMaximum', - 'minimum', 'exclusiveMinimum', 'maxLength', - 'minLength', 'pattern', 'maxItems', 'minItems', - 'uniqueItems', 'maxProperties', 'minProperties', -} - -class Configuration(object): - """NOTE: This class is auto generated by OpenAPI Generator - - Ref: https://openapi-generator.tech - Do not edit the class manually. - - :param host: Base url - :param api_key: Dict to store API key(s). - Each entry in the dict specifies an API key. - The dict key is the name of the security scheme in the OAS specification. - The dict value is the API key secret. - :param api_key_prefix: Dict to store API prefix (e.g. Bearer) - The dict key is the name of the security scheme in the OAS specification. - The dict value is an API key prefix when generating the auth data. - :param username: Username for HTTP basic authentication - :param password: Password for HTTP basic authentication - :param discard_unknown_keys: Boolean value indicating whether to discard - unknown properties. A server may send a response that includes additional - properties that are not known by the client in the following scenarios: - 1. The OpenAPI document is incomplete, i.e. it does not match the server - implementation. - 2. The client was generated using an older version of the OpenAPI document - and the server has been upgraded since then. - If a schema in the OpenAPI document defines the additionalProperties attribute, - then all undeclared properties received by the server are injected into the - additional properties map. In that case, there are undeclared properties, and - nothing to discard. - :param disabled_client_side_validations (string): Comma-separated list 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_client_side_validations 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. - :param server_variables: Mapping with string values to replace variables in - templated server configuration. The validation of enums is performed for - variables with defined enum values before. - :param server_operation_index: Mapping from operation ID to an index to server - configuration. - :param server_operation_variables: Mapping from operation ID to a mapping with - string values to replace variables in templated server configuration. - The validation of enums is performed for variables with defined enum values before. - - :Example: - - HTTP Basic Authentication Example. - Given the following security scheme in the OpenAPI specification: - components: - securitySchemes: - http_basic_auth: - type: http - scheme: basic - - Configure API client with HTTP basic authentication: - -conf = pynitrokey.nethsm.client.Configuration( - username='the-user', - password='the-password', -) - - """ - - _default = None - - def __init__(self, host=None, - api_key=None, api_key_prefix=None, - username=None, password=None, - discard_unknown_keys=False, - disabled_client_side_validations="", - server_index=None, server_variables=None, - server_operation_index=None, server_operation_variables=None, - ): - """Constructor - """ - self._base_path = "https://nethsmdemo.nitrokey.com/api/v1" if host is None else host - """Default Base url - """ - self.server_index = 0 if server_index is None and host is None else server_index - self.server_operation_index = server_operation_index or {} - """Default server index - """ - self.server_variables = server_variables or {} - self.server_operation_variables = server_operation_variables or {} - """Default server variables - """ - self.temp_folder_path = None - """Temp file folder for downloading files - """ - # Authentication Settings - self.api_key = {} - if api_key: - self.api_key = api_key - """dict to store API key(s) - """ - self.api_key_prefix = {} - if api_key_prefix: - self.api_key_prefix = api_key_prefix - """dict to store API prefix (e.g. Bearer) - """ - self.refresh_api_key_hook = None - """function hook to refresh API key if expired - """ - self.username = username - """Username for HTTP basic authentication - """ - self.password = password - """Password for HTTP basic authentication - """ - self.discard_unknown_keys = discard_unknown_keys - self.disabled_client_side_validations = disabled_client_side_validations - 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 - - def __setattr__(self, name, value): - object.__setattr__(self, name, value) - if name == 'disabled_client_side_validations': - s = set(filter(None, value.split(','))) - for v in s: - if v not in JSON_SCHEMA_VALIDATION_KEYWORDS: - raise ApiValueError( - "Invalid keyword: '{0}''".format(v)) - self._disabled_client_side_validations = s - - @classmethod - def set_default(cls, default): - """Set default instance of configuration. - - It stores default configuration, which can be - returned by get_default_copy method. - - :param default: object of Configuration - """ - cls._default = copy.deepcopy(default) - - @classmethod - def get_default_copy(cls): - """Return new instance of configuration. - - This method returns newly created, based on default constructor, - object of Configuration class or returns a copy of default - configuration passed by the set_default method. - - :return: The configuration object. - """ - if cls._default is not None: - return copy.deepcopy(cls._default) - return Configuration() - - @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 get_api_key_with_prefix(self, identifier, alias=None): - """Gets API key (with prefix if set). - - :param identifier: The identifier of apiKey. - :param alias: The alternative identifier of apiKey. - :return: The token for api key authentication. - """ - if self.refresh_api_key_hook is not None: - self.refresh_api_key_hook(self) - key = self.api_key.get(identifier, self.api_key.get(alias) if alias is not None else None) - if key: - prefix = self.api_key_prefix.get(identifier) - if prefix: - return "%s %s" % (prefix, key) - else: - return key - - def get_basic_auth_token(self): - """Gets HTTP basic authentication header (string). - - :return: The token for basic HTTP authentication. - """ - username = "" - if self.username is not None: - username = self.username - password = "" - if self.password is not None: - password = self.password - return urllib3.util.make_headers( - basic_auth=username + ':' + password - ).get('authorization') - - def auth_settings(self): - """Gets Auth Settings dict for api client. - - :return: The Auth Settings information dict. - """ - auth = {} - if self.username is not None and self.password is not None: - auth['basic'] = { - 'type': 'basic', - 'in': 'header', - 'key': 'Authorization', - 'value': self.get_basic_auth_token() - } - return auth - - 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_host_settings(self): - """Gets an array of host settings - - :return: An array of host settings - """ - return [ - { - 'url': "https://{host}/api/{version}", - 'description': "No description provided", - 'variables': { - 'host': { - 'description': "No description provided", - 'default_value': "nethsmdemo.nitrokey.com", - }, - 'version': { - 'description': "No description provided", - 'default_value': "v1", - } - } - } - ] - - def get_host_from_settings(self, index, variables=None, servers=None): - """Gets host URL based on the index and variables - :param index: array index of the host settings - :param variables: hash of variable and the corresponding value - :param servers: an array of host settings or None - :return: URL based on host settings - """ - if index is None: - return self._base_path - - variables = {} if variables is None else variables - servers = self.get_host_settings() if servers is None else servers - - try: - server = servers[index] - except IndexError: - raise ValueError( - "Invalid index {0} when selecting the host settings. " - "Must be less than {1}".format(index, len(servers))) - - url = server['url'] - - # go through variables and replace placeholders - for variable_name, variable in server.get('variables', {}).items(): - used_value = variables.get( - variable_name, variable['default_value']) - - if 'enum_values' in variable \ - and used_value not in variable['enum_values']: - raise ValueError( - "The variable `{0}` in the host URL has invalid value " - "{1}. Must be {2}.".format( - variable_name, variables[variable_name], - variable['enum_values'])) - - url = url.replace("{" + variable_name + "}", used_value) - - return url - - @property - def host(self): - """Return generated host.""" - return self.get_host_from_settings(self.server_index, variables=self.server_variables) - - @host.setter - def host(self, value): - """Fix base path.""" - self._base_path = value - self.server_index = None diff --git a/pynitrokey/nethsm/client/configurations/__init__.py b/pynitrokey/nethsm/client/configurations/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/pynitrokey/nethsm/client/configurations/api_configuration.py b/pynitrokey/nethsm/client/configurations/api_configuration.py new file mode 100644 index 00000000..c6ce95e3 --- /dev/null +++ b/pynitrokey/nethsm/client/configurations/api_configuration.py @@ -0,0 +1,441 @@ +# 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 new file mode 100644 index 00000000..42e8ee6d --- /dev/null +++ b/pynitrokey/nethsm/client/configurations/schema_configuration.py @@ -0,0 +1,105 @@ +# 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 index 877c6191..7ebb72ca 100644 --- a/pynitrokey/nethsm/client/exceptions.py +++ b/pynitrokey/nethsm/client/exceptions.py @@ -2,17 +2,30 @@ """ 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 encoded values are Big Endian. # noqa: E501 - + 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://openapi-generator.tech + 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, @@ -96,41 +109,24 @@ def __init__(self, msg, path_to_item=None): 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) -class ApiException(OpenApiException): - def __init__(self, status=None, reason=None, api_response: 'pynitrokey.nethsm.client.api_client.ApiResponse' = None): - if api_response: - self.status = api_response.response.status - self.reason = api_response.response.reason - self.body = api_response.response.data - self.headers = api_response.response.getheaders() - else: - self.status = status - self.reason = reason - self.body = None - self.headers = None +@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.headers: - error_message += "HTTP response headers: {0}\n".format( - self.headers) - - if self.body: - error_message += "HTTP response body: {0}\n".format(self.body) + if self.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 - - -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 diff --git a/pynitrokey/nethsm/client/model/backup_passphrase_config.py b/pynitrokey/nethsm/client/model/backup_passphrase_config.py deleted file mode 100644 index e929f06b..00000000 --- a/pynitrokey/nethsm/client/model/backup_passphrase_config.py +++ /dev/null @@ -1,88 +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 encoded values are Big Endian. # noqa: E501 - - The version of the OpenAPI document: v1 - Generated by: https://openapi-generator.tech -""" - -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from pynitrokey.nethsm.client import schemas # noqa: F401 - - -class BackupPassphraseConfig( - schemas.DictSchema -): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech - - Do not edit the class manually. - """ - - - class MetaOapg: - required = { - "passphrase", - } - - class properties: - - @staticmethod - def passphrase() -> typing.Type['Passphrase']: - return Passphrase - __annotations__ = { - "passphrase": passphrase, - } - - passphrase: 'Passphrase' - - @typing.overload - def __getitem__(self, name: typing_extensions.Literal["passphrase"]) -> 'Passphrase': ... - - @typing.overload - def __getitem__(self, name: str) -> schemas.UnsetAnyTypeSchema: ... - - def __getitem__(self, name: typing.Union[typing_extensions.Literal["passphrase", ], str]): - # dict_instance[name] accessor - return super().__getitem__(name) - - - @typing.overload - def get_item_oapg(self, name: typing_extensions.Literal["passphrase"]) -> 'Passphrase': ... - - @typing.overload - def get_item_oapg(self, name: str) -> typing.Union[schemas.UnsetAnyTypeSchema, schemas.Unset]: ... - - def get_item_oapg(self, name: typing.Union[typing_extensions.Literal["passphrase", ], str]): - return super().get_item_oapg(name) - - - def __new__( - cls, - *args: typing.Union[dict, frozendict.frozendict, ], - passphrase: 'Passphrase', - _configuration: typing.Optional[schemas.Configuration] = None, - **kwargs: typing.Union[schemas.AnyTypeSchema, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, None, list, tuple, bytes], - ) -> 'BackupPassphraseConfig': - return super().__new__( - cls, - *args, - passphrase=passphrase, - _configuration=_configuration, - **kwargs, - ) - -from pynitrokey.nethsm.client.model.passphrase import Passphrase diff --git a/pynitrokey/nethsm/client/model/backup_passphrase_config.pyi b/pynitrokey/nethsm/client/model/backup_passphrase_config.pyi deleted file mode 100644 index e929f06b..00000000 --- a/pynitrokey/nethsm/client/model/backup_passphrase_config.pyi +++ /dev/null @@ -1,88 +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 encoded values are Big Endian. # noqa: E501 - - The version of the OpenAPI document: v1 - Generated by: https://openapi-generator.tech -""" - -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from pynitrokey.nethsm.client import schemas # noqa: F401 - - -class BackupPassphraseConfig( - schemas.DictSchema -): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech - - Do not edit the class manually. - """ - - - class MetaOapg: - required = { - "passphrase", - } - - class properties: - - @staticmethod - def passphrase() -> typing.Type['Passphrase']: - return Passphrase - __annotations__ = { - "passphrase": passphrase, - } - - passphrase: 'Passphrase' - - @typing.overload - def __getitem__(self, name: typing_extensions.Literal["passphrase"]) -> 'Passphrase': ... - - @typing.overload - def __getitem__(self, name: str) -> schemas.UnsetAnyTypeSchema: ... - - def __getitem__(self, name: typing.Union[typing_extensions.Literal["passphrase", ], str]): - # dict_instance[name] accessor - return super().__getitem__(name) - - - @typing.overload - def get_item_oapg(self, name: typing_extensions.Literal["passphrase"]) -> 'Passphrase': ... - - @typing.overload - def get_item_oapg(self, name: str) -> typing.Union[schemas.UnsetAnyTypeSchema, schemas.Unset]: ... - - def get_item_oapg(self, name: typing.Union[typing_extensions.Literal["passphrase", ], str]): - return super().get_item_oapg(name) - - - def __new__( - cls, - *args: typing.Union[dict, frozendict.frozendict, ], - passphrase: 'Passphrase', - _configuration: typing.Optional[schemas.Configuration] = None, - **kwargs: typing.Union[schemas.AnyTypeSchema, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, None, list, tuple, bytes], - ) -> 'BackupPassphraseConfig': - return super().__new__( - cls, - *args, - passphrase=passphrase, - _configuration=_configuration, - **kwargs, - ) - -from pynitrokey.nethsm.client.model.passphrase import Passphrase diff --git a/pynitrokey/nethsm/client/model/base64.py b/pynitrokey/nethsm/client/model/base64.py deleted file mode 100644 index 9c7dac76..00000000 --- a/pynitrokey/nethsm/client/model/base64.py +++ /dev/null @@ -1,39 +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 encoded values are Big Endian. # noqa: E501 - - The version of the OpenAPI document: v1 - Generated by: https://openapi-generator.tech -""" - -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from pynitrokey.nethsm.client import schemas # noqa: F401 - - -class Base64( - schemas.StrSchema -): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech - - Do not edit the class manually. - """ - - - class MetaOapg: - regex=[{ - 'pattern': r'^[a-zA-Z0-9+/]+={0,3}$', # noqa: E501 - }] diff --git a/pynitrokey/nethsm/client/model/base64.pyi b/pynitrokey/nethsm/client/model/base64.pyi deleted file mode 100644 index e840587d..00000000 --- a/pynitrokey/nethsm/client/model/base64.pyi +++ /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 encoded values are Big Endian. # noqa: E501 - - The version of the OpenAPI document: v1 - Generated by: https://openapi-generator.tech -""" - -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from pynitrokey.nethsm.client import schemas # noqa: F401 - - -class Base64( - schemas.StrSchema -): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech - - Do not edit the class manually. - """ - pass diff --git a/pynitrokey/nethsm/client/model/decrypt_data.py b/pynitrokey/nethsm/client/model/decrypt_data.py deleted file mode 100644 index 32de67b3..00000000 --- a/pynitrokey/nethsm/client/model/decrypt_data.py +++ /dev/null @@ -1,88 +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 encoded values are Big Endian. # noqa: E501 - - The version of the OpenAPI document: v1 - Generated by: https://openapi-generator.tech -""" - -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from pynitrokey.nethsm.client import schemas # noqa: F401 - - -class DecryptData( - schemas.DictSchema -): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech - - Do not edit the class manually. - """ - - - class MetaOapg: - required = { - "decrypted", - } - - class properties: - - @staticmethod - def decrypted() -> typing.Type['Base64']: - return Base64 - __annotations__ = { - "decrypted": decrypted, - } - - decrypted: 'Base64' - - @typing.overload - def __getitem__(self, name: typing_extensions.Literal["decrypted"]) -> 'Base64': ... - - @typing.overload - def __getitem__(self, name: str) -> schemas.UnsetAnyTypeSchema: ... - - def __getitem__(self, name: typing.Union[typing_extensions.Literal["decrypted", ], str]): - # dict_instance[name] accessor - return super().__getitem__(name) - - - @typing.overload - def get_item_oapg(self, name: typing_extensions.Literal["decrypted"]) -> 'Base64': ... - - @typing.overload - def get_item_oapg(self, name: str) -> typing.Union[schemas.UnsetAnyTypeSchema, schemas.Unset]: ... - - def get_item_oapg(self, name: typing.Union[typing_extensions.Literal["decrypted", ], str]): - return super().get_item_oapg(name) - - - def __new__( - cls, - *args: typing.Union[dict, frozendict.frozendict, ], - decrypted: 'Base64', - _configuration: typing.Optional[schemas.Configuration] = None, - **kwargs: typing.Union[schemas.AnyTypeSchema, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, None, list, tuple, bytes], - ) -> 'DecryptData': - return super().__new__( - cls, - *args, - decrypted=decrypted, - _configuration=_configuration, - **kwargs, - ) - -from pynitrokey.nethsm.client.model.base64 import Base64 diff --git a/pynitrokey/nethsm/client/model/decrypt_data.pyi b/pynitrokey/nethsm/client/model/decrypt_data.pyi deleted file mode 100644 index 32de67b3..00000000 --- a/pynitrokey/nethsm/client/model/decrypt_data.pyi +++ /dev/null @@ -1,88 +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 encoded values are Big Endian. # noqa: E501 - - The version of the OpenAPI document: v1 - Generated by: https://openapi-generator.tech -""" - -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from pynitrokey.nethsm.client import schemas # noqa: F401 - - -class DecryptData( - schemas.DictSchema -): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech - - Do not edit the class manually. - """ - - - class MetaOapg: - required = { - "decrypted", - } - - class properties: - - @staticmethod - def decrypted() -> typing.Type['Base64']: - return Base64 - __annotations__ = { - "decrypted": decrypted, - } - - decrypted: 'Base64' - - @typing.overload - def __getitem__(self, name: typing_extensions.Literal["decrypted"]) -> 'Base64': ... - - @typing.overload - def __getitem__(self, name: str) -> schemas.UnsetAnyTypeSchema: ... - - def __getitem__(self, name: typing.Union[typing_extensions.Literal["decrypted", ], str]): - # dict_instance[name] accessor - return super().__getitem__(name) - - - @typing.overload - def get_item_oapg(self, name: typing_extensions.Literal["decrypted"]) -> 'Base64': ... - - @typing.overload - def get_item_oapg(self, name: str) -> typing.Union[schemas.UnsetAnyTypeSchema, schemas.Unset]: ... - - def get_item_oapg(self, name: typing.Union[typing_extensions.Literal["decrypted", ], str]): - return super().get_item_oapg(name) - - - def __new__( - cls, - *args: typing.Union[dict, frozendict.frozendict, ], - decrypted: 'Base64', - _configuration: typing.Optional[schemas.Configuration] = None, - **kwargs: typing.Union[schemas.AnyTypeSchema, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, None, list, tuple, bytes], - ) -> 'DecryptData': - return super().__new__( - cls, - *args, - decrypted=decrypted, - _configuration=_configuration, - **kwargs, - ) - -from pynitrokey.nethsm.client.model.base64 import Base64 diff --git a/pynitrokey/nethsm/client/model/decrypt_mode.py b/pynitrokey/nethsm/client/model/decrypt_mode.py deleted file mode 100644 index b934e80d..00000000 --- a/pynitrokey/nethsm/client/model/decrypt_mode.py +++ /dev/null @@ -1,84 +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 encoded values are Big Endian. # noqa: E501 - - The version of the OpenAPI document: v1 - Generated by: https://openapi-generator.tech -""" - -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from pynitrokey.nethsm.client import schemas # noqa: F401 - - -class DecryptMode( - schemas.EnumBase, - schemas.StrSchema -): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech - - Do not edit the class manually. - """ - - - class MetaOapg: - enum_value_to_name = { - "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", - } - - @schemas.classproperty - def RAW(cls): - return cls("RAW") - - @schemas.classproperty - def PKCS1(cls): - return cls("PKCS1") - - @schemas.classproperty - def OAEP_MD5(cls): - return cls("OAEP_MD5") - - @schemas.classproperty - def OAEP_SHA1(cls): - return cls("OAEP_SHA1") - - @schemas.classproperty - def OAEP_SHA224(cls): - return cls("OAEP_SHA224") - - @schemas.classproperty - def OAEP_SHA256(cls): - return cls("OAEP_SHA256") - - @schemas.classproperty - def OAEP_SHA384(cls): - return cls("OAEP_SHA384") - - @schemas.classproperty - def OAEP_SHA512(cls): - return cls("OAEP_SHA512") - - @schemas.classproperty - def AES_CBC(cls): - return cls("AES_CBC") diff --git a/pynitrokey/nethsm/client/model/decrypt_mode.pyi b/pynitrokey/nethsm/client/model/decrypt_mode.pyi deleted file mode 100644 index cadc5f57..00000000 --- a/pynitrokey/nethsm/client/model/decrypt_mode.pyi +++ /dev/null @@ -1,70 +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 encoded values are Big Endian. # noqa: E501 - - The version of the OpenAPI document: v1 - Generated by: https://openapi-generator.tech -""" - -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from pynitrokey.nethsm.client import schemas # noqa: F401 - - -class DecryptMode( - schemas.EnumBase, - schemas.StrSchema -): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech - - Do not edit the class manually. - """ - - @schemas.classproperty - def RAW(cls): - return cls("RAW") - - @schemas.classproperty - def PKCS1(cls): - return cls("PKCS1") - - @schemas.classproperty - def OAEP_MD5(cls): - return cls("OAEP_MD5") - - @schemas.classproperty - def OAEP_SHA1(cls): - return cls("OAEP_SHA1") - - @schemas.classproperty - def OAEP_SHA224(cls): - return cls("OAEP_SHA224") - - @schemas.classproperty - def OAEP_SHA256(cls): - return cls("OAEP_SHA256") - - @schemas.classproperty - def OAEP_SHA384(cls): - return cls("OAEP_SHA384") - - @schemas.classproperty - def OAEP_SHA512(cls): - return cls("OAEP_SHA512") - - @schemas.classproperty - def AES_CBC(cls): - return cls("AES_CBC") diff --git a/pynitrokey/nethsm/client/model/decrypt_request_data.py b/pynitrokey/nethsm/client/model/decrypt_request_data.py deleted file mode 100644 index 0264c663..00000000 --- a/pynitrokey/nethsm/client/model/decrypt_request_data.py +++ /dev/null @@ -1,117 +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 encoded values are Big Endian. # noqa: E501 - - The version of the OpenAPI document: v1 - Generated by: https://openapi-generator.tech -""" - -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from pynitrokey.nethsm.client import schemas # noqa: F401 - - -class DecryptRequestData( - schemas.DictSchema -): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech - - Do not edit the class manually. - """ - - - class MetaOapg: - required = { - "mode", - "encrypted", - } - - class properties: - - @staticmethod - def mode() -> typing.Type['DecryptMode']: - return DecryptMode - - @staticmethod - def encrypted() -> typing.Type['Base64']: - return Base64 - - @staticmethod - def iv() -> typing.Type['Base64']: - return Base64 - __annotations__ = { - "mode": mode, - "encrypted": encrypted, - "iv": iv, - } - - mode: 'DecryptMode' - encrypted: 'Base64' - - @typing.overload - def __getitem__(self, name: typing_extensions.Literal["mode"]) -> 'DecryptMode': ... - - @typing.overload - def __getitem__(self, name: typing_extensions.Literal["encrypted"]) -> 'Base64': ... - - @typing.overload - def __getitem__(self, name: typing_extensions.Literal["iv"]) -> 'Base64': ... - - @typing.overload - def __getitem__(self, name: str) -> schemas.UnsetAnyTypeSchema: ... - - def __getitem__(self, name: typing.Union[typing_extensions.Literal["mode", "encrypted", "iv", ], str]): - # dict_instance[name] accessor - return super().__getitem__(name) - - - @typing.overload - def get_item_oapg(self, name: typing_extensions.Literal["mode"]) -> 'DecryptMode': ... - - @typing.overload - def get_item_oapg(self, name: typing_extensions.Literal["encrypted"]) -> 'Base64': ... - - @typing.overload - def get_item_oapg(self, name: typing_extensions.Literal["iv"]) -> typing.Union['Base64', schemas.Unset]: ... - - @typing.overload - def get_item_oapg(self, name: str) -> typing.Union[schemas.UnsetAnyTypeSchema, schemas.Unset]: ... - - def get_item_oapg(self, name: typing.Union[typing_extensions.Literal["mode", "encrypted", "iv", ], str]): - return super().get_item_oapg(name) - - - def __new__( - cls, - *args: typing.Union[dict, frozendict.frozendict, ], - mode: 'DecryptMode', - encrypted: 'Base64', - iv: typing.Union['Base64', schemas.Unset] = schemas.unset, - _configuration: typing.Optional[schemas.Configuration] = None, - **kwargs: typing.Union[schemas.AnyTypeSchema, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, None, list, tuple, bytes], - ) -> 'DecryptRequestData': - return super().__new__( - cls, - *args, - mode=mode, - encrypted=encrypted, - iv=iv, - _configuration=_configuration, - **kwargs, - ) - -from pynitrokey.nethsm.client.model.base64 import Base64 -from pynitrokey.nethsm.client.model.decrypt_mode import DecryptMode diff --git a/pynitrokey/nethsm/client/model/decrypt_request_data.pyi b/pynitrokey/nethsm/client/model/decrypt_request_data.pyi deleted file mode 100644 index 0264c663..00000000 --- a/pynitrokey/nethsm/client/model/decrypt_request_data.pyi +++ /dev/null @@ -1,117 +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 encoded values are Big Endian. # noqa: E501 - - The version of the OpenAPI document: v1 - Generated by: https://openapi-generator.tech -""" - -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from pynitrokey.nethsm.client import schemas # noqa: F401 - - -class DecryptRequestData( - schemas.DictSchema -): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech - - Do not edit the class manually. - """ - - - class MetaOapg: - required = { - "mode", - "encrypted", - } - - class properties: - - @staticmethod - def mode() -> typing.Type['DecryptMode']: - return DecryptMode - - @staticmethod - def encrypted() -> typing.Type['Base64']: - return Base64 - - @staticmethod - def iv() -> typing.Type['Base64']: - return Base64 - __annotations__ = { - "mode": mode, - "encrypted": encrypted, - "iv": iv, - } - - mode: 'DecryptMode' - encrypted: 'Base64' - - @typing.overload - def __getitem__(self, name: typing_extensions.Literal["mode"]) -> 'DecryptMode': ... - - @typing.overload - def __getitem__(self, name: typing_extensions.Literal["encrypted"]) -> 'Base64': ... - - @typing.overload - def __getitem__(self, name: typing_extensions.Literal["iv"]) -> 'Base64': ... - - @typing.overload - def __getitem__(self, name: str) -> schemas.UnsetAnyTypeSchema: ... - - def __getitem__(self, name: typing.Union[typing_extensions.Literal["mode", "encrypted", "iv", ], str]): - # dict_instance[name] accessor - return super().__getitem__(name) - - - @typing.overload - def get_item_oapg(self, name: typing_extensions.Literal["mode"]) -> 'DecryptMode': ... - - @typing.overload - def get_item_oapg(self, name: typing_extensions.Literal["encrypted"]) -> 'Base64': ... - - @typing.overload - def get_item_oapg(self, name: typing_extensions.Literal["iv"]) -> typing.Union['Base64', schemas.Unset]: ... - - @typing.overload - def get_item_oapg(self, name: str) -> typing.Union[schemas.UnsetAnyTypeSchema, schemas.Unset]: ... - - def get_item_oapg(self, name: typing.Union[typing_extensions.Literal["mode", "encrypted", "iv", ], str]): - return super().get_item_oapg(name) - - - def __new__( - cls, - *args: typing.Union[dict, frozendict.frozendict, ], - mode: 'DecryptMode', - encrypted: 'Base64', - iv: typing.Union['Base64', schemas.Unset] = schemas.unset, - _configuration: typing.Optional[schemas.Configuration] = None, - **kwargs: typing.Union[schemas.AnyTypeSchema, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, None, list, tuple, bytes], - ) -> 'DecryptRequestData': - return super().__new__( - cls, - *args, - mode=mode, - encrypted=encrypted, - iv=iv, - _configuration=_configuration, - **kwargs, - ) - -from pynitrokey.nethsm.client.model.base64 import Base64 -from pynitrokey.nethsm.client.model.decrypt_mode import DecryptMode diff --git a/pynitrokey/nethsm/client/model/distinguished_name.py b/pynitrokey/nethsm/client/model/distinguished_name.py deleted file mode 100644 index 8df8f8be..00000000 --- a/pynitrokey/nethsm/client/model/distinguished_name.py +++ /dev/null @@ -1,143 +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 encoded values are Big Endian. # noqa: E501 - - The version of the OpenAPI document: v1 - Generated by: https://openapi-generator.tech -""" - -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from pynitrokey.nethsm.client import schemas # noqa: F401 - - -class DistinguishedName( - schemas.DictSchema -): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech - - Do not edit the class manually. - """ - - - class MetaOapg: - required = { - "commonName", - } - - class properties: - commonName = schemas.StrSchema - countryName = schemas.StrSchema - stateOrProvinceName = schemas.StrSchema - localityName = schemas.StrSchema - organizationName = schemas.StrSchema - organizationalUnitName = schemas.StrSchema - emailAddress = schemas.StrSchema - __annotations__ = { - "commonName": commonName, - "countryName": countryName, - "stateOrProvinceName": stateOrProvinceName, - "localityName": localityName, - "organizationName": organizationName, - "organizationalUnitName": organizationalUnitName, - "emailAddress": emailAddress, - } - - commonName: MetaOapg.properties.commonName - - @typing.overload - def __getitem__(self, name: typing_extensions.Literal["commonName"]) -> MetaOapg.properties.commonName: ... - - @typing.overload - def __getitem__(self, name: typing_extensions.Literal["countryName"]) -> MetaOapg.properties.countryName: ... - - @typing.overload - def __getitem__(self, name: typing_extensions.Literal["stateOrProvinceName"]) -> MetaOapg.properties.stateOrProvinceName: ... - - @typing.overload - def __getitem__(self, name: typing_extensions.Literal["localityName"]) -> MetaOapg.properties.localityName: ... - - @typing.overload - def __getitem__(self, name: typing_extensions.Literal["organizationName"]) -> MetaOapg.properties.organizationName: ... - - @typing.overload - def __getitem__(self, name: typing_extensions.Literal["organizationalUnitName"]) -> MetaOapg.properties.organizationalUnitName: ... - - @typing.overload - def __getitem__(self, name: typing_extensions.Literal["emailAddress"]) -> MetaOapg.properties.emailAddress: ... - - @typing.overload - def __getitem__(self, name: str) -> schemas.UnsetAnyTypeSchema: ... - - def __getitem__(self, name: typing.Union[typing_extensions.Literal["commonName", "countryName", "stateOrProvinceName", "localityName", "organizationName", "organizationalUnitName", "emailAddress", ], str]): - # dict_instance[name] accessor - return super().__getitem__(name) - - - @typing.overload - def get_item_oapg(self, name: typing_extensions.Literal["commonName"]) -> MetaOapg.properties.commonName: ... - - @typing.overload - def get_item_oapg(self, name: typing_extensions.Literal["countryName"]) -> typing.Union[MetaOapg.properties.countryName, schemas.Unset]: ... - - @typing.overload - def get_item_oapg(self, name: typing_extensions.Literal["stateOrProvinceName"]) -> typing.Union[MetaOapg.properties.stateOrProvinceName, schemas.Unset]: ... - - @typing.overload - def get_item_oapg(self, name: typing_extensions.Literal["localityName"]) -> typing.Union[MetaOapg.properties.localityName, schemas.Unset]: ... - - @typing.overload - def get_item_oapg(self, name: typing_extensions.Literal["organizationName"]) -> typing.Union[MetaOapg.properties.organizationName, schemas.Unset]: ... - - @typing.overload - def get_item_oapg(self, name: typing_extensions.Literal["organizationalUnitName"]) -> typing.Union[MetaOapg.properties.organizationalUnitName, schemas.Unset]: ... - - @typing.overload - def get_item_oapg(self, name: typing_extensions.Literal["emailAddress"]) -> typing.Union[MetaOapg.properties.emailAddress, schemas.Unset]: ... - - @typing.overload - def get_item_oapg(self, name: str) -> typing.Union[schemas.UnsetAnyTypeSchema, schemas.Unset]: ... - - def get_item_oapg(self, name: typing.Union[typing_extensions.Literal["commonName", "countryName", "stateOrProvinceName", "localityName", "organizationName", "organizationalUnitName", "emailAddress", ], str]): - return super().get_item_oapg(name) - - - def __new__( - cls, - *args: typing.Union[dict, frozendict.frozendict, ], - commonName: typing.Union[MetaOapg.properties.commonName, str, ], - countryName: typing.Union[MetaOapg.properties.countryName, str, schemas.Unset] = schemas.unset, - stateOrProvinceName: typing.Union[MetaOapg.properties.stateOrProvinceName, str, schemas.Unset] = schemas.unset, - localityName: typing.Union[MetaOapg.properties.localityName, str, schemas.Unset] = schemas.unset, - organizationName: typing.Union[MetaOapg.properties.organizationName, str, schemas.Unset] = schemas.unset, - organizationalUnitName: typing.Union[MetaOapg.properties.organizationalUnitName, str, schemas.Unset] = schemas.unset, - emailAddress: typing.Union[MetaOapg.properties.emailAddress, str, schemas.Unset] = schemas.unset, - _configuration: typing.Optional[schemas.Configuration] = None, - **kwargs: typing.Union[schemas.AnyTypeSchema, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, None, list, tuple, bytes], - ) -> 'DistinguishedName': - return super().__new__( - cls, - *args, - commonName=commonName, - countryName=countryName, - stateOrProvinceName=stateOrProvinceName, - localityName=localityName, - organizationName=organizationName, - organizationalUnitName=organizationalUnitName, - emailAddress=emailAddress, - _configuration=_configuration, - **kwargs, - ) diff --git a/pynitrokey/nethsm/client/model/distinguished_name.pyi b/pynitrokey/nethsm/client/model/distinguished_name.pyi deleted file mode 100644 index 8df8f8be..00000000 --- a/pynitrokey/nethsm/client/model/distinguished_name.pyi +++ /dev/null @@ -1,143 +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 encoded values are Big Endian. # noqa: E501 - - The version of the OpenAPI document: v1 - Generated by: https://openapi-generator.tech -""" - -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from pynitrokey.nethsm.client import schemas # noqa: F401 - - -class DistinguishedName( - schemas.DictSchema -): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech - - Do not edit the class manually. - """ - - - class MetaOapg: - required = { - "commonName", - } - - class properties: - commonName = schemas.StrSchema - countryName = schemas.StrSchema - stateOrProvinceName = schemas.StrSchema - localityName = schemas.StrSchema - organizationName = schemas.StrSchema - organizationalUnitName = schemas.StrSchema - emailAddress = schemas.StrSchema - __annotations__ = { - "commonName": commonName, - "countryName": countryName, - "stateOrProvinceName": stateOrProvinceName, - "localityName": localityName, - "organizationName": organizationName, - "organizationalUnitName": organizationalUnitName, - "emailAddress": emailAddress, - } - - commonName: MetaOapg.properties.commonName - - @typing.overload - def __getitem__(self, name: typing_extensions.Literal["commonName"]) -> MetaOapg.properties.commonName: ... - - @typing.overload - def __getitem__(self, name: typing_extensions.Literal["countryName"]) -> MetaOapg.properties.countryName: ... - - @typing.overload - def __getitem__(self, name: typing_extensions.Literal["stateOrProvinceName"]) -> MetaOapg.properties.stateOrProvinceName: ... - - @typing.overload - def __getitem__(self, name: typing_extensions.Literal["localityName"]) -> MetaOapg.properties.localityName: ... - - @typing.overload - def __getitem__(self, name: typing_extensions.Literal["organizationName"]) -> MetaOapg.properties.organizationName: ... - - @typing.overload - def __getitem__(self, name: typing_extensions.Literal["organizationalUnitName"]) -> MetaOapg.properties.organizationalUnitName: ... - - @typing.overload - def __getitem__(self, name: typing_extensions.Literal["emailAddress"]) -> MetaOapg.properties.emailAddress: ... - - @typing.overload - def __getitem__(self, name: str) -> schemas.UnsetAnyTypeSchema: ... - - def __getitem__(self, name: typing.Union[typing_extensions.Literal["commonName", "countryName", "stateOrProvinceName", "localityName", "organizationName", "organizationalUnitName", "emailAddress", ], str]): - # dict_instance[name] accessor - return super().__getitem__(name) - - - @typing.overload - def get_item_oapg(self, name: typing_extensions.Literal["commonName"]) -> MetaOapg.properties.commonName: ... - - @typing.overload - def get_item_oapg(self, name: typing_extensions.Literal["countryName"]) -> typing.Union[MetaOapg.properties.countryName, schemas.Unset]: ... - - @typing.overload - def get_item_oapg(self, name: typing_extensions.Literal["stateOrProvinceName"]) -> typing.Union[MetaOapg.properties.stateOrProvinceName, schemas.Unset]: ... - - @typing.overload - def get_item_oapg(self, name: typing_extensions.Literal["localityName"]) -> typing.Union[MetaOapg.properties.localityName, schemas.Unset]: ... - - @typing.overload - def get_item_oapg(self, name: typing_extensions.Literal["organizationName"]) -> typing.Union[MetaOapg.properties.organizationName, schemas.Unset]: ... - - @typing.overload - def get_item_oapg(self, name: typing_extensions.Literal["organizationalUnitName"]) -> typing.Union[MetaOapg.properties.organizationalUnitName, schemas.Unset]: ... - - @typing.overload - def get_item_oapg(self, name: typing_extensions.Literal["emailAddress"]) -> typing.Union[MetaOapg.properties.emailAddress, schemas.Unset]: ... - - @typing.overload - def get_item_oapg(self, name: str) -> typing.Union[schemas.UnsetAnyTypeSchema, schemas.Unset]: ... - - def get_item_oapg(self, name: typing.Union[typing_extensions.Literal["commonName", "countryName", "stateOrProvinceName", "localityName", "organizationName", "organizationalUnitName", "emailAddress", ], str]): - return super().get_item_oapg(name) - - - def __new__( - cls, - *args: typing.Union[dict, frozendict.frozendict, ], - commonName: typing.Union[MetaOapg.properties.commonName, str, ], - countryName: typing.Union[MetaOapg.properties.countryName, str, schemas.Unset] = schemas.unset, - stateOrProvinceName: typing.Union[MetaOapg.properties.stateOrProvinceName, str, schemas.Unset] = schemas.unset, - localityName: typing.Union[MetaOapg.properties.localityName, str, schemas.Unset] = schemas.unset, - organizationName: typing.Union[MetaOapg.properties.organizationName, str, schemas.Unset] = schemas.unset, - organizationalUnitName: typing.Union[MetaOapg.properties.organizationalUnitName, str, schemas.Unset] = schemas.unset, - emailAddress: typing.Union[MetaOapg.properties.emailAddress, str, schemas.Unset] = schemas.unset, - _configuration: typing.Optional[schemas.Configuration] = None, - **kwargs: typing.Union[schemas.AnyTypeSchema, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, None, list, tuple, bytes], - ) -> 'DistinguishedName': - return super().__new__( - cls, - *args, - commonName=commonName, - countryName=countryName, - stateOrProvinceName=stateOrProvinceName, - localityName=localityName, - organizationName=organizationName, - organizationalUnitName=organizationalUnitName, - emailAddress=emailAddress, - _configuration=_configuration, - **kwargs, - ) diff --git a/pynitrokey/nethsm/client/model/encrypt_data.py b/pynitrokey/nethsm/client/model/encrypt_data.py deleted file mode 100644 index e8203160..00000000 --- a/pynitrokey/nethsm/client/model/encrypt_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 encoded values are Big Endian. # noqa: E501 - - The version of the OpenAPI document: v1 - Generated by: https://openapi-generator.tech -""" - -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from pynitrokey.nethsm.client import schemas # noqa: F401 - - -class EncryptData( - schemas.DictSchema -): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech - - Do not edit the class manually. - """ - - - class MetaOapg: - required = { - "encrypted", - "iv", - } - - class properties: - - @staticmethod - def encrypted() -> typing.Type['Base64']: - return Base64 - - @staticmethod - def iv() -> typing.Type['Base64']: - return Base64 - __annotations__ = { - "encrypted": encrypted, - "iv": iv, - } - - encrypted: 'Base64' - iv: 'Base64' - - @typing.overload - def __getitem__(self, name: typing_extensions.Literal["encrypted"]) -> 'Base64': ... - - @typing.overload - def __getitem__(self, name: typing_extensions.Literal["iv"]) -> 'Base64': ... - - @typing.overload - def __getitem__(self, name: str) -> schemas.UnsetAnyTypeSchema: ... - - def __getitem__(self, name: typing.Union[typing_extensions.Literal["encrypted", "iv", ], str]): - # dict_instance[name] accessor - return super().__getitem__(name) - - - @typing.overload - def get_item_oapg(self, name: typing_extensions.Literal["encrypted"]) -> 'Base64': ... - - @typing.overload - def get_item_oapg(self, name: typing_extensions.Literal["iv"]) -> 'Base64': ... - - @typing.overload - def get_item_oapg(self, name: str) -> typing.Union[schemas.UnsetAnyTypeSchema, schemas.Unset]: ... - - def get_item_oapg(self, name: typing.Union[typing_extensions.Literal["encrypted", "iv", ], str]): - return super().get_item_oapg(name) - - - def __new__( - cls, - *args: typing.Union[dict, frozendict.frozendict, ], - encrypted: 'Base64', - iv: 'Base64', - _configuration: typing.Optional[schemas.Configuration] = None, - **kwargs: typing.Union[schemas.AnyTypeSchema, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, None, list, tuple, bytes], - ) -> 'EncryptData': - return super().__new__( - cls, - *args, - encrypted=encrypted, - iv=iv, - _configuration=_configuration, - **kwargs, - ) - -from pynitrokey.nethsm.client.model.base64 import Base64 diff --git a/pynitrokey/nethsm/client/model/encrypt_data.pyi b/pynitrokey/nethsm/client/model/encrypt_data.pyi deleted file mode 100644 index e8203160..00000000 --- a/pynitrokey/nethsm/client/model/encrypt_data.pyi +++ /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 encoded values are Big Endian. # noqa: E501 - - The version of the OpenAPI document: v1 - Generated by: https://openapi-generator.tech -""" - -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from pynitrokey.nethsm.client import schemas # noqa: F401 - - -class EncryptData( - schemas.DictSchema -): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech - - Do not edit the class manually. - """ - - - class MetaOapg: - required = { - "encrypted", - "iv", - } - - class properties: - - @staticmethod - def encrypted() -> typing.Type['Base64']: - return Base64 - - @staticmethod - def iv() -> typing.Type['Base64']: - return Base64 - __annotations__ = { - "encrypted": encrypted, - "iv": iv, - } - - encrypted: 'Base64' - iv: 'Base64' - - @typing.overload - def __getitem__(self, name: typing_extensions.Literal["encrypted"]) -> 'Base64': ... - - @typing.overload - def __getitem__(self, name: typing_extensions.Literal["iv"]) -> 'Base64': ... - - @typing.overload - def __getitem__(self, name: str) -> schemas.UnsetAnyTypeSchema: ... - - def __getitem__(self, name: typing.Union[typing_extensions.Literal["encrypted", "iv", ], str]): - # dict_instance[name] accessor - return super().__getitem__(name) - - - @typing.overload - def get_item_oapg(self, name: typing_extensions.Literal["encrypted"]) -> 'Base64': ... - - @typing.overload - def get_item_oapg(self, name: typing_extensions.Literal["iv"]) -> 'Base64': ... - - @typing.overload - def get_item_oapg(self, name: str) -> typing.Union[schemas.UnsetAnyTypeSchema, schemas.Unset]: ... - - def get_item_oapg(self, name: typing.Union[typing_extensions.Literal["encrypted", "iv", ], str]): - return super().get_item_oapg(name) - - - def __new__( - cls, - *args: typing.Union[dict, frozendict.frozendict, ], - encrypted: 'Base64', - iv: 'Base64', - _configuration: typing.Optional[schemas.Configuration] = None, - **kwargs: typing.Union[schemas.AnyTypeSchema, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, None, list, tuple, bytes], - ) -> 'EncryptData': - return super().__new__( - cls, - *args, - encrypted=encrypted, - iv=iv, - _configuration=_configuration, - **kwargs, - ) - -from pynitrokey.nethsm.client.model.base64 import Base64 diff --git a/pynitrokey/nethsm/client/model/encrypt_mode.py b/pynitrokey/nethsm/client/model/encrypt_mode.py deleted file mode 100644 index 4dd529e8..00000000 --- a/pynitrokey/nethsm/client/model/encrypt_mode.py +++ /dev/null @@ -1,44 +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 encoded values are Big Endian. # noqa: E501 - - The version of the OpenAPI document: v1 - Generated by: https://openapi-generator.tech -""" - -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from pynitrokey.nethsm.client import schemas # noqa: F401 - - -class EncryptMode( - schemas.EnumBase, - schemas.StrSchema -): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech - - Do not edit the class manually. - """ - - - class MetaOapg: - enum_value_to_name = { - "AES_CBC": "AES_CBC", - } - - @schemas.classproperty - def AES_CBC(cls): - return cls("AES_CBC") diff --git a/pynitrokey/nethsm/client/model/encrypt_mode.pyi b/pynitrokey/nethsm/client/model/encrypt_mode.pyi deleted file mode 100644 index 5a5fd0d9..00000000 --- a/pynitrokey/nethsm/client/model/encrypt_mode.pyi +++ /dev/null @@ -1,38 +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 encoded values are Big Endian. # noqa: E501 - - The version of the OpenAPI document: v1 - Generated by: https://openapi-generator.tech -""" - -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from pynitrokey.nethsm.client import schemas # noqa: F401 - - -class EncryptMode( - schemas.EnumBase, - schemas.StrSchema -): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech - - Do not edit the class manually. - """ - - @schemas.classproperty - def AES_CBC(cls): - return cls("AES_CBC") diff --git a/pynitrokey/nethsm/client/model/encrypt_request_data.py b/pynitrokey/nethsm/client/model/encrypt_request_data.py deleted file mode 100644 index 7a5b4f95..00000000 --- a/pynitrokey/nethsm/client/model/encrypt_request_data.py +++ /dev/null @@ -1,117 +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 encoded values are Big Endian. # noqa: E501 - - The version of the OpenAPI document: v1 - Generated by: https://openapi-generator.tech -""" - -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from pynitrokey.nethsm.client import schemas # noqa: F401 - - -class EncryptRequestData( - schemas.DictSchema -): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech - - Do not edit the class manually. - """ - - - class MetaOapg: - required = { - "mode", - "message", - } - - class properties: - - @staticmethod - def mode() -> typing.Type['EncryptMode']: - return EncryptMode - - @staticmethod - def message() -> typing.Type['Base64']: - return Base64 - - @staticmethod - def iv() -> typing.Type['Base64']: - return Base64 - __annotations__ = { - "mode": mode, - "message": message, - "iv": iv, - } - - mode: 'EncryptMode' - message: 'Base64' - - @typing.overload - def __getitem__(self, name: typing_extensions.Literal["mode"]) -> 'EncryptMode': ... - - @typing.overload - def __getitem__(self, name: typing_extensions.Literal["message"]) -> 'Base64': ... - - @typing.overload - def __getitem__(self, name: typing_extensions.Literal["iv"]) -> 'Base64': ... - - @typing.overload - def __getitem__(self, name: str) -> schemas.UnsetAnyTypeSchema: ... - - def __getitem__(self, name: typing.Union[typing_extensions.Literal["mode", "message", "iv", ], str]): - # dict_instance[name] accessor - return super().__getitem__(name) - - - @typing.overload - def get_item_oapg(self, name: typing_extensions.Literal["mode"]) -> 'EncryptMode': ... - - @typing.overload - def get_item_oapg(self, name: typing_extensions.Literal["message"]) -> 'Base64': ... - - @typing.overload - def get_item_oapg(self, name: typing_extensions.Literal["iv"]) -> typing.Union['Base64', schemas.Unset]: ... - - @typing.overload - def get_item_oapg(self, name: str) -> typing.Union[schemas.UnsetAnyTypeSchema, schemas.Unset]: ... - - def get_item_oapg(self, name: typing.Union[typing_extensions.Literal["mode", "message", "iv", ], str]): - return super().get_item_oapg(name) - - - def __new__( - cls, - *args: typing.Union[dict, frozendict.frozendict, ], - mode: 'EncryptMode', - message: 'Base64', - iv: typing.Union['Base64', schemas.Unset] = schemas.unset, - _configuration: typing.Optional[schemas.Configuration] = None, - **kwargs: typing.Union[schemas.AnyTypeSchema, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, None, list, tuple, bytes], - ) -> 'EncryptRequestData': - return super().__new__( - cls, - *args, - mode=mode, - message=message, - iv=iv, - _configuration=_configuration, - **kwargs, - ) - -from pynitrokey.nethsm.client.model.base64 import Base64 -from pynitrokey.nethsm.client.model.encrypt_mode import EncryptMode diff --git a/pynitrokey/nethsm/client/model/encrypt_request_data.pyi b/pynitrokey/nethsm/client/model/encrypt_request_data.pyi deleted file mode 100644 index 7a5b4f95..00000000 --- a/pynitrokey/nethsm/client/model/encrypt_request_data.pyi +++ /dev/null @@ -1,117 +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 encoded values are Big Endian. # noqa: E501 - - The version of the OpenAPI document: v1 - Generated by: https://openapi-generator.tech -""" - -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from pynitrokey.nethsm.client import schemas # noqa: F401 - - -class EncryptRequestData( - schemas.DictSchema -): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech - - Do not edit the class manually. - """ - - - class MetaOapg: - required = { - "mode", - "message", - } - - class properties: - - @staticmethod - def mode() -> typing.Type['EncryptMode']: - return EncryptMode - - @staticmethod - def message() -> typing.Type['Base64']: - return Base64 - - @staticmethod - def iv() -> typing.Type['Base64']: - return Base64 - __annotations__ = { - "mode": mode, - "message": message, - "iv": iv, - } - - mode: 'EncryptMode' - message: 'Base64' - - @typing.overload - def __getitem__(self, name: typing_extensions.Literal["mode"]) -> 'EncryptMode': ... - - @typing.overload - def __getitem__(self, name: typing_extensions.Literal["message"]) -> 'Base64': ... - - @typing.overload - def __getitem__(self, name: typing_extensions.Literal["iv"]) -> 'Base64': ... - - @typing.overload - def __getitem__(self, name: str) -> schemas.UnsetAnyTypeSchema: ... - - def __getitem__(self, name: typing.Union[typing_extensions.Literal["mode", "message", "iv", ], str]): - # dict_instance[name] accessor - return super().__getitem__(name) - - - @typing.overload - def get_item_oapg(self, name: typing_extensions.Literal["mode"]) -> 'EncryptMode': ... - - @typing.overload - def get_item_oapg(self, name: typing_extensions.Literal["message"]) -> 'Base64': ... - - @typing.overload - def get_item_oapg(self, name: typing_extensions.Literal["iv"]) -> typing.Union['Base64', schemas.Unset]: ... - - @typing.overload - def get_item_oapg(self, name: str) -> typing.Union[schemas.UnsetAnyTypeSchema, schemas.Unset]: ... - - def get_item_oapg(self, name: typing.Union[typing_extensions.Literal["mode", "message", "iv", ], str]): - return super().get_item_oapg(name) - - - def __new__( - cls, - *args: typing.Union[dict, frozendict.frozendict, ], - mode: 'EncryptMode', - message: 'Base64', - iv: typing.Union['Base64', schemas.Unset] = schemas.unset, - _configuration: typing.Optional[schemas.Configuration] = None, - **kwargs: typing.Union[schemas.AnyTypeSchema, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, None, list, tuple, bytes], - ) -> 'EncryptRequestData': - return super().__new__( - cls, - *args, - mode=mode, - message=message, - iv=iv, - _configuration=_configuration, - **kwargs, - ) - -from pynitrokey.nethsm.client.model.base64 import Base64 -from pynitrokey.nethsm.client.model.encrypt_mode import EncryptMode diff --git a/pynitrokey/nethsm/client/model/health_state_data.py b/pynitrokey/nethsm/client/model/health_state_data.py deleted file mode 100644 index c00fb1eb..00000000 --- a/pynitrokey/nethsm/client/model/health_state_data.py +++ /dev/null @@ -1,88 +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 encoded values are Big Endian. # noqa: E501 - - The version of the OpenAPI document: v1 - Generated by: https://openapi-generator.tech -""" - -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from pynitrokey.nethsm.client import schemas # noqa: F401 - - -class HealthStateData( - schemas.DictSchema -): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech - - Do not edit the class manually. - """ - - - class MetaOapg: - required = { - "state", - } - - class properties: - - @staticmethod - def state() -> typing.Type['SystemState']: - return SystemState - __annotations__ = { - "state": state, - } - - state: 'SystemState' - - @typing.overload - def __getitem__(self, name: typing_extensions.Literal["state"]) -> 'SystemState': ... - - @typing.overload - def __getitem__(self, name: str) -> schemas.UnsetAnyTypeSchema: ... - - def __getitem__(self, name: typing.Union[typing_extensions.Literal["state", ], str]): - # dict_instance[name] accessor - return super().__getitem__(name) - - - @typing.overload - def get_item_oapg(self, name: typing_extensions.Literal["state"]) -> 'SystemState': ... - - @typing.overload - def get_item_oapg(self, name: str) -> typing.Union[schemas.UnsetAnyTypeSchema, schemas.Unset]: ... - - def get_item_oapg(self, name: typing.Union[typing_extensions.Literal["state", ], str]): - return super().get_item_oapg(name) - - - def __new__( - cls, - *args: typing.Union[dict, frozendict.frozendict, ], - state: 'SystemState', - _configuration: typing.Optional[schemas.Configuration] = None, - **kwargs: typing.Union[schemas.AnyTypeSchema, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, None, list, tuple, bytes], - ) -> 'HealthStateData': - return super().__new__( - cls, - *args, - state=state, - _configuration=_configuration, - **kwargs, - ) - -from pynitrokey.nethsm.client.model.system_state import SystemState diff --git a/pynitrokey/nethsm/client/model/health_state_data.pyi b/pynitrokey/nethsm/client/model/health_state_data.pyi deleted file mode 100644 index c00fb1eb..00000000 --- a/pynitrokey/nethsm/client/model/health_state_data.pyi +++ /dev/null @@ -1,88 +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 encoded values are Big Endian. # noqa: E501 - - The version of the OpenAPI document: v1 - Generated by: https://openapi-generator.tech -""" - -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from pynitrokey.nethsm.client import schemas # noqa: F401 - - -class HealthStateData( - schemas.DictSchema -): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech - - Do not edit the class manually. - """ - - - class MetaOapg: - required = { - "state", - } - - class properties: - - @staticmethod - def state() -> typing.Type['SystemState']: - return SystemState - __annotations__ = { - "state": state, - } - - state: 'SystemState' - - @typing.overload - def __getitem__(self, name: typing_extensions.Literal["state"]) -> 'SystemState': ... - - @typing.overload - def __getitem__(self, name: str) -> schemas.UnsetAnyTypeSchema: ... - - def __getitem__(self, name: typing.Union[typing_extensions.Literal["state", ], str]): - # dict_instance[name] accessor - return super().__getitem__(name) - - - @typing.overload - def get_item_oapg(self, name: typing_extensions.Literal["state"]) -> 'SystemState': ... - - @typing.overload - def get_item_oapg(self, name: str) -> typing.Union[schemas.UnsetAnyTypeSchema, schemas.Unset]: ... - - def get_item_oapg(self, name: typing.Union[typing_extensions.Literal["state", ], str]): - return super().get_item_oapg(name) - - - def __new__( - cls, - *args: typing.Union[dict, frozendict.frozendict, ], - state: 'SystemState', - _configuration: typing.Optional[schemas.Configuration] = None, - **kwargs: typing.Union[schemas.AnyTypeSchema, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, None, list, tuple, bytes], - ) -> 'HealthStateData': - return super().__new__( - cls, - *args, - state=state, - _configuration=_configuration, - **kwargs, - ) - -from pynitrokey.nethsm.client.model.system_state import SystemState diff --git a/pynitrokey/nethsm/client/model/id.py b/pynitrokey/nethsm/client/model/id.py deleted file mode 100644 index a62226b2..00000000 --- a/pynitrokey/nethsm/client/model/id.py +++ /dev/null @@ -1,41 +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 encoded values are Big Endian. # noqa: E501 - - The version of the OpenAPI document: v1 - Generated by: https://openapi-generator.tech -""" - -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from pynitrokey.nethsm.client import schemas # noqa: F401 - - -class ID( - schemas.StrSchema -): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech - - Do not edit the class manually. - """ - - - class MetaOapg: - max_length = 128 - min_length = 1 - regex=[{ - 'pattern': r'^[a-zA-Z0-9]+$', # noqa: E501 - }] diff --git a/pynitrokey/nethsm/client/model/id.pyi b/pynitrokey/nethsm/client/model/id.pyi deleted file mode 100644 index c2fd137e..00000000 --- a/pynitrokey/nethsm/client/model/id.pyi +++ /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 encoded values are Big Endian. # noqa: E501 - - The version of the OpenAPI document: v1 - Generated by: https://openapi-generator.tech -""" - -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from pynitrokey.nethsm.client import schemas # noqa: F401 - - -class ID( - schemas.StrSchema -): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech - - Do not edit the class manually. - """ - pass diff --git a/pynitrokey/nethsm/client/model/info_data.py b/pynitrokey/nethsm/client/model/info_data.py deleted file mode 100644 index 2ec24bba..00000000 --- a/pynitrokey/nethsm/client/model/info_data.py +++ /dev/null @@ -1,95 +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 encoded values are Big Endian. # noqa: E501 - - The version of the OpenAPI document: v1 - Generated by: https://openapi-generator.tech -""" - -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from pynitrokey.nethsm.client import schemas # noqa: F401 - - -class InfoData( - schemas.DictSchema -): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech - - Do not edit the class manually. - """ - - - class MetaOapg: - required = { - "product", - "vendor", - } - - class properties: - vendor = schemas.StrSchema - product = schemas.StrSchema - __annotations__ = { - "vendor": vendor, - "product": product, - } - - product: MetaOapg.properties.product - vendor: MetaOapg.properties.vendor - - @typing.overload - def __getitem__(self, name: typing_extensions.Literal["vendor"]) -> MetaOapg.properties.vendor: ... - - @typing.overload - def __getitem__(self, name: typing_extensions.Literal["product"]) -> MetaOapg.properties.product: ... - - @typing.overload - def __getitem__(self, name: str) -> schemas.UnsetAnyTypeSchema: ... - - def __getitem__(self, name: typing.Union[typing_extensions.Literal["vendor", "product", ], str]): - # dict_instance[name] accessor - return super().__getitem__(name) - - - @typing.overload - def get_item_oapg(self, name: typing_extensions.Literal["vendor"]) -> MetaOapg.properties.vendor: ... - - @typing.overload - def get_item_oapg(self, name: typing_extensions.Literal["product"]) -> MetaOapg.properties.product: ... - - @typing.overload - def get_item_oapg(self, name: str) -> typing.Union[schemas.UnsetAnyTypeSchema, schemas.Unset]: ... - - def get_item_oapg(self, name: typing.Union[typing_extensions.Literal["vendor", "product", ], str]): - return super().get_item_oapg(name) - - - def __new__( - cls, - *args: typing.Union[dict, frozendict.frozendict, ], - product: typing.Union[MetaOapg.properties.product, str, ], - vendor: typing.Union[MetaOapg.properties.vendor, str, ], - _configuration: typing.Optional[schemas.Configuration] = None, - **kwargs: typing.Union[schemas.AnyTypeSchema, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, None, list, tuple, bytes], - ) -> 'InfoData': - return super().__new__( - cls, - *args, - product=product, - vendor=vendor, - _configuration=_configuration, - **kwargs, - ) diff --git a/pynitrokey/nethsm/client/model/info_data.pyi b/pynitrokey/nethsm/client/model/info_data.pyi deleted file mode 100644 index 2ec24bba..00000000 --- a/pynitrokey/nethsm/client/model/info_data.pyi +++ /dev/null @@ -1,95 +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 encoded values are Big Endian. # noqa: E501 - - The version of the OpenAPI document: v1 - Generated by: https://openapi-generator.tech -""" - -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from pynitrokey.nethsm.client import schemas # noqa: F401 - - -class InfoData( - schemas.DictSchema -): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech - - Do not edit the class manually. - """ - - - class MetaOapg: - required = { - "product", - "vendor", - } - - class properties: - vendor = schemas.StrSchema - product = schemas.StrSchema - __annotations__ = { - "vendor": vendor, - "product": product, - } - - product: MetaOapg.properties.product - vendor: MetaOapg.properties.vendor - - @typing.overload - def __getitem__(self, name: typing_extensions.Literal["vendor"]) -> MetaOapg.properties.vendor: ... - - @typing.overload - def __getitem__(self, name: typing_extensions.Literal["product"]) -> MetaOapg.properties.product: ... - - @typing.overload - def __getitem__(self, name: str) -> schemas.UnsetAnyTypeSchema: ... - - def __getitem__(self, name: typing.Union[typing_extensions.Literal["vendor", "product", ], str]): - # dict_instance[name] accessor - return super().__getitem__(name) - - - @typing.overload - def get_item_oapg(self, name: typing_extensions.Literal["vendor"]) -> MetaOapg.properties.vendor: ... - - @typing.overload - def get_item_oapg(self, name: typing_extensions.Literal["product"]) -> MetaOapg.properties.product: ... - - @typing.overload - def get_item_oapg(self, name: str) -> typing.Union[schemas.UnsetAnyTypeSchema, schemas.Unset]: ... - - def get_item_oapg(self, name: typing.Union[typing_extensions.Literal["vendor", "product", ], str]): - return super().get_item_oapg(name) - - - def __new__( - cls, - *args: typing.Union[dict, frozendict.frozendict, ], - product: typing.Union[MetaOapg.properties.product, str, ], - vendor: typing.Union[MetaOapg.properties.vendor, str, ], - _configuration: typing.Optional[schemas.Configuration] = None, - **kwargs: typing.Union[schemas.AnyTypeSchema, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, None, list, tuple, bytes], - ) -> 'InfoData': - return super().__new__( - cls, - *args, - product=product, - vendor=vendor, - _configuration=_configuration, - **kwargs, - ) diff --git a/pynitrokey/nethsm/client/model/key_generate_request_data.py b/pynitrokey/nethsm/client/model/key_generate_request_data.py deleted file mode 100644 index d9b33d91..00000000 --- a/pynitrokey/nethsm/client/model/key_generate_request_data.py +++ /dev/null @@ -1,151 +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 encoded values are Big Endian. # noqa: E501 - - The version of the OpenAPI document: v1 - Generated by: https://openapi-generator.tech -""" - -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from pynitrokey.nethsm.client import schemas # noqa: F401 - - -class KeyGenerateRequestData( - schemas.DictSchema -): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech - - Do not edit the class manually. - """ - - - class MetaOapg: - required = { - "type", - "mechanisms", - } - - class properties: - - @staticmethod - def mechanisms() -> typing.Type['KeyMechanisms']: - return KeyMechanisms - - @staticmethod - def type() -> typing.Type['KeyType']: - return KeyType - - - class length( - schemas.IntSchema - ): - - - class MetaOapg: - inclusive_maximum = 8192 - inclusive_minimum = 128 - - @staticmethod - def id() -> typing.Type['ID']: - return ID - - @staticmethod - def restrictions() -> typing.Type['KeyRestrictions']: - return KeyRestrictions - __annotations__ = { - "mechanisms": mechanisms, - "type": type, - "length": length, - "id": id, - "restrictions": restrictions, - } - - type: 'KeyType' - mechanisms: 'KeyMechanisms' - - @typing.overload - def __getitem__(self, name: typing_extensions.Literal["mechanisms"]) -> 'KeyMechanisms': ... - - @typing.overload - def __getitem__(self, name: typing_extensions.Literal["type"]) -> 'KeyType': ... - - @typing.overload - def __getitem__(self, name: typing_extensions.Literal["length"]) -> MetaOapg.properties.length: ... - - @typing.overload - def __getitem__(self, name: typing_extensions.Literal["id"]) -> 'ID': ... - - @typing.overload - def __getitem__(self, name: typing_extensions.Literal["restrictions"]) -> 'KeyRestrictions': ... - - @typing.overload - def __getitem__(self, name: str) -> schemas.UnsetAnyTypeSchema: ... - - def __getitem__(self, name: typing.Union[typing_extensions.Literal["mechanisms", "type", "length", "id", "restrictions", ], str]): - # dict_instance[name] accessor - return super().__getitem__(name) - - - @typing.overload - def get_item_oapg(self, name: typing_extensions.Literal["mechanisms"]) -> 'KeyMechanisms': ... - - @typing.overload - def get_item_oapg(self, name: typing_extensions.Literal["type"]) -> 'KeyType': ... - - @typing.overload - def get_item_oapg(self, name: typing_extensions.Literal["length"]) -> typing.Union[MetaOapg.properties.length, schemas.Unset]: ... - - @typing.overload - def get_item_oapg(self, name: typing_extensions.Literal["id"]) -> typing.Union['ID', schemas.Unset]: ... - - @typing.overload - def get_item_oapg(self, name: typing_extensions.Literal["restrictions"]) -> typing.Union['KeyRestrictions', schemas.Unset]: ... - - @typing.overload - def get_item_oapg(self, name: str) -> typing.Union[schemas.UnsetAnyTypeSchema, schemas.Unset]: ... - - def get_item_oapg(self, name: typing.Union[typing_extensions.Literal["mechanisms", "type", "length", "id", "restrictions", ], str]): - return super().get_item_oapg(name) - - - def __new__( - cls, - *args: typing.Union[dict, frozendict.frozendict, ], - type: 'KeyType', - mechanisms: 'KeyMechanisms', - length: typing.Union[MetaOapg.properties.length, decimal.Decimal, int, schemas.Unset] = schemas.unset, - id: typing.Union['ID', schemas.Unset] = schemas.unset, - restrictions: typing.Union['KeyRestrictions', schemas.Unset] = schemas.unset, - _configuration: typing.Optional[schemas.Configuration] = None, - **kwargs: typing.Union[schemas.AnyTypeSchema, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, None, list, tuple, bytes], - ) -> 'KeyGenerateRequestData': - return super().__new__( - cls, - *args, - type=type, - mechanisms=mechanisms, - length=length, - id=id, - restrictions=restrictions, - _configuration=_configuration, - **kwargs, - ) - -from pynitrokey.nethsm.client.model.id import ID -from pynitrokey.nethsm.client.model.key_mechanisms import KeyMechanisms -from pynitrokey.nethsm.client.model.key_restrictions import KeyRestrictions -from pynitrokey.nethsm.client.model.key_type import KeyType diff --git a/pynitrokey/nethsm/client/model/key_generate_request_data.pyi b/pynitrokey/nethsm/client/model/key_generate_request_data.pyi deleted file mode 100644 index c7a51eff..00000000 --- a/pynitrokey/nethsm/client/model/key_generate_request_data.pyi +++ /dev/null @@ -1,147 +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 encoded values are Big Endian. # noqa: E501 - - The version of the OpenAPI document: v1 - Generated by: https://openapi-generator.tech -""" - -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from pynitrokey.nethsm.client import schemas # noqa: F401 - - -class KeyGenerateRequestData( - schemas.DictSchema -): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech - - Do not edit the class manually. - """ - - - class MetaOapg: - required = { - "type", - "mechanisms", - } - - class properties: - - @staticmethod - def mechanisms() -> typing.Type['KeyMechanisms']: - return KeyMechanisms - - @staticmethod - def type() -> typing.Type['KeyType']: - return KeyType - - - class length( - schemas.IntSchema - ): - pass - - @staticmethod - def id() -> typing.Type['ID']: - return ID - - @staticmethod - def restrictions() -> typing.Type['KeyRestrictions']: - return KeyRestrictions - __annotations__ = { - "mechanisms": mechanisms, - "type": type, - "length": length, - "id": id, - "restrictions": restrictions, - } - - type: 'KeyType' - mechanisms: 'KeyMechanisms' - - @typing.overload - def __getitem__(self, name: typing_extensions.Literal["mechanisms"]) -> 'KeyMechanisms': ... - - @typing.overload - def __getitem__(self, name: typing_extensions.Literal["type"]) -> 'KeyType': ... - - @typing.overload - def __getitem__(self, name: typing_extensions.Literal["length"]) -> MetaOapg.properties.length: ... - - @typing.overload - def __getitem__(self, name: typing_extensions.Literal["id"]) -> 'ID': ... - - @typing.overload - def __getitem__(self, name: typing_extensions.Literal["restrictions"]) -> 'KeyRestrictions': ... - - @typing.overload - def __getitem__(self, name: str) -> schemas.UnsetAnyTypeSchema: ... - - def __getitem__(self, name: typing.Union[typing_extensions.Literal["mechanisms", "type", "length", "id", "restrictions", ], str]): - # dict_instance[name] accessor - return super().__getitem__(name) - - - @typing.overload - def get_item_oapg(self, name: typing_extensions.Literal["mechanisms"]) -> 'KeyMechanisms': ... - - @typing.overload - def get_item_oapg(self, name: typing_extensions.Literal["type"]) -> 'KeyType': ... - - @typing.overload - def get_item_oapg(self, name: typing_extensions.Literal["length"]) -> typing.Union[MetaOapg.properties.length, schemas.Unset]: ... - - @typing.overload - def get_item_oapg(self, name: typing_extensions.Literal["id"]) -> typing.Union['ID', schemas.Unset]: ... - - @typing.overload - def get_item_oapg(self, name: typing_extensions.Literal["restrictions"]) -> typing.Union['KeyRestrictions', schemas.Unset]: ... - - @typing.overload - def get_item_oapg(self, name: str) -> typing.Union[schemas.UnsetAnyTypeSchema, schemas.Unset]: ... - - def get_item_oapg(self, name: typing.Union[typing_extensions.Literal["mechanisms", "type", "length", "id", "restrictions", ], str]): - return super().get_item_oapg(name) - - - def __new__( - cls, - *args: typing.Union[dict, frozendict.frozendict, ], - type: 'KeyType', - mechanisms: 'KeyMechanisms', - length: typing.Union[MetaOapg.properties.length, decimal.Decimal, int, schemas.Unset] = schemas.unset, - id: typing.Union['ID', schemas.Unset] = schemas.unset, - restrictions: typing.Union['KeyRestrictions', schemas.Unset] = schemas.unset, - _configuration: typing.Optional[schemas.Configuration] = None, - **kwargs: typing.Union[schemas.AnyTypeSchema, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, None, list, tuple, bytes], - ) -> 'KeyGenerateRequestData': - return super().__new__( - cls, - *args, - type=type, - mechanisms=mechanisms, - length=length, - id=id, - restrictions=restrictions, - _configuration=_configuration, - **kwargs, - ) - -from pynitrokey.nethsm.client.model.id import ID -from pynitrokey.nethsm.client.model.key_mechanisms import KeyMechanisms -from pynitrokey.nethsm.client.model.key_restrictions import KeyRestrictions -from pynitrokey.nethsm.client.model.key_type import KeyType diff --git a/pynitrokey/nethsm/client/model/key_item.py b/pynitrokey/nethsm/client/model/key_item.py deleted file mode 100644 index 83f70e3a..00000000 --- a/pynitrokey/nethsm/client/model/key_item.py +++ /dev/null @@ -1,88 +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 encoded values are Big Endian. # noqa: E501 - - The version of the OpenAPI document: v1 - Generated by: https://openapi-generator.tech -""" - -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from pynitrokey.nethsm.client import schemas # noqa: F401 - - -class KeyItem( - schemas.DictSchema -): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech - - Do not edit the class manually. - """ - - - class MetaOapg: - required = { - "key", - } - - class properties: - - @staticmethod - def key() -> typing.Type['ID']: - return ID - __annotations__ = { - "key": key, - } - - key: 'ID' - - @typing.overload - def __getitem__(self, name: typing_extensions.Literal["key"]) -> 'ID': ... - - @typing.overload - def __getitem__(self, name: str) -> schemas.UnsetAnyTypeSchema: ... - - def __getitem__(self, name: typing.Union[typing_extensions.Literal["key", ], str]): - # dict_instance[name] accessor - return super().__getitem__(name) - - - @typing.overload - def get_item_oapg(self, name: typing_extensions.Literal["key"]) -> 'ID': ... - - @typing.overload - def get_item_oapg(self, name: str) -> typing.Union[schemas.UnsetAnyTypeSchema, schemas.Unset]: ... - - def get_item_oapg(self, name: typing.Union[typing_extensions.Literal["key", ], str]): - return super().get_item_oapg(name) - - - def __new__( - cls, - *args: typing.Union[dict, frozendict.frozendict, ], - key: 'ID', - _configuration: typing.Optional[schemas.Configuration] = None, - **kwargs: typing.Union[schemas.AnyTypeSchema, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, None, list, tuple, bytes], - ) -> 'KeyItem': - return super().__new__( - cls, - *args, - key=key, - _configuration=_configuration, - **kwargs, - ) - -from pynitrokey.nethsm.client.model.id import ID diff --git a/pynitrokey/nethsm/client/model/key_item.pyi b/pynitrokey/nethsm/client/model/key_item.pyi deleted file mode 100644 index 83f70e3a..00000000 --- a/pynitrokey/nethsm/client/model/key_item.pyi +++ /dev/null @@ -1,88 +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 encoded values are Big Endian. # noqa: E501 - - The version of the OpenAPI document: v1 - Generated by: https://openapi-generator.tech -""" - -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from pynitrokey.nethsm.client import schemas # noqa: F401 - - -class KeyItem( - schemas.DictSchema -): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech - - Do not edit the class manually. - """ - - - class MetaOapg: - required = { - "key", - } - - class properties: - - @staticmethod - def key() -> typing.Type['ID']: - return ID - __annotations__ = { - "key": key, - } - - key: 'ID' - - @typing.overload - def __getitem__(self, name: typing_extensions.Literal["key"]) -> 'ID': ... - - @typing.overload - def __getitem__(self, name: str) -> schemas.UnsetAnyTypeSchema: ... - - def __getitem__(self, name: typing.Union[typing_extensions.Literal["key", ], str]): - # dict_instance[name] accessor - return super().__getitem__(name) - - - @typing.overload - def get_item_oapg(self, name: typing_extensions.Literal["key"]) -> 'ID': ... - - @typing.overload - def get_item_oapg(self, name: str) -> typing.Union[schemas.UnsetAnyTypeSchema, schemas.Unset]: ... - - def get_item_oapg(self, name: typing.Union[typing_extensions.Literal["key", ], str]): - return super().get_item_oapg(name) - - - def __new__( - cls, - *args: typing.Union[dict, frozendict.frozendict, ], - key: 'ID', - _configuration: typing.Optional[schemas.Configuration] = None, - **kwargs: typing.Union[schemas.AnyTypeSchema, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, None, list, tuple, bytes], - ) -> 'KeyItem': - return super().__new__( - cls, - *args, - key=key, - _configuration=_configuration, - **kwargs, - ) - -from pynitrokey.nethsm.client.model.id import ID diff --git a/pynitrokey/nethsm/client/model/key_list.py b/pynitrokey/nethsm/client/model/key_list.py deleted file mode 100644 index f4ca6084..00000000 --- a/pynitrokey/nethsm/client/model/key_list.py +++ /dev/null @@ -1,56 +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 encoded values are Big Endian. # noqa: E501 - - The version of the OpenAPI document: v1 - Generated by: https://openapi-generator.tech -""" - -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from pynitrokey.nethsm.client import schemas # noqa: F401 - - -class KeyList( - schemas.ListSchema -): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech - - Do not edit the class manually. - """ - - - class MetaOapg: - - @staticmethod - def items() -> typing.Type['KeyItem']: - return KeyItem - - def __new__( - cls, - arg: typing.Union[typing.Tuple['KeyItem'], typing.List['KeyItem']], - _configuration: typing.Optional[schemas.Configuration] = None, - ) -> 'KeyList': - return super().__new__( - cls, - arg, - _configuration=_configuration, - ) - - def __getitem__(self, i: int) -> 'KeyItem': - return super().__getitem__(i) - -from pynitrokey.nethsm.client.model.key_item import KeyItem diff --git a/pynitrokey/nethsm/client/model/key_list.pyi b/pynitrokey/nethsm/client/model/key_list.pyi deleted file mode 100644 index f4ca6084..00000000 --- a/pynitrokey/nethsm/client/model/key_list.pyi +++ /dev/null @@ -1,56 +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 encoded values are Big Endian. # noqa: E501 - - The version of the OpenAPI document: v1 - Generated by: https://openapi-generator.tech -""" - -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from pynitrokey.nethsm.client import schemas # noqa: F401 - - -class KeyList( - schemas.ListSchema -): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech - - Do not edit the class manually. - """ - - - class MetaOapg: - - @staticmethod - def items() -> typing.Type['KeyItem']: - return KeyItem - - def __new__( - cls, - arg: typing.Union[typing.Tuple['KeyItem'], typing.List['KeyItem']], - _configuration: typing.Optional[schemas.Configuration] = None, - ) -> 'KeyList': - return super().__new__( - cls, - arg, - _configuration=_configuration, - ) - - def __getitem__(self, i: int) -> 'KeyItem': - return super().__getitem__(i) - -from pynitrokey.nethsm.client.model.key_item import KeyItem diff --git a/pynitrokey/nethsm/client/model/key_mechanism.py b/pynitrokey/nethsm/client/model/key_mechanism.py deleted file mode 100644 index b1967165..00000000 --- a/pynitrokey/nethsm/client/model/key_mechanism.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 encoded values are Big Endian. # noqa: E501 - - The version of the OpenAPI document: v1 - Generated by: https://openapi-generator.tech -""" - -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from pynitrokey.nethsm.client import schemas # noqa: F401 - - -class KeyMechanism( - schemas.EnumBase, - schemas.StrSchema -): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech - - Do not edit the class manually. - """ - - - class MetaOapg: - enum_value_to_name = { - "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", - } - - @schemas.classproperty - def RSA_DECRYPTION_RAW(cls): - return cls("RSA_Decryption_RAW") - - @schemas.classproperty - def RSA_DECRYPTION_PKCS1(cls): - return cls("RSA_Decryption_PKCS1") - - @schemas.classproperty - def RSA_DECRYPTION_OAEP_MD5(cls): - return cls("RSA_Decryption_OAEP_MD5") - - @schemas.classproperty - def RSA_DECRYPTION_OAEP_SHA1(cls): - return cls("RSA_Decryption_OAEP_SHA1") - - @schemas.classproperty - def RSA_DECRYPTION_OAEP_SHA224(cls): - return cls("RSA_Decryption_OAEP_SHA224") - - @schemas.classproperty - def RSA_DECRYPTION_OAEP_SHA256(cls): - return cls("RSA_Decryption_OAEP_SHA256") - - @schemas.classproperty - def RSA_DECRYPTION_OAEP_SHA384(cls): - return cls("RSA_Decryption_OAEP_SHA384") - - @schemas.classproperty - def RSA_DECRYPTION_OAEP_SHA512(cls): - return cls("RSA_Decryption_OAEP_SHA512") - - @schemas.classproperty - def RSA_SIGNATURE_PKCS1(cls): - return cls("RSA_Signature_PKCS1") - - @schemas.classproperty - def RSA_SIGNATURE_PSS_MD5(cls): - return cls("RSA_Signature_PSS_MD5") - - @schemas.classproperty - def RSA_SIGNATURE_PSS_SHA1(cls): - return cls("RSA_Signature_PSS_SHA1") - - @schemas.classproperty - def RSA_SIGNATURE_PSS_SHA224(cls): - return cls("RSA_Signature_PSS_SHA224") - - @schemas.classproperty - def RSA_SIGNATURE_PSS_SHA256(cls): - return cls("RSA_Signature_PSS_SHA256") - - @schemas.classproperty - def RSA_SIGNATURE_PSS_SHA384(cls): - return cls("RSA_Signature_PSS_SHA384") - - @schemas.classproperty - def RSA_SIGNATURE_PSS_SHA512(cls): - return cls("RSA_Signature_PSS_SHA512") - - @schemas.classproperty - def ED_DSA_SIGNATURE(cls): - return cls("EdDSA_Signature") - - @schemas.classproperty - def ECDSA_SIGNATURE(cls): - return cls("ECDSA_Signature") - - @schemas.classproperty - def AES_ENCRYPTION_CBC(cls): - return cls("AES_Encryption_CBC") - - @schemas.classproperty - def AES_DECRYPTION_CBC(cls): - return cls("AES_Decryption_CBC") diff --git a/pynitrokey/nethsm/client/model/key_mechanism.pyi b/pynitrokey/nethsm/client/model/key_mechanism.pyi deleted file mode 100644 index 3036b4bb..00000000 --- a/pynitrokey/nethsm/client/model/key_mechanism.pyi +++ /dev/null @@ -1,110 +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 encoded values are Big Endian. # noqa: E501 - - The version of the OpenAPI document: v1 - Generated by: https://openapi-generator.tech -""" - -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from pynitrokey.nethsm.client import schemas # noqa: F401 - - -class KeyMechanism( - schemas.EnumBase, - schemas.StrSchema -): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech - - Do not edit the class manually. - """ - - @schemas.classproperty - def RSA_DECRYPTION_RAW(cls): - return cls("RSA_Decryption_RAW") - - @schemas.classproperty - def RSA_DECRYPTION_PKCS1(cls): - return cls("RSA_Decryption_PKCS1") - - @schemas.classproperty - def RSA_DECRYPTION_OAEP_MD5(cls): - return cls("RSA_Decryption_OAEP_MD5") - - @schemas.classproperty - def RSA_DECRYPTION_OAEP_SHA1(cls): - return cls("RSA_Decryption_OAEP_SHA1") - - @schemas.classproperty - def RSA_DECRYPTION_OAEP_SHA224(cls): - return cls("RSA_Decryption_OAEP_SHA224") - - @schemas.classproperty - def RSA_DECRYPTION_OAEP_SHA256(cls): - return cls("RSA_Decryption_OAEP_SHA256") - - @schemas.classproperty - def RSA_DECRYPTION_OAEP_SHA384(cls): - return cls("RSA_Decryption_OAEP_SHA384") - - @schemas.classproperty - def RSA_DECRYPTION_OAEP_SHA512(cls): - return cls("RSA_Decryption_OAEP_SHA512") - - @schemas.classproperty - def RSA_SIGNATURE_PKCS1(cls): - return cls("RSA_Signature_PKCS1") - - @schemas.classproperty - def RSA_SIGNATURE_PSS_MD5(cls): - return cls("RSA_Signature_PSS_MD5") - - @schemas.classproperty - def RSA_SIGNATURE_PSS_SHA1(cls): - return cls("RSA_Signature_PSS_SHA1") - - @schemas.classproperty - def RSA_SIGNATURE_PSS_SHA224(cls): - return cls("RSA_Signature_PSS_SHA224") - - @schemas.classproperty - def RSA_SIGNATURE_PSS_SHA256(cls): - return cls("RSA_Signature_PSS_SHA256") - - @schemas.classproperty - def RSA_SIGNATURE_PSS_SHA384(cls): - return cls("RSA_Signature_PSS_SHA384") - - @schemas.classproperty - def RSA_SIGNATURE_PSS_SHA512(cls): - return cls("RSA_Signature_PSS_SHA512") - - @schemas.classproperty - def ED_DSA_SIGNATURE(cls): - return cls("EdDSA_Signature") - - @schemas.classproperty - def ECDSA_SIGNATURE(cls): - return cls("ECDSA_Signature") - - @schemas.classproperty - def AES_ENCRYPTION_CBC(cls): - return cls("AES_Encryption_CBC") - - @schemas.classproperty - def AES_DECRYPTION_CBC(cls): - return cls("AES_Decryption_CBC") diff --git a/pynitrokey/nethsm/client/model/key_mechanisms.py b/pynitrokey/nethsm/client/model/key_mechanisms.py deleted file mode 100644 index c3774a23..00000000 --- a/pynitrokey/nethsm/client/model/key_mechanisms.py +++ /dev/null @@ -1,56 +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 encoded values are Big Endian. # noqa: E501 - - The version of the OpenAPI document: v1 - Generated by: https://openapi-generator.tech -""" - -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from pynitrokey.nethsm.client import schemas # noqa: F401 - - -class KeyMechanisms( - schemas.ListSchema -): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech - - Do not edit the class manually. - """ - - - class MetaOapg: - - @staticmethod - def items() -> typing.Type['KeyMechanism']: - return KeyMechanism - - def __new__( - cls, - arg: typing.Union[typing.Tuple['KeyMechanism'], typing.List['KeyMechanism']], - _configuration: typing.Optional[schemas.Configuration] = None, - ) -> 'KeyMechanisms': - return super().__new__( - cls, - arg, - _configuration=_configuration, - ) - - def __getitem__(self, i: int) -> 'KeyMechanism': - return super().__getitem__(i) - -from pynitrokey.nethsm.client.model.key_mechanism import KeyMechanism diff --git a/pynitrokey/nethsm/client/model/key_mechanisms.pyi b/pynitrokey/nethsm/client/model/key_mechanisms.pyi deleted file mode 100644 index c3774a23..00000000 --- a/pynitrokey/nethsm/client/model/key_mechanisms.pyi +++ /dev/null @@ -1,56 +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 encoded values are Big Endian. # noqa: E501 - - The version of the OpenAPI document: v1 - Generated by: https://openapi-generator.tech -""" - -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from pynitrokey.nethsm.client import schemas # noqa: F401 - - -class KeyMechanisms( - schemas.ListSchema -): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech - - Do not edit the class manually. - """ - - - class MetaOapg: - - @staticmethod - def items() -> typing.Type['KeyMechanism']: - return KeyMechanism - - def __new__( - cls, - arg: typing.Union[typing.Tuple['KeyMechanism'], typing.List['KeyMechanism']], - _configuration: typing.Optional[schemas.Configuration] = None, - ) -> 'KeyMechanisms': - return super().__new__( - cls, - arg, - _configuration=_configuration, - ) - - def __getitem__(self, i: int) -> 'KeyMechanism': - return super().__getitem__(i) - -from pynitrokey.nethsm.client.model.key_mechanism import KeyMechanism diff --git a/pynitrokey/nethsm/client/model/key_private_data.py b/pynitrokey/nethsm/client/model/key_private_data.py deleted file mode 100644 index 6d02577f..00000000 --- a/pynitrokey/nethsm/client/model/key_private_data.py +++ /dev/null @@ -1,122 +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 encoded values are Big Endian. # noqa: E501 - - The version of the OpenAPI document: v1 - Generated by: https://openapi-generator.tech -""" - -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from pynitrokey.nethsm.client import schemas # noqa: F401 - - -class KeyPrivateData( - schemas.DictSchema -): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech - - Do not edit the class manually. - """ - - - class MetaOapg: - - class properties: - - @staticmethod - def primeP() -> typing.Type['Base64']: - return Base64 - - @staticmethod - def primeQ() -> typing.Type['Base64']: - return Base64 - - @staticmethod - def publicExponent() -> typing.Type['Base64']: - return Base64 - - @staticmethod - def data() -> typing.Type['Base64']: - return Base64 - __annotations__ = { - "primeP": primeP, - "primeQ": primeQ, - "publicExponent": publicExponent, - "data": data, - } - - @typing.overload - def __getitem__(self, name: typing_extensions.Literal["primeP"]) -> 'Base64': ... - - @typing.overload - def __getitem__(self, name: typing_extensions.Literal["primeQ"]) -> 'Base64': ... - - @typing.overload - def __getitem__(self, name: typing_extensions.Literal["publicExponent"]) -> 'Base64': ... - - @typing.overload - def __getitem__(self, name: typing_extensions.Literal["data"]) -> 'Base64': ... - - @typing.overload - def __getitem__(self, name: str) -> schemas.UnsetAnyTypeSchema: ... - - def __getitem__(self, name: typing.Union[typing_extensions.Literal["primeP", "primeQ", "publicExponent", "data", ], str]): - # dict_instance[name] accessor - return super().__getitem__(name) - - - @typing.overload - def get_item_oapg(self, name: typing_extensions.Literal["primeP"]) -> typing.Union['Base64', schemas.Unset]: ... - - @typing.overload - def get_item_oapg(self, name: typing_extensions.Literal["primeQ"]) -> typing.Union['Base64', schemas.Unset]: ... - - @typing.overload - def get_item_oapg(self, name: typing_extensions.Literal["publicExponent"]) -> typing.Union['Base64', schemas.Unset]: ... - - @typing.overload - def get_item_oapg(self, name: typing_extensions.Literal["data"]) -> typing.Union['Base64', schemas.Unset]: ... - - @typing.overload - def get_item_oapg(self, name: str) -> typing.Union[schemas.UnsetAnyTypeSchema, schemas.Unset]: ... - - def get_item_oapg(self, name: typing.Union[typing_extensions.Literal["primeP", "primeQ", "publicExponent", "data", ], str]): - return super().get_item_oapg(name) - - - def __new__( - cls, - *args: typing.Union[dict, frozendict.frozendict, ], - primeP: typing.Union['Base64', schemas.Unset] = schemas.unset, - primeQ: typing.Union['Base64', schemas.Unset] = schemas.unset, - publicExponent: typing.Union['Base64', schemas.Unset] = schemas.unset, - data: typing.Union['Base64', schemas.Unset] = schemas.unset, - _configuration: typing.Optional[schemas.Configuration] = None, - **kwargs: typing.Union[schemas.AnyTypeSchema, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, None, list, tuple, bytes], - ) -> 'KeyPrivateData': - return super().__new__( - cls, - *args, - primeP=primeP, - primeQ=primeQ, - publicExponent=publicExponent, - data=data, - _configuration=_configuration, - **kwargs, - ) - -from pynitrokey.nethsm.client.model.base64 import Base64 diff --git a/pynitrokey/nethsm/client/model/key_private_data.pyi b/pynitrokey/nethsm/client/model/key_private_data.pyi deleted file mode 100644 index 6d02577f..00000000 --- a/pynitrokey/nethsm/client/model/key_private_data.pyi +++ /dev/null @@ -1,122 +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 encoded values are Big Endian. # noqa: E501 - - The version of the OpenAPI document: v1 - Generated by: https://openapi-generator.tech -""" - -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from pynitrokey.nethsm.client import schemas # noqa: F401 - - -class KeyPrivateData( - schemas.DictSchema -): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech - - Do not edit the class manually. - """ - - - class MetaOapg: - - class properties: - - @staticmethod - def primeP() -> typing.Type['Base64']: - return Base64 - - @staticmethod - def primeQ() -> typing.Type['Base64']: - return Base64 - - @staticmethod - def publicExponent() -> typing.Type['Base64']: - return Base64 - - @staticmethod - def data() -> typing.Type['Base64']: - return Base64 - __annotations__ = { - "primeP": primeP, - "primeQ": primeQ, - "publicExponent": publicExponent, - "data": data, - } - - @typing.overload - def __getitem__(self, name: typing_extensions.Literal["primeP"]) -> 'Base64': ... - - @typing.overload - def __getitem__(self, name: typing_extensions.Literal["primeQ"]) -> 'Base64': ... - - @typing.overload - def __getitem__(self, name: typing_extensions.Literal["publicExponent"]) -> 'Base64': ... - - @typing.overload - def __getitem__(self, name: typing_extensions.Literal["data"]) -> 'Base64': ... - - @typing.overload - def __getitem__(self, name: str) -> schemas.UnsetAnyTypeSchema: ... - - def __getitem__(self, name: typing.Union[typing_extensions.Literal["primeP", "primeQ", "publicExponent", "data", ], str]): - # dict_instance[name] accessor - return super().__getitem__(name) - - - @typing.overload - def get_item_oapg(self, name: typing_extensions.Literal["primeP"]) -> typing.Union['Base64', schemas.Unset]: ... - - @typing.overload - def get_item_oapg(self, name: typing_extensions.Literal["primeQ"]) -> typing.Union['Base64', schemas.Unset]: ... - - @typing.overload - def get_item_oapg(self, name: typing_extensions.Literal["publicExponent"]) -> typing.Union['Base64', schemas.Unset]: ... - - @typing.overload - def get_item_oapg(self, name: typing_extensions.Literal["data"]) -> typing.Union['Base64', schemas.Unset]: ... - - @typing.overload - def get_item_oapg(self, name: str) -> typing.Union[schemas.UnsetAnyTypeSchema, schemas.Unset]: ... - - def get_item_oapg(self, name: typing.Union[typing_extensions.Literal["primeP", "primeQ", "publicExponent", "data", ], str]): - return super().get_item_oapg(name) - - - def __new__( - cls, - *args: typing.Union[dict, frozendict.frozendict, ], - primeP: typing.Union['Base64', schemas.Unset] = schemas.unset, - primeQ: typing.Union['Base64', schemas.Unset] = schemas.unset, - publicExponent: typing.Union['Base64', schemas.Unset] = schemas.unset, - data: typing.Union['Base64', schemas.Unset] = schemas.unset, - _configuration: typing.Optional[schemas.Configuration] = None, - **kwargs: typing.Union[schemas.AnyTypeSchema, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, None, list, tuple, bytes], - ) -> 'KeyPrivateData': - return super().__new__( - cls, - *args, - primeP=primeP, - primeQ=primeQ, - publicExponent=publicExponent, - data=data, - _configuration=_configuration, - **kwargs, - ) - -from pynitrokey.nethsm.client.model.base64 import Base64 diff --git a/pynitrokey/nethsm/client/model/key_public_data.py b/pynitrokey/nethsm/client/model/key_public_data.py deleted file mode 100644 index 8aa558e2..00000000 --- a/pynitrokey/nethsm/client/model/key_public_data.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 encoded values are Big Endian. # noqa: E501 - - The version of the OpenAPI document: v1 - Generated by: https://openapi-generator.tech -""" - -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from pynitrokey.nethsm.client import schemas # noqa: F401 - - -class KeyPublicData( - schemas.DictSchema -): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech - - Do not edit the class manually. - """ - - - class MetaOapg: - - class properties: - - @staticmethod - def modulus() -> typing.Type['Base64']: - return Base64 - - @staticmethod - def publicExponent() -> typing.Type['Base64']: - return Base64 - - @staticmethod - def data() -> typing.Type['Base64']: - return Base64 - __annotations__ = { - "modulus": modulus, - "publicExponent": publicExponent, - "data": data, - } - - @typing.overload - def __getitem__(self, name: typing_extensions.Literal["modulus"]) -> 'Base64': ... - - @typing.overload - def __getitem__(self, name: typing_extensions.Literal["publicExponent"]) -> 'Base64': ... - - @typing.overload - def __getitem__(self, name: typing_extensions.Literal["data"]) -> 'Base64': ... - - @typing.overload - def __getitem__(self, name: str) -> schemas.UnsetAnyTypeSchema: ... - - def __getitem__(self, name: typing.Union[typing_extensions.Literal["modulus", "publicExponent", "data", ], str]): - # dict_instance[name] accessor - return super().__getitem__(name) - - - @typing.overload - def get_item_oapg(self, name: typing_extensions.Literal["modulus"]) -> typing.Union['Base64', schemas.Unset]: ... - - @typing.overload - def get_item_oapg(self, name: typing_extensions.Literal["publicExponent"]) -> typing.Union['Base64', schemas.Unset]: ... - - @typing.overload - def get_item_oapg(self, name: typing_extensions.Literal["data"]) -> typing.Union['Base64', schemas.Unset]: ... - - @typing.overload - def get_item_oapg(self, name: str) -> typing.Union[schemas.UnsetAnyTypeSchema, schemas.Unset]: ... - - def get_item_oapg(self, name: typing.Union[typing_extensions.Literal["modulus", "publicExponent", "data", ], str]): - return super().get_item_oapg(name) - - - def __new__( - cls, - *args: typing.Union[dict, frozendict.frozendict, ], - modulus: typing.Union['Base64', schemas.Unset] = schemas.unset, - publicExponent: typing.Union['Base64', schemas.Unset] = schemas.unset, - data: typing.Union['Base64', schemas.Unset] = schemas.unset, - _configuration: typing.Optional[schemas.Configuration] = None, - **kwargs: typing.Union[schemas.AnyTypeSchema, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, None, list, tuple, bytes], - ) -> 'KeyPublicData': - return super().__new__( - cls, - *args, - modulus=modulus, - publicExponent=publicExponent, - data=data, - _configuration=_configuration, - **kwargs, - ) - -from pynitrokey.nethsm.client.model.base64 import Base64 diff --git a/pynitrokey/nethsm/client/model/key_public_data.pyi b/pynitrokey/nethsm/client/model/key_public_data.pyi deleted file mode 100644 index 8aa558e2..00000000 --- a/pynitrokey/nethsm/client/model/key_public_data.pyi +++ /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 encoded values are Big Endian. # noqa: E501 - - The version of the OpenAPI document: v1 - Generated by: https://openapi-generator.tech -""" - -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from pynitrokey.nethsm.client import schemas # noqa: F401 - - -class KeyPublicData( - schemas.DictSchema -): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech - - Do not edit the class manually. - """ - - - class MetaOapg: - - class properties: - - @staticmethod - def modulus() -> typing.Type['Base64']: - return Base64 - - @staticmethod - def publicExponent() -> typing.Type['Base64']: - return Base64 - - @staticmethod - def data() -> typing.Type['Base64']: - return Base64 - __annotations__ = { - "modulus": modulus, - "publicExponent": publicExponent, - "data": data, - } - - @typing.overload - def __getitem__(self, name: typing_extensions.Literal["modulus"]) -> 'Base64': ... - - @typing.overload - def __getitem__(self, name: typing_extensions.Literal["publicExponent"]) -> 'Base64': ... - - @typing.overload - def __getitem__(self, name: typing_extensions.Literal["data"]) -> 'Base64': ... - - @typing.overload - def __getitem__(self, name: str) -> schemas.UnsetAnyTypeSchema: ... - - def __getitem__(self, name: typing.Union[typing_extensions.Literal["modulus", "publicExponent", "data", ], str]): - # dict_instance[name] accessor - return super().__getitem__(name) - - - @typing.overload - def get_item_oapg(self, name: typing_extensions.Literal["modulus"]) -> typing.Union['Base64', schemas.Unset]: ... - - @typing.overload - def get_item_oapg(self, name: typing_extensions.Literal["publicExponent"]) -> typing.Union['Base64', schemas.Unset]: ... - - @typing.overload - def get_item_oapg(self, name: typing_extensions.Literal["data"]) -> typing.Union['Base64', schemas.Unset]: ... - - @typing.overload - def get_item_oapg(self, name: str) -> typing.Union[schemas.UnsetAnyTypeSchema, schemas.Unset]: ... - - def get_item_oapg(self, name: typing.Union[typing_extensions.Literal["modulus", "publicExponent", "data", ], str]): - return super().get_item_oapg(name) - - - def __new__( - cls, - *args: typing.Union[dict, frozendict.frozendict, ], - modulus: typing.Union['Base64', schemas.Unset] = schemas.unset, - publicExponent: typing.Union['Base64', schemas.Unset] = schemas.unset, - data: typing.Union['Base64', schemas.Unset] = schemas.unset, - _configuration: typing.Optional[schemas.Configuration] = None, - **kwargs: typing.Union[schemas.AnyTypeSchema, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, None, list, tuple, bytes], - ) -> 'KeyPublicData': - return super().__new__( - cls, - *args, - modulus=modulus, - publicExponent=publicExponent, - data=data, - _configuration=_configuration, - **kwargs, - ) - -from pynitrokey.nethsm.client.model.base64 import Base64 diff --git a/pynitrokey/nethsm/client/model/key_restrictions.py b/pynitrokey/nethsm/client/model/key_restrictions.py deleted file mode 100644 index d20e9323..00000000 --- a/pynitrokey/nethsm/client/model/key_restrictions.py +++ /dev/null @@ -1,83 +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 encoded values are Big Endian. # noqa: E501 - - The version of the OpenAPI document: v1 - Generated by: https://openapi-generator.tech -""" - -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from pynitrokey.nethsm.client import schemas # noqa: F401 - - -class KeyRestrictions( - schemas.DictSchema -): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech - - Do not edit the class manually. - """ - - - class MetaOapg: - - class properties: - - @staticmethod - def tags() -> typing.Type['TagList']: - return TagList - __annotations__ = { - "tags": tags, - } - - @typing.overload - def __getitem__(self, name: typing_extensions.Literal["tags"]) -> 'TagList': ... - - @typing.overload - def __getitem__(self, name: str) -> schemas.UnsetAnyTypeSchema: ... - - def __getitem__(self, name: typing.Union[typing_extensions.Literal["tags", ], str]): - # dict_instance[name] accessor - return super().__getitem__(name) - - - @typing.overload - def get_item_oapg(self, name: typing_extensions.Literal["tags"]) -> typing.Union['TagList', schemas.Unset]: ... - - @typing.overload - def get_item_oapg(self, name: str) -> typing.Union[schemas.UnsetAnyTypeSchema, schemas.Unset]: ... - - def get_item_oapg(self, name: typing.Union[typing_extensions.Literal["tags", ], str]): - return super().get_item_oapg(name) - - - def __new__( - cls, - *args: typing.Union[dict, frozendict.frozendict, ], - tags: typing.Union['TagList', schemas.Unset] = schemas.unset, - _configuration: typing.Optional[schemas.Configuration] = None, - **kwargs: typing.Union[schemas.AnyTypeSchema, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, None, list, tuple, bytes], - ) -> 'KeyRestrictions': - return super().__new__( - cls, - *args, - tags=tags, - _configuration=_configuration, - **kwargs, - ) - -from pynitrokey.nethsm.client.model.tag_list import TagList diff --git a/pynitrokey/nethsm/client/model/key_restrictions.pyi b/pynitrokey/nethsm/client/model/key_restrictions.pyi deleted file mode 100644 index d20e9323..00000000 --- a/pynitrokey/nethsm/client/model/key_restrictions.pyi +++ /dev/null @@ -1,83 +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 encoded values are Big Endian. # noqa: E501 - - The version of the OpenAPI document: v1 - Generated by: https://openapi-generator.tech -""" - -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from pynitrokey.nethsm.client import schemas # noqa: F401 - - -class KeyRestrictions( - schemas.DictSchema -): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech - - Do not edit the class manually. - """ - - - class MetaOapg: - - class properties: - - @staticmethod - def tags() -> typing.Type['TagList']: - return TagList - __annotations__ = { - "tags": tags, - } - - @typing.overload - def __getitem__(self, name: typing_extensions.Literal["tags"]) -> 'TagList': ... - - @typing.overload - def __getitem__(self, name: str) -> schemas.UnsetAnyTypeSchema: ... - - def __getitem__(self, name: typing.Union[typing_extensions.Literal["tags", ], str]): - # dict_instance[name] accessor - return super().__getitem__(name) - - - @typing.overload - def get_item_oapg(self, name: typing_extensions.Literal["tags"]) -> typing.Union['TagList', schemas.Unset]: ... - - @typing.overload - def get_item_oapg(self, name: str) -> typing.Union[schemas.UnsetAnyTypeSchema, schemas.Unset]: ... - - def get_item_oapg(self, name: typing.Union[typing_extensions.Literal["tags", ], str]): - return super().get_item_oapg(name) - - - def __new__( - cls, - *args: typing.Union[dict, frozendict.frozendict, ], - tags: typing.Union['TagList', schemas.Unset] = schemas.unset, - _configuration: typing.Optional[schemas.Configuration] = None, - **kwargs: typing.Union[schemas.AnyTypeSchema, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, None, list, tuple, bytes], - ) -> 'KeyRestrictions': - return super().__new__( - cls, - *args, - tags=tags, - _configuration=_configuration, - **kwargs, - ) - -from pynitrokey.nethsm.client.model.tag_list import TagList diff --git a/pynitrokey/nethsm/client/model/key_type.py b/pynitrokey/nethsm/client/model/key_type.py deleted file mode 100644 index 25a38c38..00000000 --- a/pynitrokey/nethsm/client/model/key_type.py +++ /dev/null @@ -1,74 +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 encoded values are Big Endian. # noqa: E501 - - The version of the OpenAPI document: v1 - Generated by: https://openapi-generator.tech -""" - -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from pynitrokey.nethsm.client import schemas # noqa: F401 - - -class KeyType( - schemas.EnumBase, - schemas.StrSchema -): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech - - Do not edit the class manually. - """ - - - class MetaOapg: - enum_value_to_name = { - "RSA": "RSA", - "Curve25519": "CURVE25519", - "EC_P224": "EC_P224", - "EC_P256": "EC_P256", - "EC_P384": "EC_P384", - "EC_P521": "EC_P521", - "Generic": "GENERIC", - } - - @schemas.classproperty - def RSA(cls): - return cls("RSA") - - @schemas.classproperty - def CURVE25519(cls): - return cls("Curve25519") - - @schemas.classproperty - def EC_P224(cls): - return cls("EC_P224") - - @schemas.classproperty - def EC_P256(cls): - return cls("EC_P256") - - @schemas.classproperty - def EC_P384(cls): - return cls("EC_P384") - - @schemas.classproperty - def EC_P521(cls): - return cls("EC_P521") - - @schemas.classproperty - def GENERIC(cls): - return cls("Generic") diff --git a/pynitrokey/nethsm/client/model/key_type.pyi b/pynitrokey/nethsm/client/model/key_type.pyi deleted file mode 100644 index ac3d7010..00000000 --- a/pynitrokey/nethsm/client/model/key_type.pyi +++ /dev/null @@ -1,62 +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 encoded values are Big Endian. # noqa: E501 - - The version of the OpenAPI document: v1 - Generated by: https://openapi-generator.tech -""" - -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from pynitrokey.nethsm.client import schemas # noqa: F401 - - -class KeyType( - schemas.EnumBase, - schemas.StrSchema -): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech - - Do not edit the class manually. - """ - - @schemas.classproperty - def RSA(cls): - return cls("RSA") - - @schemas.classproperty - def CURVE25519(cls): - return cls("Curve25519") - - @schemas.classproperty - def EC_P224(cls): - return cls("EC_P224") - - @schemas.classproperty - def EC_P256(cls): - return cls("EC_P256") - - @schemas.classproperty - def EC_P384(cls): - return cls("EC_P384") - - @schemas.classproperty - def EC_P521(cls): - return cls("EC_P521") - - @schemas.classproperty - def GENERIC(cls): - return cls("Generic") diff --git a/pynitrokey/nethsm/client/model/log_level.py b/pynitrokey/nethsm/client/model/log_level.py deleted file mode 100644 index 715f4f81..00000000 --- a/pynitrokey/nethsm/client/model/log_level.py +++ /dev/null @@ -1,59 +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 encoded values are Big Endian. # noqa: E501 - - The version of the OpenAPI document: v1 - Generated by: https://openapi-generator.tech -""" - -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from pynitrokey.nethsm.client import schemas # noqa: F401 - - -class LogLevel( - schemas.EnumBase, - schemas.StrSchema -): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech - - Do not edit the class manually. - """ - - - class MetaOapg: - enum_value_to_name = { - "debug": "DEBUG", - "info": "INFO", - "warning": "WARNING", - "error": "ERROR", - } - - @schemas.classproperty - def DEBUG(cls): - return cls("debug") - - @schemas.classproperty - def INFO(cls): - return cls("info") - - @schemas.classproperty - def WARNING(cls): - return cls("warning") - - @schemas.classproperty - def ERROR(cls): - return cls("error") diff --git a/pynitrokey/nethsm/client/model/log_level.pyi b/pynitrokey/nethsm/client/model/log_level.pyi deleted file mode 100644 index 574b2483..00000000 --- a/pynitrokey/nethsm/client/model/log_level.pyi +++ /dev/null @@ -1,50 +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 encoded values are Big Endian. # noqa: E501 - - The version of the OpenAPI document: v1 - Generated by: https://openapi-generator.tech -""" - -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from pynitrokey.nethsm.client import schemas # noqa: F401 - - -class LogLevel( - schemas.EnumBase, - schemas.StrSchema -): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech - - Do not edit the class manually. - """ - - @schemas.classproperty - def DEBUG(cls): - return cls("debug") - - @schemas.classproperty - def INFO(cls): - return cls("info") - - @schemas.classproperty - def WARNING(cls): - return cls("warning") - - @schemas.classproperty - def ERROR(cls): - return cls("error") diff --git a/pynitrokey/nethsm/client/model/logging_config.py b/pynitrokey/nethsm/client/model/logging_config.py deleted file mode 100644 index 35027c49..00000000 --- a/pynitrokey/nethsm/client/model/logging_config.py +++ /dev/null @@ -1,112 +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 encoded values are Big Endian. # noqa: E501 - - The version of the OpenAPI document: v1 - Generated by: https://openapi-generator.tech -""" - -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from pynitrokey.nethsm.client import schemas # noqa: F401 - - -class LoggingConfig( - schemas.DictSchema -): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech - - Do not edit the class manually. - """ - - - class MetaOapg: - required = { - "logLevel", - "port", - "ipAddress", - } - - class properties: - ipAddress = schemas.StrSchema - port = schemas.IntSchema - - @staticmethod - def logLevel() -> typing.Type['LogLevel']: - return LogLevel - __annotations__ = { - "ipAddress": ipAddress, - "port": port, - "logLevel": logLevel, - } - - logLevel: 'LogLevel' - port: MetaOapg.properties.port - ipAddress: MetaOapg.properties.ipAddress - - @typing.overload - def __getitem__(self, name: typing_extensions.Literal["ipAddress"]) -> MetaOapg.properties.ipAddress: ... - - @typing.overload - def __getitem__(self, name: typing_extensions.Literal["port"]) -> MetaOapg.properties.port: ... - - @typing.overload - def __getitem__(self, name: typing_extensions.Literal["logLevel"]) -> 'LogLevel': ... - - @typing.overload - def __getitem__(self, name: str) -> schemas.UnsetAnyTypeSchema: ... - - def __getitem__(self, name: typing.Union[typing_extensions.Literal["ipAddress", "port", "logLevel", ], str]): - # dict_instance[name] accessor - return super().__getitem__(name) - - - @typing.overload - def get_item_oapg(self, name: typing_extensions.Literal["ipAddress"]) -> MetaOapg.properties.ipAddress: ... - - @typing.overload - def get_item_oapg(self, name: typing_extensions.Literal["port"]) -> MetaOapg.properties.port: ... - - @typing.overload - def get_item_oapg(self, name: typing_extensions.Literal["logLevel"]) -> 'LogLevel': ... - - @typing.overload - def get_item_oapg(self, name: str) -> typing.Union[schemas.UnsetAnyTypeSchema, schemas.Unset]: ... - - def get_item_oapg(self, name: typing.Union[typing_extensions.Literal["ipAddress", "port", "logLevel", ], str]): - return super().get_item_oapg(name) - - - def __new__( - cls, - *args: typing.Union[dict, frozendict.frozendict, ], - logLevel: 'LogLevel', - port: typing.Union[MetaOapg.properties.port, decimal.Decimal, int, ], - ipAddress: typing.Union[MetaOapg.properties.ipAddress, str, ], - _configuration: typing.Optional[schemas.Configuration] = None, - **kwargs: typing.Union[schemas.AnyTypeSchema, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, None, list, tuple, bytes], - ) -> 'LoggingConfig': - return super().__new__( - cls, - *args, - logLevel=logLevel, - port=port, - ipAddress=ipAddress, - _configuration=_configuration, - **kwargs, - ) - -from pynitrokey.nethsm.client.model.log_level import LogLevel diff --git a/pynitrokey/nethsm/client/model/logging_config.pyi b/pynitrokey/nethsm/client/model/logging_config.pyi deleted file mode 100644 index 35027c49..00000000 --- a/pynitrokey/nethsm/client/model/logging_config.pyi +++ /dev/null @@ -1,112 +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 encoded values are Big Endian. # noqa: E501 - - The version of the OpenAPI document: v1 - Generated by: https://openapi-generator.tech -""" - -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from pynitrokey.nethsm.client import schemas # noqa: F401 - - -class LoggingConfig( - schemas.DictSchema -): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech - - Do not edit the class manually. - """ - - - class MetaOapg: - required = { - "logLevel", - "port", - "ipAddress", - } - - class properties: - ipAddress = schemas.StrSchema - port = schemas.IntSchema - - @staticmethod - def logLevel() -> typing.Type['LogLevel']: - return LogLevel - __annotations__ = { - "ipAddress": ipAddress, - "port": port, - "logLevel": logLevel, - } - - logLevel: 'LogLevel' - port: MetaOapg.properties.port - ipAddress: MetaOapg.properties.ipAddress - - @typing.overload - def __getitem__(self, name: typing_extensions.Literal["ipAddress"]) -> MetaOapg.properties.ipAddress: ... - - @typing.overload - def __getitem__(self, name: typing_extensions.Literal["port"]) -> MetaOapg.properties.port: ... - - @typing.overload - def __getitem__(self, name: typing_extensions.Literal["logLevel"]) -> 'LogLevel': ... - - @typing.overload - def __getitem__(self, name: str) -> schemas.UnsetAnyTypeSchema: ... - - def __getitem__(self, name: typing.Union[typing_extensions.Literal["ipAddress", "port", "logLevel", ], str]): - # dict_instance[name] accessor - return super().__getitem__(name) - - - @typing.overload - def get_item_oapg(self, name: typing_extensions.Literal["ipAddress"]) -> MetaOapg.properties.ipAddress: ... - - @typing.overload - def get_item_oapg(self, name: typing_extensions.Literal["port"]) -> MetaOapg.properties.port: ... - - @typing.overload - def get_item_oapg(self, name: typing_extensions.Literal["logLevel"]) -> 'LogLevel': ... - - @typing.overload - def get_item_oapg(self, name: str) -> typing.Union[schemas.UnsetAnyTypeSchema, schemas.Unset]: ... - - def get_item_oapg(self, name: typing.Union[typing_extensions.Literal["ipAddress", "port", "logLevel", ], str]): - return super().get_item_oapg(name) - - - def __new__( - cls, - *args: typing.Union[dict, frozendict.frozendict, ], - logLevel: 'LogLevel', - port: typing.Union[MetaOapg.properties.port, decimal.Decimal, int, ], - ipAddress: typing.Union[MetaOapg.properties.ipAddress, str, ], - _configuration: typing.Optional[schemas.Configuration] = None, - **kwargs: typing.Union[schemas.AnyTypeSchema, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, None, list, tuple, bytes], - ) -> 'LoggingConfig': - return super().__new__( - cls, - *args, - logLevel=logLevel, - port=port, - ipAddress=ipAddress, - _configuration=_configuration, - **kwargs, - ) - -from pynitrokey.nethsm.client.model.log_level import LogLevel diff --git a/pynitrokey/nethsm/client/model/network_config.py b/pynitrokey/nethsm/client/model/network_config.py deleted file mode 100644 index 09cc3ed0..00000000 --- a/pynitrokey/nethsm/client/model/network_config.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 encoded values are Big Endian. # noqa: E501 - - The version of the OpenAPI document: v1 - Generated by: https://openapi-generator.tech -""" - -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from pynitrokey.nethsm.client import schemas # noqa: F401 - - -class NetworkConfig( - schemas.DictSchema -): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech - - Do not edit the class manually. - """ - - - class MetaOapg: - required = { - "netmask", - "ipAddress", - "gateway", - } - - class properties: - ipAddress = schemas.StrSchema - netmask = schemas.StrSchema - gateway = schemas.StrSchema - __annotations__ = { - "ipAddress": ipAddress, - "netmask": netmask, - "gateway": gateway, - } - - netmask: MetaOapg.properties.netmask - ipAddress: MetaOapg.properties.ipAddress - gateway: MetaOapg.properties.gateway - - @typing.overload - def __getitem__(self, name: typing_extensions.Literal["ipAddress"]) -> MetaOapg.properties.ipAddress: ... - - @typing.overload - def __getitem__(self, name: typing_extensions.Literal["netmask"]) -> MetaOapg.properties.netmask: ... - - @typing.overload - def __getitem__(self, name: typing_extensions.Literal["gateway"]) -> MetaOapg.properties.gateway: ... - - @typing.overload - def __getitem__(self, name: str) -> schemas.UnsetAnyTypeSchema: ... - - def __getitem__(self, name: typing.Union[typing_extensions.Literal["ipAddress", "netmask", "gateway", ], str]): - # dict_instance[name] accessor - return super().__getitem__(name) - - - @typing.overload - def get_item_oapg(self, name: typing_extensions.Literal["ipAddress"]) -> MetaOapg.properties.ipAddress: ... - - @typing.overload - def get_item_oapg(self, name: typing_extensions.Literal["netmask"]) -> MetaOapg.properties.netmask: ... - - @typing.overload - def get_item_oapg(self, name: typing_extensions.Literal["gateway"]) -> MetaOapg.properties.gateway: ... - - @typing.overload - def get_item_oapg(self, name: str) -> typing.Union[schemas.UnsetAnyTypeSchema, schemas.Unset]: ... - - def get_item_oapg(self, name: typing.Union[typing_extensions.Literal["ipAddress", "netmask", "gateway", ], str]): - return super().get_item_oapg(name) - - - def __new__( - cls, - *args: typing.Union[dict, frozendict.frozendict, ], - netmask: typing.Union[MetaOapg.properties.netmask, str, ], - ipAddress: typing.Union[MetaOapg.properties.ipAddress, str, ], - gateway: typing.Union[MetaOapg.properties.gateway, str, ], - _configuration: typing.Optional[schemas.Configuration] = None, - **kwargs: typing.Union[schemas.AnyTypeSchema, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, None, list, tuple, bytes], - ) -> 'NetworkConfig': - return super().__new__( - cls, - *args, - netmask=netmask, - ipAddress=ipAddress, - gateway=gateway, - _configuration=_configuration, - **kwargs, - ) diff --git a/pynitrokey/nethsm/client/model/network_config.pyi b/pynitrokey/nethsm/client/model/network_config.pyi deleted file mode 100644 index 09cc3ed0..00000000 --- a/pynitrokey/nethsm/client/model/network_config.pyi +++ /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 encoded values are Big Endian. # noqa: E501 - - The version of the OpenAPI document: v1 - Generated by: https://openapi-generator.tech -""" - -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from pynitrokey.nethsm.client import schemas # noqa: F401 - - -class NetworkConfig( - schemas.DictSchema -): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech - - Do not edit the class manually. - """ - - - class MetaOapg: - required = { - "netmask", - "ipAddress", - "gateway", - } - - class properties: - ipAddress = schemas.StrSchema - netmask = schemas.StrSchema - gateway = schemas.StrSchema - __annotations__ = { - "ipAddress": ipAddress, - "netmask": netmask, - "gateway": gateway, - } - - netmask: MetaOapg.properties.netmask - ipAddress: MetaOapg.properties.ipAddress - gateway: MetaOapg.properties.gateway - - @typing.overload - def __getitem__(self, name: typing_extensions.Literal["ipAddress"]) -> MetaOapg.properties.ipAddress: ... - - @typing.overload - def __getitem__(self, name: typing_extensions.Literal["netmask"]) -> MetaOapg.properties.netmask: ... - - @typing.overload - def __getitem__(self, name: typing_extensions.Literal["gateway"]) -> MetaOapg.properties.gateway: ... - - @typing.overload - def __getitem__(self, name: str) -> schemas.UnsetAnyTypeSchema: ... - - def __getitem__(self, name: typing.Union[typing_extensions.Literal["ipAddress", "netmask", "gateway", ], str]): - # dict_instance[name] accessor - return super().__getitem__(name) - - - @typing.overload - def get_item_oapg(self, name: typing_extensions.Literal["ipAddress"]) -> MetaOapg.properties.ipAddress: ... - - @typing.overload - def get_item_oapg(self, name: typing_extensions.Literal["netmask"]) -> MetaOapg.properties.netmask: ... - - @typing.overload - def get_item_oapg(self, name: typing_extensions.Literal["gateway"]) -> MetaOapg.properties.gateway: ... - - @typing.overload - def get_item_oapg(self, name: str) -> typing.Union[schemas.UnsetAnyTypeSchema, schemas.Unset]: ... - - def get_item_oapg(self, name: typing.Union[typing_extensions.Literal["ipAddress", "netmask", "gateway", ], str]): - return super().get_item_oapg(name) - - - def __new__( - cls, - *args: typing.Union[dict, frozendict.frozendict, ], - netmask: typing.Union[MetaOapg.properties.netmask, str, ], - ipAddress: typing.Union[MetaOapg.properties.ipAddress, str, ], - gateway: typing.Union[MetaOapg.properties.gateway, str, ], - _configuration: typing.Optional[schemas.Configuration] = None, - **kwargs: typing.Union[schemas.AnyTypeSchema, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, None, list, tuple, bytes], - ) -> 'NetworkConfig': - return super().__new__( - cls, - *args, - netmask=netmask, - ipAddress=ipAddress, - gateway=gateway, - _configuration=_configuration, - **kwargs, - ) diff --git a/pynitrokey/nethsm/client/model/passphrase.py b/pynitrokey/nethsm/client/model/passphrase.py deleted file mode 100644 index 6709048a..00000000 --- a/pynitrokey/nethsm/client/model/passphrase.py +++ /dev/null @@ -1,37 +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 encoded values are Big Endian. # noqa: E501 - - The version of the OpenAPI document: v1 - Generated by: https://openapi-generator.tech -""" - -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from pynitrokey.nethsm.client import schemas # noqa: F401 - - -class Passphrase( - schemas.StrSchema -): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech - - Do not edit the class manually. - """ - - - class MetaOapg: - min_length = 1 diff --git a/pynitrokey/nethsm/client/model/passphrase.pyi b/pynitrokey/nethsm/client/model/passphrase.pyi deleted file mode 100644 index f7b27899..00000000 --- a/pynitrokey/nethsm/client/model/passphrase.pyi +++ /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 encoded values are Big Endian. # noqa: E501 - - The version of the OpenAPI document: v1 - Generated by: https://openapi-generator.tech -""" - -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from pynitrokey.nethsm.client import schemas # noqa: F401 - - -class Passphrase( - schemas.StrSchema -): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech - - Do not edit the class manually. - """ - pass diff --git a/pynitrokey/nethsm/client/model/pem_cert.py b/pynitrokey/nethsm/client/model/pem_cert.py deleted file mode 100644 index 26c3c4d6..00000000 --- a/pynitrokey/nethsm/client/model/pem_cert.py +++ /dev/null @@ -1,24 +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 encoded values are Big Endian. # noqa: E501 - - The version of the OpenAPI document: v1 - Generated by: https://openapi-generator.tech -""" - -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from pynitrokey.nethsm.client import schemas # noqa: F401 -PemCert = schemas.StrSchema diff --git a/pynitrokey/nethsm/client/model/pem_cert.pyi b/pynitrokey/nethsm/client/model/pem_cert.pyi deleted file mode 100644 index 26c3c4d6..00000000 --- a/pynitrokey/nethsm/client/model/pem_cert.pyi +++ /dev/null @@ -1,24 +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 encoded values are Big Endian. # noqa: E501 - - The version of the OpenAPI document: v1 - Generated by: https://openapi-generator.tech -""" - -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from pynitrokey.nethsm.client import schemas # noqa: F401 -PemCert = schemas.StrSchema diff --git a/pynitrokey/nethsm/client/model/pem_csr.py b/pynitrokey/nethsm/client/model/pem_csr.py deleted file mode 100644 index 780370e0..00000000 --- a/pynitrokey/nethsm/client/model/pem_csr.py +++ /dev/null @@ -1,24 +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 encoded values are Big Endian. # noqa: E501 - - The version of the OpenAPI document: v1 - Generated by: https://openapi-generator.tech -""" - -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from pynitrokey.nethsm.client import schemas # noqa: F401 -PemCSR = schemas.StrSchema diff --git a/pynitrokey/nethsm/client/model/pem_csr.pyi b/pynitrokey/nethsm/client/model/pem_csr.pyi deleted file mode 100644 index 780370e0..00000000 --- a/pynitrokey/nethsm/client/model/pem_csr.pyi +++ /dev/null @@ -1,24 +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 encoded values are Big Endian. # noqa: E501 - - The version of the OpenAPI document: v1 - Generated by: https://openapi-generator.tech -""" - -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from pynitrokey.nethsm.client import schemas # noqa: F401 -PemCSR = schemas.StrSchema diff --git a/pynitrokey/nethsm/client/model/pem_private_key.py b/pynitrokey/nethsm/client/model/pem_private_key.py deleted file mode 100644 index 153eb1cf..00000000 --- a/pynitrokey/nethsm/client/model/pem_private_key.py +++ /dev/null @@ -1,24 +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 encoded values are Big Endian. # noqa: E501 - - The version of the OpenAPI document: v1 - Generated by: https://openapi-generator.tech -""" - -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from pynitrokey.nethsm.client import schemas # noqa: F401 -PemPrivateKey = schemas.StrSchema diff --git a/pynitrokey/nethsm/client/model/pem_private_key.pyi b/pynitrokey/nethsm/client/model/pem_private_key.pyi deleted file mode 100644 index 153eb1cf..00000000 --- a/pynitrokey/nethsm/client/model/pem_private_key.pyi +++ /dev/null @@ -1,24 +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 encoded values are Big Endian. # noqa: E501 - - The version of the OpenAPI document: v1 - Generated by: https://openapi-generator.tech -""" - -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from pynitrokey.nethsm.client import schemas # noqa: F401 -PemPrivateKey = schemas.StrSchema diff --git a/pynitrokey/nethsm/client/model/pem_public_key.py b/pynitrokey/nethsm/client/model/pem_public_key.py deleted file mode 100644 index 37a2417d..00000000 --- a/pynitrokey/nethsm/client/model/pem_public_key.py +++ /dev/null @@ -1,24 +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 encoded values are Big Endian. # noqa: E501 - - The version of the OpenAPI document: v1 - Generated by: https://openapi-generator.tech -""" - -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from pynitrokey.nethsm.client import schemas # noqa: F401 -PemPublicKey = schemas.StrSchema diff --git a/pynitrokey/nethsm/client/model/pem_public_key.pyi b/pynitrokey/nethsm/client/model/pem_public_key.pyi deleted file mode 100644 index 37a2417d..00000000 --- a/pynitrokey/nethsm/client/model/pem_public_key.pyi +++ /dev/null @@ -1,24 +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 encoded values are Big Endian. # noqa: E501 - - The version of the OpenAPI document: v1 - Generated by: https://openapi-generator.tech -""" - -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from pynitrokey.nethsm.client import schemas # noqa: F401 -PemPublicKey = schemas.StrSchema diff --git a/pynitrokey/nethsm/client/model/pgp_private_key.py b/pynitrokey/nethsm/client/model/pgp_private_key.py deleted file mode 100644 index b11dde69..00000000 --- a/pynitrokey/nethsm/client/model/pgp_private_key.py +++ /dev/null @@ -1,24 +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 encoded values are Big Endian. # noqa: E501 - - The version of the OpenAPI document: v1 - Generated by: https://openapi-generator.tech -""" - -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from pynitrokey.nethsm.client import schemas # noqa: F401 -PGPPrivateKey = schemas.StrSchema diff --git a/pynitrokey/nethsm/client/model/pgp_private_key.pyi b/pynitrokey/nethsm/client/model/pgp_private_key.pyi deleted file mode 100644 index b11dde69..00000000 --- a/pynitrokey/nethsm/client/model/pgp_private_key.pyi +++ /dev/null @@ -1,24 +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 encoded values are Big Endian. # noqa: E501 - - The version of the OpenAPI document: v1 - Generated by: https://openapi-generator.tech -""" - -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from pynitrokey.nethsm.client import schemas # noqa: F401 -PGPPrivateKey = schemas.StrSchema diff --git a/pynitrokey/nethsm/client/model/private_key.py b/pynitrokey/nethsm/client/model/private_key.py deleted file mode 100644 index d5e5ab5b..00000000 --- a/pynitrokey/nethsm/client/model/private_key.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 encoded values are Big Endian. # noqa: E501 - - The version of the OpenAPI document: v1 - Generated by: https://openapi-generator.tech -""" - -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from pynitrokey.nethsm.client import schemas # noqa: F401 - - -class PrivateKey( - schemas.DictSchema -): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech - - Do not edit the class manually. - """ - - - class MetaOapg: - required = { - "type", - "mechanisms", - "key", - } - - class properties: - - @staticmethod - def mechanisms() -> typing.Type['KeyMechanisms']: - return KeyMechanisms - - @staticmethod - def type() -> typing.Type['KeyType']: - return KeyType - - @staticmethod - def key() -> typing.Type['KeyPrivateData']: - return KeyPrivateData - - @staticmethod - def restrictions() -> typing.Type['KeyRestrictions']: - return KeyRestrictions - __annotations__ = { - "mechanisms": mechanisms, - "type": type, - "key": key, - "restrictions": restrictions, - } - - type: 'KeyType' - mechanisms: 'KeyMechanisms' - key: 'KeyPrivateData' - - @typing.overload - def __getitem__(self, name: typing_extensions.Literal["mechanisms"]) -> 'KeyMechanisms': ... - - @typing.overload - def __getitem__(self, name: typing_extensions.Literal["type"]) -> 'KeyType': ... - - @typing.overload - def __getitem__(self, name: typing_extensions.Literal["key"]) -> 'KeyPrivateData': ... - - @typing.overload - def __getitem__(self, name: typing_extensions.Literal["restrictions"]) -> 'KeyRestrictions': ... - - @typing.overload - def __getitem__(self, name: str) -> schemas.UnsetAnyTypeSchema: ... - - def __getitem__(self, name: typing.Union[typing_extensions.Literal["mechanisms", "type", "key", "restrictions", ], str]): - # dict_instance[name] accessor - return super().__getitem__(name) - - - @typing.overload - def get_item_oapg(self, name: typing_extensions.Literal["mechanisms"]) -> 'KeyMechanisms': ... - - @typing.overload - def get_item_oapg(self, name: typing_extensions.Literal["type"]) -> 'KeyType': ... - - @typing.overload - def get_item_oapg(self, name: typing_extensions.Literal["key"]) -> 'KeyPrivateData': ... - - @typing.overload - def get_item_oapg(self, name: typing_extensions.Literal["restrictions"]) -> typing.Union['KeyRestrictions', schemas.Unset]: ... - - @typing.overload - def get_item_oapg(self, name: str) -> typing.Union[schemas.UnsetAnyTypeSchema, schemas.Unset]: ... - - def get_item_oapg(self, name: typing.Union[typing_extensions.Literal["mechanisms", "type", "key", "restrictions", ], str]): - return super().get_item_oapg(name) - - - def __new__( - cls, - *args: typing.Union[dict, frozendict.frozendict, ], - type: 'KeyType', - mechanisms: 'KeyMechanisms', - key: 'KeyPrivateData', - restrictions: typing.Union['KeyRestrictions', schemas.Unset] = schemas.unset, - _configuration: typing.Optional[schemas.Configuration] = None, - **kwargs: typing.Union[schemas.AnyTypeSchema, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, None, list, tuple, bytes], - ) -> 'PrivateKey': - return super().__new__( - cls, - *args, - type=type, - mechanisms=mechanisms, - key=key, - restrictions=restrictions, - _configuration=_configuration, - **kwargs, - ) - -from pynitrokey.nethsm.client.model.key_mechanisms import KeyMechanisms -from pynitrokey.nethsm.client.model.key_private_data import KeyPrivateData -from pynitrokey.nethsm.client.model.key_restrictions import KeyRestrictions -from pynitrokey.nethsm.client.model.key_type import KeyType diff --git a/pynitrokey/nethsm/client/model/private_key.pyi b/pynitrokey/nethsm/client/model/private_key.pyi deleted file mode 100644 index d5e5ab5b..00000000 --- a/pynitrokey/nethsm/client/model/private_key.pyi +++ /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 encoded values are Big Endian. # noqa: E501 - - The version of the OpenAPI document: v1 - Generated by: https://openapi-generator.tech -""" - -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from pynitrokey.nethsm.client import schemas # noqa: F401 - - -class PrivateKey( - schemas.DictSchema -): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech - - Do not edit the class manually. - """ - - - class MetaOapg: - required = { - "type", - "mechanisms", - "key", - } - - class properties: - - @staticmethod - def mechanisms() -> typing.Type['KeyMechanisms']: - return KeyMechanisms - - @staticmethod - def type() -> typing.Type['KeyType']: - return KeyType - - @staticmethod - def key() -> typing.Type['KeyPrivateData']: - return KeyPrivateData - - @staticmethod - def restrictions() -> typing.Type['KeyRestrictions']: - return KeyRestrictions - __annotations__ = { - "mechanisms": mechanisms, - "type": type, - "key": key, - "restrictions": restrictions, - } - - type: 'KeyType' - mechanisms: 'KeyMechanisms' - key: 'KeyPrivateData' - - @typing.overload - def __getitem__(self, name: typing_extensions.Literal["mechanisms"]) -> 'KeyMechanisms': ... - - @typing.overload - def __getitem__(self, name: typing_extensions.Literal["type"]) -> 'KeyType': ... - - @typing.overload - def __getitem__(self, name: typing_extensions.Literal["key"]) -> 'KeyPrivateData': ... - - @typing.overload - def __getitem__(self, name: typing_extensions.Literal["restrictions"]) -> 'KeyRestrictions': ... - - @typing.overload - def __getitem__(self, name: str) -> schemas.UnsetAnyTypeSchema: ... - - def __getitem__(self, name: typing.Union[typing_extensions.Literal["mechanisms", "type", "key", "restrictions", ], str]): - # dict_instance[name] accessor - return super().__getitem__(name) - - - @typing.overload - def get_item_oapg(self, name: typing_extensions.Literal["mechanisms"]) -> 'KeyMechanisms': ... - - @typing.overload - def get_item_oapg(self, name: typing_extensions.Literal["type"]) -> 'KeyType': ... - - @typing.overload - def get_item_oapg(self, name: typing_extensions.Literal["key"]) -> 'KeyPrivateData': ... - - @typing.overload - def get_item_oapg(self, name: typing_extensions.Literal["restrictions"]) -> typing.Union['KeyRestrictions', schemas.Unset]: ... - - @typing.overload - def get_item_oapg(self, name: str) -> typing.Union[schemas.UnsetAnyTypeSchema, schemas.Unset]: ... - - def get_item_oapg(self, name: typing.Union[typing_extensions.Literal["mechanisms", "type", "key", "restrictions", ], str]): - return super().get_item_oapg(name) - - - def __new__( - cls, - *args: typing.Union[dict, frozendict.frozendict, ], - type: 'KeyType', - mechanisms: 'KeyMechanisms', - key: 'KeyPrivateData', - restrictions: typing.Union['KeyRestrictions', schemas.Unset] = schemas.unset, - _configuration: typing.Optional[schemas.Configuration] = None, - **kwargs: typing.Union[schemas.AnyTypeSchema, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, None, list, tuple, bytes], - ) -> 'PrivateKey': - return super().__new__( - cls, - *args, - type=type, - mechanisms=mechanisms, - key=key, - restrictions=restrictions, - _configuration=_configuration, - **kwargs, - ) - -from pynitrokey.nethsm.client.model.key_mechanisms import KeyMechanisms -from pynitrokey.nethsm.client.model.key_private_data import KeyPrivateData -from pynitrokey.nethsm.client.model.key_restrictions import KeyRestrictions -from pynitrokey.nethsm.client.model.key_type import KeyType diff --git a/pynitrokey/nethsm/client/model/provision_request_data.py b/pynitrokey/nethsm/client/model/provision_request_data.py deleted file mode 100644 index c318c382..00000000 --- a/pynitrokey/nethsm/client/model/provision_request_data.py +++ /dev/null @@ -1,115 +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 encoded values are Big Endian. # noqa: E501 - - The version of the OpenAPI document: v1 - Generated by: https://openapi-generator.tech -""" - -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from pynitrokey.nethsm.client import schemas # noqa: F401 - - -class ProvisionRequestData( - schemas.DictSchema -): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech - - Do not edit the class manually. - """ - - - class MetaOapg: - required = { - "unlockPassphrase", - "adminPassphrase", - "systemTime", - } - - class properties: - - @staticmethod - def unlockPassphrase() -> typing.Type['Passphrase']: - return Passphrase - - @staticmethod - def adminPassphrase() -> typing.Type['Passphrase']: - return Passphrase - systemTime = schemas.DateTimeSchema - __annotations__ = { - "unlockPassphrase": unlockPassphrase, - "adminPassphrase": adminPassphrase, - "systemTime": systemTime, - } - - unlockPassphrase: 'Passphrase' - adminPassphrase: 'Passphrase' - systemTime: MetaOapg.properties.systemTime - - @typing.overload - def __getitem__(self, name: typing_extensions.Literal["unlockPassphrase"]) -> 'Passphrase': ... - - @typing.overload - def __getitem__(self, name: typing_extensions.Literal["adminPassphrase"]) -> 'Passphrase': ... - - @typing.overload - def __getitem__(self, name: typing_extensions.Literal["systemTime"]) -> MetaOapg.properties.systemTime: ... - - @typing.overload - def __getitem__(self, name: str) -> schemas.UnsetAnyTypeSchema: ... - - def __getitem__(self, name: typing.Union[typing_extensions.Literal["unlockPassphrase", "adminPassphrase", "systemTime", ], str]): - # dict_instance[name] accessor - return super().__getitem__(name) - - - @typing.overload - def get_item_oapg(self, name: typing_extensions.Literal["unlockPassphrase"]) -> 'Passphrase': ... - - @typing.overload - def get_item_oapg(self, name: typing_extensions.Literal["adminPassphrase"]) -> 'Passphrase': ... - - @typing.overload - def get_item_oapg(self, name: typing_extensions.Literal["systemTime"]) -> MetaOapg.properties.systemTime: ... - - @typing.overload - def get_item_oapg(self, name: str) -> typing.Union[schemas.UnsetAnyTypeSchema, schemas.Unset]: ... - - def get_item_oapg(self, name: typing.Union[typing_extensions.Literal["unlockPassphrase", "adminPassphrase", "systemTime", ], str]): - return super().get_item_oapg(name) - - - def __new__( - cls, - *args: typing.Union[dict, frozendict.frozendict, ], - unlockPassphrase: 'Passphrase', - adminPassphrase: 'Passphrase', - systemTime: typing.Union[MetaOapg.properties.systemTime, str, datetime, ], - _configuration: typing.Optional[schemas.Configuration] = None, - **kwargs: typing.Union[schemas.AnyTypeSchema, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, None, list, tuple, bytes], - ) -> 'ProvisionRequestData': - return super().__new__( - cls, - *args, - unlockPassphrase=unlockPassphrase, - adminPassphrase=adminPassphrase, - systemTime=systemTime, - _configuration=_configuration, - **kwargs, - ) - -from pynitrokey.nethsm.client.model.passphrase import Passphrase diff --git a/pynitrokey/nethsm/client/model/provision_request_data.pyi b/pynitrokey/nethsm/client/model/provision_request_data.pyi deleted file mode 100644 index c318c382..00000000 --- a/pynitrokey/nethsm/client/model/provision_request_data.pyi +++ /dev/null @@ -1,115 +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 encoded values are Big Endian. # noqa: E501 - - The version of the OpenAPI document: v1 - Generated by: https://openapi-generator.tech -""" - -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from pynitrokey.nethsm.client import schemas # noqa: F401 - - -class ProvisionRequestData( - schemas.DictSchema -): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech - - Do not edit the class manually. - """ - - - class MetaOapg: - required = { - "unlockPassphrase", - "adminPassphrase", - "systemTime", - } - - class properties: - - @staticmethod - def unlockPassphrase() -> typing.Type['Passphrase']: - return Passphrase - - @staticmethod - def adminPassphrase() -> typing.Type['Passphrase']: - return Passphrase - systemTime = schemas.DateTimeSchema - __annotations__ = { - "unlockPassphrase": unlockPassphrase, - "adminPassphrase": adminPassphrase, - "systemTime": systemTime, - } - - unlockPassphrase: 'Passphrase' - adminPassphrase: 'Passphrase' - systemTime: MetaOapg.properties.systemTime - - @typing.overload - def __getitem__(self, name: typing_extensions.Literal["unlockPassphrase"]) -> 'Passphrase': ... - - @typing.overload - def __getitem__(self, name: typing_extensions.Literal["adminPassphrase"]) -> 'Passphrase': ... - - @typing.overload - def __getitem__(self, name: typing_extensions.Literal["systemTime"]) -> MetaOapg.properties.systemTime: ... - - @typing.overload - def __getitem__(self, name: str) -> schemas.UnsetAnyTypeSchema: ... - - def __getitem__(self, name: typing.Union[typing_extensions.Literal["unlockPassphrase", "adminPassphrase", "systemTime", ], str]): - # dict_instance[name] accessor - return super().__getitem__(name) - - - @typing.overload - def get_item_oapg(self, name: typing_extensions.Literal["unlockPassphrase"]) -> 'Passphrase': ... - - @typing.overload - def get_item_oapg(self, name: typing_extensions.Literal["adminPassphrase"]) -> 'Passphrase': ... - - @typing.overload - def get_item_oapg(self, name: typing_extensions.Literal["systemTime"]) -> MetaOapg.properties.systemTime: ... - - @typing.overload - def get_item_oapg(self, name: str) -> typing.Union[schemas.UnsetAnyTypeSchema, schemas.Unset]: ... - - def get_item_oapg(self, name: typing.Union[typing_extensions.Literal["unlockPassphrase", "adminPassphrase", "systemTime", ], str]): - return super().get_item_oapg(name) - - - def __new__( - cls, - *args: typing.Union[dict, frozendict.frozendict, ], - unlockPassphrase: 'Passphrase', - adminPassphrase: 'Passphrase', - systemTime: typing.Union[MetaOapg.properties.systemTime, str, datetime, ], - _configuration: typing.Optional[schemas.Configuration] = None, - **kwargs: typing.Union[schemas.AnyTypeSchema, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, None, list, tuple, bytes], - ) -> 'ProvisionRequestData': - return super().__new__( - cls, - *args, - unlockPassphrase=unlockPassphrase, - adminPassphrase=adminPassphrase, - systemTime=systemTime, - _configuration=_configuration, - **kwargs, - ) - -from pynitrokey.nethsm.client.model.passphrase import Passphrase diff --git a/pynitrokey/nethsm/client/model/public_key.py b/pynitrokey/nethsm/client/model/public_key.py deleted file mode 100644 index d90aec68..00000000 --- a/pynitrokey/nethsm/client/model/public_key.py +++ /dev/null @@ -1,203 +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 encoded values are Big Endian. # noqa: E501 - - The version of the OpenAPI document: v1 - Generated by: https://openapi-generator.tech -""" - -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from pynitrokey.nethsm.client import schemas # noqa: F401 - - -class PublicKey( - schemas.DictSchema -): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech - - Do not edit the class manually. - """ - - - class MetaOapg: - required = { - "operations", - "restrictions", - "type", - "mechanisms", - "key", - } - - class properties: - - @staticmethod - def mechanisms() -> typing.Type['KeyMechanisms']: - return KeyMechanisms - - @staticmethod - def type() -> typing.Type['KeyType']: - return KeyType - - @staticmethod - def restrictions() -> typing.Type['KeyRestrictions']: - return KeyRestrictions - - - class key( - schemas.ComposedSchema, - ): - - - class MetaOapg: - - - class any_of_1( - schemas.DictBase, - schemas.NoneBase, - schemas.Schema, - schemas.NoneFrozenDictMixin - ): - - - def __new__( - cls, - *args: typing.Union[dict, frozendict.frozendict, None, ], - _configuration: typing.Optional[schemas.Configuration] = None, - **kwargs: typing.Union[schemas.AnyTypeSchema, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, None, list, tuple, bytes], - ) -> 'any_of_1': - return super().__new__( - cls, - *args, - _configuration=_configuration, - **kwargs, - ) - - @classmethod - @functools.lru_cache() - def any_of(cls): - # we need this here to make our import statements work - # we must store _composed_schemas in here so the code is only run - # when we invoke this method. If we kept this at the class - # level we would get an error because the class level - # code would be run when this module is imported, and these composed - # classes don't exist yet because their module has not finished - # loading - return [ - KeyPublicData, - cls.any_of_1, - ] - - - def __new__( - cls, - *args: typing.Union[dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - _configuration: typing.Optional[schemas.Configuration] = None, - **kwargs: typing.Union[schemas.AnyTypeSchema, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, None, list, tuple, bytes], - ) -> 'key': - return super().__new__( - cls, - *args, - _configuration=_configuration, - **kwargs, - ) - operations = schemas.IntSchema - __annotations__ = { - "mechanisms": mechanisms, - "type": type, - "restrictions": restrictions, - "key": key, - "operations": operations, - } - - operations: MetaOapg.properties.operations - restrictions: 'KeyRestrictions' - type: 'KeyType' - mechanisms: 'KeyMechanisms' - key: MetaOapg.properties.key - - @typing.overload - def __getitem__(self, name: typing_extensions.Literal["mechanisms"]) -> 'KeyMechanisms': ... - - @typing.overload - def __getitem__(self, name: typing_extensions.Literal["type"]) -> 'KeyType': ... - - @typing.overload - def __getitem__(self, name: typing_extensions.Literal["restrictions"]) -> 'KeyRestrictions': ... - - @typing.overload - def __getitem__(self, name: typing_extensions.Literal["key"]) -> MetaOapg.properties.key: ... - - @typing.overload - def __getitem__(self, name: typing_extensions.Literal["operations"]) -> MetaOapg.properties.operations: ... - - @typing.overload - def __getitem__(self, name: str) -> schemas.UnsetAnyTypeSchema: ... - - def __getitem__(self, name: typing.Union[typing_extensions.Literal["mechanisms", "type", "restrictions", "key", "operations", ], str]): - # dict_instance[name] accessor - return super().__getitem__(name) - - - @typing.overload - def get_item_oapg(self, name: typing_extensions.Literal["mechanisms"]) -> 'KeyMechanisms': ... - - @typing.overload - def get_item_oapg(self, name: typing_extensions.Literal["type"]) -> 'KeyType': ... - - @typing.overload - def get_item_oapg(self, name: typing_extensions.Literal["restrictions"]) -> 'KeyRestrictions': ... - - @typing.overload - def get_item_oapg(self, name: typing_extensions.Literal["key"]) -> MetaOapg.properties.key: ... - - @typing.overload - def get_item_oapg(self, name: typing_extensions.Literal["operations"]) -> MetaOapg.properties.operations: ... - - @typing.overload - def get_item_oapg(self, name: str) -> typing.Union[schemas.UnsetAnyTypeSchema, schemas.Unset]: ... - - def get_item_oapg(self, name: typing.Union[typing_extensions.Literal["mechanisms", "type", "restrictions", "key", "operations", ], str]): - return super().get_item_oapg(name) - - - def __new__( - cls, - *args: typing.Union[dict, frozendict.frozendict, ], - operations: typing.Union[MetaOapg.properties.operations, decimal.Decimal, int, ], - restrictions: 'KeyRestrictions', - type: 'KeyType', - mechanisms: 'KeyMechanisms', - key: typing.Union[MetaOapg.properties.key, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - _configuration: typing.Optional[schemas.Configuration] = None, - **kwargs: typing.Union[schemas.AnyTypeSchema, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, None, list, tuple, bytes], - ) -> 'PublicKey': - return super().__new__( - cls, - *args, - operations=operations, - restrictions=restrictions, - type=type, - mechanisms=mechanisms, - key=key, - _configuration=_configuration, - **kwargs, - ) - -from pynitrokey.nethsm.client.model.key_mechanisms import KeyMechanisms -from pynitrokey.nethsm.client.model.key_public_data import KeyPublicData -from pynitrokey.nethsm.client.model.key_restrictions import KeyRestrictions -from pynitrokey.nethsm.client.model.key_type import KeyType diff --git a/pynitrokey/nethsm/client/model/public_key.pyi b/pynitrokey/nethsm/client/model/public_key.pyi deleted file mode 100644 index d90aec68..00000000 --- a/pynitrokey/nethsm/client/model/public_key.pyi +++ /dev/null @@ -1,203 +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 encoded values are Big Endian. # noqa: E501 - - The version of the OpenAPI document: v1 - Generated by: https://openapi-generator.tech -""" - -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from pynitrokey.nethsm.client import schemas # noqa: F401 - - -class PublicKey( - schemas.DictSchema -): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech - - Do not edit the class manually. - """ - - - class MetaOapg: - required = { - "operations", - "restrictions", - "type", - "mechanisms", - "key", - } - - class properties: - - @staticmethod - def mechanisms() -> typing.Type['KeyMechanisms']: - return KeyMechanisms - - @staticmethod - def type() -> typing.Type['KeyType']: - return KeyType - - @staticmethod - def restrictions() -> typing.Type['KeyRestrictions']: - return KeyRestrictions - - - class key( - schemas.ComposedSchema, - ): - - - class MetaOapg: - - - class any_of_1( - schemas.DictBase, - schemas.NoneBase, - schemas.Schema, - schemas.NoneFrozenDictMixin - ): - - - def __new__( - cls, - *args: typing.Union[dict, frozendict.frozendict, None, ], - _configuration: typing.Optional[schemas.Configuration] = None, - **kwargs: typing.Union[schemas.AnyTypeSchema, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, None, list, tuple, bytes], - ) -> 'any_of_1': - return super().__new__( - cls, - *args, - _configuration=_configuration, - **kwargs, - ) - - @classmethod - @functools.lru_cache() - def any_of(cls): - # we need this here to make our import statements work - # we must store _composed_schemas in here so the code is only run - # when we invoke this method. If we kept this at the class - # level we would get an error because the class level - # code would be run when this module is imported, and these composed - # classes don't exist yet because their module has not finished - # loading - return [ - KeyPublicData, - cls.any_of_1, - ] - - - def __new__( - cls, - *args: typing.Union[dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - _configuration: typing.Optional[schemas.Configuration] = None, - **kwargs: typing.Union[schemas.AnyTypeSchema, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, None, list, tuple, bytes], - ) -> 'key': - return super().__new__( - cls, - *args, - _configuration=_configuration, - **kwargs, - ) - operations = schemas.IntSchema - __annotations__ = { - "mechanisms": mechanisms, - "type": type, - "restrictions": restrictions, - "key": key, - "operations": operations, - } - - operations: MetaOapg.properties.operations - restrictions: 'KeyRestrictions' - type: 'KeyType' - mechanisms: 'KeyMechanisms' - key: MetaOapg.properties.key - - @typing.overload - def __getitem__(self, name: typing_extensions.Literal["mechanisms"]) -> 'KeyMechanisms': ... - - @typing.overload - def __getitem__(self, name: typing_extensions.Literal["type"]) -> 'KeyType': ... - - @typing.overload - def __getitem__(self, name: typing_extensions.Literal["restrictions"]) -> 'KeyRestrictions': ... - - @typing.overload - def __getitem__(self, name: typing_extensions.Literal["key"]) -> MetaOapg.properties.key: ... - - @typing.overload - def __getitem__(self, name: typing_extensions.Literal["operations"]) -> MetaOapg.properties.operations: ... - - @typing.overload - def __getitem__(self, name: str) -> schemas.UnsetAnyTypeSchema: ... - - def __getitem__(self, name: typing.Union[typing_extensions.Literal["mechanisms", "type", "restrictions", "key", "operations", ], str]): - # dict_instance[name] accessor - return super().__getitem__(name) - - - @typing.overload - def get_item_oapg(self, name: typing_extensions.Literal["mechanisms"]) -> 'KeyMechanisms': ... - - @typing.overload - def get_item_oapg(self, name: typing_extensions.Literal["type"]) -> 'KeyType': ... - - @typing.overload - def get_item_oapg(self, name: typing_extensions.Literal["restrictions"]) -> 'KeyRestrictions': ... - - @typing.overload - def get_item_oapg(self, name: typing_extensions.Literal["key"]) -> MetaOapg.properties.key: ... - - @typing.overload - def get_item_oapg(self, name: typing_extensions.Literal["operations"]) -> MetaOapg.properties.operations: ... - - @typing.overload - def get_item_oapg(self, name: str) -> typing.Union[schemas.UnsetAnyTypeSchema, schemas.Unset]: ... - - def get_item_oapg(self, name: typing.Union[typing_extensions.Literal["mechanisms", "type", "restrictions", "key", "operations", ], str]): - return super().get_item_oapg(name) - - - def __new__( - cls, - *args: typing.Union[dict, frozendict.frozendict, ], - operations: typing.Union[MetaOapg.properties.operations, decimal.Decimal, int, ], - restrictions: 'KeyRestrictions', - type: 'KeyType', - mechanisms: 'KeyMechanisms', - key: typing.Union[MetaOapg.properties.key, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - _configuration: typing.Optional[schemas.Configuration] = None, - **kwargs: typing.Union[schemas.AnyTypeSchema, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, None, list, tuple, bytes], - ) -> 'PublicKey': - return super().__new__( - cls, - *args, - operations=operations, - restrictions=restrictions, - type=type, - mechanisms=mechanisms, - key=key, - _configuration=_configuration, - **kwargs, - ) - -from pynitrokey.nethsm.client.model.key_mechanisms import KeyMechanisms -from pynitrokey.nethsm.client.model.key_public_data import KeyPublicData -from pynitrokey.nethsm.client.model.key_restrictions import KeyRestrictions -from pynitrokey.nethsm.client.model.key_type import KeyType diff --git a/pynitrokey/nethsm/client/model/random_data.py b/pynitrokey/nethsm/client/model/random_data.py deleted file mode 100644 index 86199efb..00000000 --- a/pynitrokey/nethsm/client/model/random_data.py +++ /dev/null @@ -1,88 +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 encoded values are Big Endian. # noqa: E501 - - The version of the OpenAPI document: v1 - Generated by: https://openapi-generator.tech -""" - -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from pynitrokey.nethsm.client import schemas # noqa: F401 - - -class RandomData( - schemas.DictSchema -): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech - - Do not edit the class manually. - """ - - - class MetaOapg: - required = { - "random", - } - - class properties: - - @staticmethod - def random() -> typing.Type['Base64']: - return Base64 - __annotations__ = { - "random": random, - } - - random: 'Base64' - - @typing.overload - def __getitem__(self, name: typing_extensions.Literal["random"]) -> 'Base64': ... - - @typing.overload - def __getitem__(self, name: str) -> schemas.UnsetAnyTypeSchema: ... - - def __getitem__(self, name: typing.Union[typing_extensions.Literal["random", ], str]): - # dict_instance[name] accessor - return super().__getitem__(name) - - - @typing.overload - def get_item_oapg(self, name: typing_extensions.Literal["random"]) -> 'Base64': ... - - @typing.overload - def get_item_oapg(self, name: str) -> typing.Union[schemas.UnsetAnyTypeSchema, schemas.Unset]: ... - - def get_item_oapg(self, name: typing.Union[typing_extensions.Literal["random", ], str]): - return super().get_item_oapg(name) - - - def __new__( - cls, - *args: typing.Union[dict, frozendict.frozendict, ], - random: 'Base64', - _configuration: typing.Optional[schemas.Configuration] = None, - **kwargs: typing.Union[schemas.AnyTypeSchema, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, None, list, tuple, bytes], - ) -> 'RandomData': - return super().__new__( - cls, - *args, - random=random, - _configuration=_configuration, - **kwargs, - ) - -from pynitrokey.nethsm.client.model.base64 import Base64 diff --git a/pynitrokey/nethsm/client/model/random_data.pyi b/pynitrokey/nethsm/client/model/random_data.pyi deleted file mode 100644 index 86199efb..00000000 --- a/pynitrokey/nethsm/client/model/random_data.pyi +++ /dev/null @@ -1,88 +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 encoded values are Big Endian. # noqa: E501 - - The version of the OpenAPI document: v1 - Generated by: https://openapi-generator.tech -""" - -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from pynitrokey.nethsm.client import schemas # noqa: F401 - - -class RandomData( - schemas.DictSchema -): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech - - Do not edit the class manually. - """ - - - class MetaOapg: - required = { - "random", - } - - class properties: - - @staticmethod - def random() -> typing.Type['Base64']: - return Base64 - __annotations__ = { - "random": random, - } - - random: 'Base64' - - @typing.overload - def __getitem__(self, name: typing_extensions.Literal["random"]) -> 'Base64': ... - - @typing.overload - def __getitem__(self, name: str) -> schemas.UnsetAnyTypeSchema: ... - - def __getitem__(self, name: typing.Union[typing_extensions.Literal["random", ], str]): - # dict_instance[name] accessor - return super().__getitem__(name) - - - @typing.overload - def get_item_oapg(self, name: typing_extensions.Literal["random"]) -> 'Base64': ... - - @typing.overload - def get_item_oapg(self, name: str) -> typing.Union[schemas.UnsetAnyTypeSchema, schemas.Unset]: ... - - def get_item_oapg(self, name: typing.Union[typing_extensions.Literal["random", ], str]): - return super().get_item_oapg(name) - - - def __new__( - cls, - *args: typing.Union[dict, frozendict.frozendict, ], - random: 'Base64', - _configuration: typing.Optional[schemas.Configuration] = None, - **kwargs: typing.Union[schemas.AnyTypeSchema, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, None, list, tuple, bytes], - ) -> 'RandomData': - return super().__new__( - cls, - *args, - random=random, - _configuration=_configuration, - **kwargs, - ) - -from pynitrokey.nethsm.client.model.base64 import Base64 diff --git a/pynitrokey/nethsm/client/model/random_request_data.py b/pynitrokey/nethsm/client/model/random_request_data.py deleted file mode 100644 index 27a6d557..00000000 --- a/pynitrokey/nethsm/client/model/random_request_data.py +++ /dev/null @@ -1,92 +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 encoded values are Big Endian. # noqa: E501 - - The version of the OpenAPI document: v1 - Generated by: https://openapi-generator.tech -""" - -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from pynitrokey.nethsm.client import schemas # noqa: F401 - - -class RandomRequestData( - schemas.DictSchema -): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech - - Do not edit the class manually. - """ - - - class MetaOapg: - required = { - "length", - } - - class properties: - - - class length( - schemas.IntSchema - ): - - - class MetaOapg: - inclusive_maximum = 1024 - inclusive_minimum = 1 - __annotations__ = { - "length": length, - } - - length: MetaOapg.properties.length - - @typing.overload - def __getitem__(self, name: typing_extensions.Literal["length"]) -> MetaOapg.properties.length: ... - - @typing.overload - def __getitem__(self, name: str) -> schemas.UnsetAnyTypeSchema: ... - - def __getitem__(self, name: typing.Union[typing_extensions.Literal["length", ], str]): - # dict_instance[name] accessor - return super().__getitem__(name) - - - @typing.overload - def get_item_oapg(self, name: typing_extensions.Literal["length"]) -> MetaOapg.properties.length: ... - - @typing.overload - def get_item_oapg(self, name: str) -> typing.Union[schemas.UnsetAnyTypeSchema, schemas.Unset]: ... - - def get_item_oapg(self, name: typing.Union[typing_extensions.Literal["length", ], str]): - return super().get_item_oapg(name) - - - def __new__( - cls, - *args: typing.Union[dict, frozendict.frozendict, ], - length: typing.Union[MetaOapg.properties.length, decimal.Decimal, int, ], - _configuration: typing.Optional[schemas.Configuration] = None, - **kwargs: typing.Union[schemas.AnyTypeSchema, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, None, list, tuple, bytes], - ) -> 'RandomRequestData': - return super().__new__( - cls, - *args, - length=length, - _configuration=_configuration, - **kwargs, - ) diff --git a/pynitrokey/nethsm/client/model/random_request_data.pyi b/pynitrokey/nethsm/client/model/random_request_data.pyi deleted file mode 100644 index 0a0e2800..00000000 --- a/pynitrokey/nethsm/client/model/random_request_data.pyi +++ /dev/null @@ -1,88 +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 encoded values are Big Endian. # noqa: E501 - - The version of the OpenAPI document: v1 - Generated by: https://openapi-generator.tech -""" - -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from pynitrokey.nethsm.client import schemas # noqa: F401 - - -class RandomRequestData( - schemas.DictSchema -): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech - - Do not edit the class manually. - """ - - - class MetaOapg: - required = { - "length", - } - - class properties: - - - class length( - schemas.IntSchema - ): - pass - __annotations__ = { - "length": length, - } - - length: MetaOapg.properties.length - - @typing.overload - def __getitem__(self, name: typing_extensions.Literal["length"]) -> MetaOapg.properties.length: ... - - @typing.overload - def __getitem__(self, name: str) -> schemas.UnsetAnyTypeSchema: ... - - def __getitem__(self, name: typing.Union[typing_extensions.Literal["length", ], str]): - # dict_instance[name] accessor - return super().__getitem__(name) - - - @typing.overload - def get_item_oapg(self, name: typing_extensions.Literal["length"]) -> MetaOapg.properties.length: ... - - @typing.overload - def get_item_oapg(self, name: str) -> typing.Union[schemas.UnsetAnyTypeSchema, schemas.Unset]: ... - - def get_item_oapg(self, name: typing.Union[typing_extensions.Literal["length", ], str]): - return super().get_item_oapg(name) - - - def __new__( - cls, - *args: typing.Union[dict, frozendict.frozendict, ], - length: typing.Union[MetaOapg.properties.length, decimal.Decimal, int, ], - _configuration: typing.Optional[schemas.Configuration] = None, - **kwargs: typing.Union[schemas.AnyTypeSchema, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, None, list, tuple, bytes], - ) -> 'RandomRequestData': - return super().__new__( - cls, - *args, - length=length, - _configuration=_configuration, - **kwargs, - ) diff --git a/pynitrokey/nethsm/client/model/sign_data.py b/pynitrokey/nethsm/client/model/sign_data.py deleted file mode 100644 index 118e4d54..00000000 --- a/pynitrokey/nethsm/client/model/sign_data.py +++ /dev/null @@ -1,88 +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 encoded values are Big Endian. # noqa: E501 - - The version of the OpenAPI document: v1 - Generated by: https://openapi-generator.tech -""" - -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from pynitrokey.nethsm.client import schemas # noqa: F401 - - -class SignData( - schemas.DictSchema -): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech - - Do not edit the class manually. - """ - - - class MetaOapg: - required = { - "signature", - } - - class properties: - - @staticmethod - def signature() -> typing.Type['Base64']: - return Base64 - __annotations__ = { - "signature": signature, - } - - signature: 'Base64' - - @typing.overload - def __getitem__(self, name: typing_extensions.Literal["signature"]) -> 'Base64': ... - - @typing.overload - def __getitem__(self, name: str) -> schemas.UnsetAnyTypeSchema: ... - - def __getitem__(self, name: typing.Union[typing_extensions.Literal["signature", ], str]): - # dict_instance[name] accessor - return super().__getitem__(name) - - - @typing.overload - def get_item_oapg(self, name: typing_extensions.Literal["signature"]) -> 'Base64': ... - - @typing.overload - def get_item_oapg(self, name: str) -> typing.Union[schemas.UnsetAnyTypeSchema, schemas.Unset]: ... - - def get_item_oapg(self, name: typing.Union[typing_extensions.Literal["signature", ], str]): - return super().get_item_oapg(name) - - - def __new__( - cls, - *args: typing.Union[dict, frozendict.frozendict, ], - signature: 'Base64', - _configuration: typing.Optional[schemas.Configuration] = None, - **kwargs: typing.Union[schemas.AnyTypeSchema, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, None, list, tuple, bytes], - ) -> 'SignData': - return super().__new__( - cls, - *args, - signature=signature, - _configuration=_configuration, - **kwargs, - ) - -from pynitrokey.nethsm.client.model.base64 import Base64 diff --git a/pynitrokey/nethsm/client/model/sign_data.pyi b/pynitrokey/nethsm/client/model/sign_data.pyi deleted file mode 100644 index 118e4d54..00000000 --- a/pynitrokey/nethsm/client/model/sign_data.pyi +++ /dev/null @@ -1,88 +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 encoded values are Big Endian. # noqa: E501 - - The version of the OpenAPI document: v1 - Generated by: https://openapi-generator.tech -""" - -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from pynitrokey.nethsm.client import schemas # noqa: F401 - - -class SignData( - schemas.DictSchema -): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech - - Do not edit the class manually. - """ - - - class MetaOapg: - required = { - "signature", - } - - class properties: - - @staticmethod - def signature() -> typing.Type['Base64']: - return Base64 - __annotations__ = { - "signature": signature, - } - - signature: 'Base64' - - @typing.overload - def __getitem__(self, name: typing_extensions.Literal["signature"]) -> 'Base64': ... - - @typing.overload - def __getitem__(self, name: str) -> schemas.UnsetAnyTypeSchema: ... - - def __getitem__(self, name: typing.Union[typing_extensions.Literal["signature", ], str]): - # dict_instance[name] accessor - return super().__getitem__(name) - - - @typing.overload - def get_item_oapg(self, name: typing_extensions.Literal["signature"]) -> 'Base64': ... - - @typing.overload - def get_item_oapg(self, name: str) -> typing.Union[schemas.UnsetAnyTypeSchema, schemas.Unset]: ... - - def get_item_oapg(self, name: typing.Union[typing_extensions.Literal["signature", ], str]): - return super().get_item_oapg(name) - - - def __new__( - cls, - *args: typing.Union[dict, frozendict.frozendict, ], - signature: 'Base64', - _configuration: typing.Optional[schemas.Configuration] = None, - **kwargs: typing.Union[schemas.AnyTypeSchema, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, None, list, tuple, bytes], - ) -> 'SignData': - return super().__new__( - cls, - *args, - signature=signature, - _configuration=_configuration, - **kwargs, - ) - -from pynitrokey.nethsm.client.model.base64 import Base64 diff --git a/pynitrokey/nethsm/client/model/sign_mode.py b/pynitrokey/nethsm/client/model/sign_mode.py deleted file mode 100644 index cd8285c6..00000000 --- a/pynitrokey/nethsm/client/model/sign_mode.py +++ /dev/null @@ -1,84 +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 encoded values are Big Endian. # noqa: E501 - - The version of the OpenAPI document: v1 - Generated by: https://openapi-generator.tech -""" - -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from pynitrokey.nethsm.client import schemas # noqa: F401 - - -class SignMode( - schemas.EnumBase, - schemas.StrSchema -): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech - - Do not edit the class manually. - """ - - - class MetaOapg: - enum_value_to_name = { - "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", - } - - @schemas.classproperty - def PKCS1(cls): - return cls("PKCS1") - - @schemas.classproperty - def PSS_MD5(cls): - return cls("PSS_MD5") - - @schemas.classproperty - def PSS_SHA1(cls): - return cls("PSS_SHA1") - - @schemas.classproperty - def PSS_SHA224(cls): - return cls("PSS_SHA224") - - @schemas.classproperty - def PSS_SHA256(cls): - return cls("PSS_SHA256") - - @schemas.classproperty - def PSS_SHA384(cls): - return cls("PSS_SHA384") - - @schemas.classproperty - def PSS_SHA512(cls): - return cls("PSS_SHA512") - - @schemas.classproperty - def ED_DSA(cls): - return cls("EdDSA") - - @schemas.classproperty - def ECDSA(cls): - return cls("ECDSA") diff --git a/pynitrokey/nethsm/client/model/sign_mode.pyi b/pynitrokey/nethsm/client/model/sign_mode.pyi deleted file mode 100644 index 3fb1455a..00000000 --- a/pynitrokey/nethsm/client/model/sign_mode.pyi +++ /dev/null @@ -1,70 +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 encoded values are Big Endian. # noqa: E501 - - The version of the OpenAPI document: v1 - Generated by: https://openapi-generator.tech -""" - -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from pynitrokey.nethsm.client import schemas # noqa: F401 - - -class SignMode( - schemas.EnumBase, - schemas.StrSchema -): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech - - Do not edit the class manually. - """ - - @schemas.classproperty - def PKCS1(cls): - return cls("PKCS1") - - @schemas.classproperty - def PSS_MD5(cls): - return cls("PSS_MD5") - - @schemas.classproperty - def PSS_SHA1(cls): - return cls("PSS_SHA1") - - @schemas.classproperty - def PSS_SHA224(cls): - return cls("PSS_SHA224") - - @schemas.classproperty - def PSS_SHA256(cls): - return cls("PSS_SHA256") - - @schemas.classproperty - def PSS_SHA384(cls): - return cls("PSS_SHA384") - - @schemas.classproperty - def PSS_SHA512(cls): - return cls("PSS_SHA512") - - @schemas.classproperty - def ED_DSA(cls): - return cls("EdDSA") - - @schemas.classproperty - def ECDSA(cls): - return cls("ECDSA") diff --git a/pynitrokey/nethsm/client/model/sign_request_data.py b/pynitrokey/nethsm/client/model/sign_request_data.py deleted file mode 100644 index 00fd3af9..00000000 --- a/pynitrokey/nethsm/client/model/sign_request_data.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 encoded values are Big Endian. # noqa: E501 - - The version of the OpenAPI document: v1 - Generated by: https://openapi-generator.tech -""" - -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from pynitrokey.nethsm.client import schemas # noqa: F401 - - -class SignRequestData( - schemas.DictSchema -): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech - - Do not edit the class manually. - """ - - - class MetaOapg: - required = { - "mode", - "message", - } - - class properties: - - @staticmethod - def mode() -> typing.Type['SignMode']: - return SignMode - - @staticmethod - def message() -> typing.Type['Base64']: - return Base64 - __annotations__ = { - "mode": mode, - "message": message, - } - - mode: 'SignMode' - message: 'Base64' - - @typing.overload - def __getitem__(self, name: typing_extensions.Literal["mode"]) -> 'SignMode': ... - - @typing.overload - def __getitem__(self, name: typing_extensions.Literal["message"]) -> 'Base64': ... - - @typing.overload - def __getitem__(self, name: str) -> schemas.UnsetAnyTypeSchema: ... - - def __getitem__(self, name: typing.Union[typing_extensions.Literal["mode", "message", ], str]): - # dict_instance[name] accessor - return super().__getitem__(name) - - - @typing.overload - def get_item_oapg(self, name: typing_extensions.Literal["mode"]) -> 'SignMode': ... - - @typing.overload - def get_item_oapg(self, name: typing_extensions.Literal["message"]) -> 'Base64': ... - - @typing.overload - def get_item_oapg(self, name: str) -> typing.Union[schemas.UnsetAnyTypeSchema, schemas.Unset]: ... - - def get_item_oapg(self, name: typing.Union[typing_extensions.Literal["mode", "message", ], str]): - return super().get_item_oapg(name) - - - def __new__( - cls, - *args: typing.Union[dict, frozendict.frozendict, ], - mode: 'SignMode', - message: 'Base64', - _configuration: typing.Optional[schemas.Configuration] = None, - **kwargs: typing.Union[schemas.AnyTypeSchema, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, None, list, tuple, bytes], - ) -> 'SignRequestData': - return super().__new__( - cls, - *args, - mode=mode, - message=message, - _configuration=_configuration, - **kwargs, - ) - -from pynitrokey.nethsm.client.model.base64 import Base64 -from pynitrokey.nethsm.client.model.sign_mode import SignMode diff --git a/pynitrokey/nethsm/client/model/sign_request_data.pyi b/pynitrokey/nethsm/client/model/sign_request_data.pyi deleted file mode 100644 index 00fd3af9..00000000 --- a/pynitrokey/nethsm/client/model/sign_request_data.pyi +++ /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 encoded values are Big Endian. # noqa: E501 - - The version of the OpenAPI document: v1 - Generated by: https://openapi-generator.tech -""" - -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from pynitrokey.nethsm.client import schemas # noqa: F401 - - -class SignRequestData( - schemas.DictSchema -): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech - - Do not edit the class manually. - """ - - - class MetaOapg: - required = { - "mode", - "message", - } - - class properties: - - @staticmethod - def mode() -> typing.Type['SignMode']: - return SignMode - - @staticmethod - def message() -> typing.Type['Base64']: - return Base64 - __annotations__ = { - "mode": mode, - "message": message, - } - - mode: 'SignMode' - message: 'Base64' - - @typing.overload - def __getitem__(self, name: typing_extensions.Literal["mode"]) -> 'SignMode': ... - - @typing.overload - def __getitem__(self, name: typing_extensions.Literal["message"]) -> 'Base64': ... - - @typing.overload - def __getitem__(self, name: str) -> schemas.UnsetAnyTypeSchema: ... - - def __getitem__(self, name: typing.Union[typing_extensions.Literal["mode", "message", ], str]): - # dict_instance[name] accessor - return super().__getitem__(name) - - - @typing.overload - def get_item_oapg(self, name: typing_extensions.Literal["mode"]) -> 'SignMode': ... - - @typing.overload - def get_item_oapg(self, name: typing_extensions.Literal["message"]) -> 'Base64': ... - - @typing.overload - def get_item_oapg(self, name: str) -> typing.Union[schemas.UnsetAnyTypeSchema, schemas.Unset]: ... - - def get_item_oapg(self, name: typing.Union[typing_extensions.Literal["mode", "message", ], str]): - return super().get_item_oapg(name) - - - def __new__( - cls, - *args: typing.Union[dict, frozendict.frozendict, ], - mode: 'SignMode', - message: 'Base64', - _configuration: typing.Optional[schemas.Configuration] = None, - **kwargs: typing.Union[schemas.AnyTypeSchema, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, None, list, tuple, bytes], - ) -> 'SignRequestData': - return super().__new__( - cls, - *args, - mode=mode, - message=message, - _configuration=_configuration, - **kwargs, - ) - -from pynitrokey.nethsm.client.model.base64 import Base64 -from pynitrokey.nethsm.client.model.sign_mode import SignMode diff --git a/pynitrokey/nethsm/client/model/switch.py b/pynitrokey/nethsm/client/model/switch.py deleted file mode 100644 index 7b283133..00000000 --- a/pynitrokey/nethsm/client/model/switch.py +++ /dev/null @@ -1,49 +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 encoded values are Big Endian. # noqa: E501 - - The version of the OpenAPI document: v1 - Generated by: https://openapi-generator.tech -""" - -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from pynitrokey.nethsm.client import schemas # noqa: F401 - - -class Switch( - schemas.EnumBase, - schemas.StrSchema -): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech - - Do not edit the class manually. - """ - - - class MetaOapg: - enum_value_to_name = { - "on": "ON", - "off": "OFF", - } - - @schemas.classproperty - def ON(cls): - return cls("on") - - @schemas.classproperty - def OFF(cls): - return cls("off") diff --git a/pynitrokey/nethsm/client/model/switch.pyi b/pynitrokey/nethsm/client/model/switch.pyi deleted file mode 100644 index a30390cf..00000000 --- a/pynitrokey/nethsm/client/model/switch.pyi +++ /dev/null @@ -1,42 +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 encoded values are Big Endian. # noqa: E501 - - The version of the OpenAPI document: v1 - Generated by: https://openapi-generator.tech -""" - -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from pynitrokey.nethsm.client import schemas # noqa: F401 - - -class Switch( - schemas.EnumBase, - schemas.StrSchema -): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech - - Do not edit the class manually. - """ - - @schemas.classproperty - def ON(cls): - return cls("on") - - @schemas.classproperty - def OFF(cls): - return cls("off") diff --git a/pynitrokey/nethsm/client/model/system_info.py b/pynitrokey/nethsm/client/model/system_info.py deleted file mode 100644 index 4171b020..00000000 --- a/pynitrokey/nethsm/client/model/system_info.py +++ /dev/null @@ -1,119 +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 encoded values are Big Endian. # noqa: E501 - - The version of the OpenAPI document: v1 - Generated by: https://openapi-generator.tech -""" - -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from pynitrokey.nethsm.client import schemas # noqa: F401 - - -class SystemInfo( - schemas.DictSchema -): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech - - Do not edit the class manually. - """ - - - class MetaOapg: - required = { - "buildTag", - "hardwareVersion", - "firmwareVersion", - "softwareVersion", - } - - class properties: - firmwareVersion = schemas.StrSchema - softwareVersion = schemas.StrSchema - hardwareVersion = schemas.StrSchema - buildTag = schemas.StrSchema - __annotations__ = { - "firmwareVersion": firmwareVersion, - "softwareVersion": softwareVersion, - "hardwareVersion": hardwareVersion, - "buildTag": buildTag, - } - - buildTag: MetaOapg.properties.buildTag - hardwareVersion: MetaOapg.properties.hardwareVersion - firmwareVersion: MetaOapg.properties.firmwareVersion - softwareVersion: MetaOapg.properties.softwareVersion - - @typing.overload - def __getitem__(self, name: typing_extensions.Literal["firmwareVersion"]) -> MetaOapg.properties.firmwareVersion: ... - - @typing.overload - def __getitem__(self, name: typing_extensions.Literal["softwareVersion"]) -> MetaOapg.properties.softwareVersion: ... - - @typing.overload - def __getitem__(self, name: typing_extensions.Literal["hardwareVersion"]) -> MetaOapg.properties.hardwareVersion: ... - - @typing.overload - def __getitem__(self, name: typing_extensions.Literal["buildTag"]) -> MetaOapg.properties.buildTag: ... - - @typing.overload - def __getitem__(self, name: str) -> schemas.UnsetAnyTypeSchema: ... - - def __getitem__(self, name: typing.Union[typing_extensions.Literal["firmwareVersion", "softwareVersion", "hardwareVersion", "buildTag", ], str]): - # dict_instance[name] accessor - return super().__getitem__(name) - - - @typing.overload - def get_item_oapg(self, name: typing_extensions.Literal["firmwareVersion"]) -> MetaOapg.properties.firmwareVersion: ... - - @typing.overload - def get_item_oapg(self, name: typing_extensions.Literal["softwareVersion"]) -> MetaOapg.properties.softwareVersion: ... - - @typing.overload - def get_item_oapg(self, name: typing_extensions.Literal["hardwareVersion"]) -> MetaOapg.properties.hardwareVersion: ... - - @typing.overload - def get_item_oapg(self, name: typing_extensions.Literal["buildTag"]) -> MetaOapg.properties.buildTag: ... - - @typing.overload - def get_item_oapg(self, name: str) -> typing.Union[schemas.UnsetAnyTypeSchema, schemas.Unset]: ... - - def get_item_oapg(self, name: typing.Union[typing_extensions.Literal["firmwareVersion", "softwareVersion", "hardwareVersion", "buildTag", ], str]): - return super().get_item_oapg(name) - - - def __new__( - cls, - *args: typing.Union[dict, frozendict.frozendict, ], - buildTag: typing.Union[MetaOapg.properties.buildTag, str, ], - hardwareVersion: typing.Union[MetaOapg.properties.hardwareVersion, str, ], - firmwareVersion: typing.Union[MetaOapg.properties.firmwareVersion, str, ], - softwareVersion: typing.Union[MetaOapg.properties.softwareVersion, str, ], - _configuration: typing.Optional[schemas.Configuration] = None, - **kwargs: typing.Union[schemas.AnyTypeSchema, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, None, list, tuple, bytes], - ) -> 'SystemInfo': - return super().__new__( - cls, - *args, - buildTag=buildTag, - hardwareVersion=hardwareVersion, - firmwareVersion=firmwareVersion, - softwareVersion=softwareVersion, - _configuration=_configuration, - **kwargs, - ) diff --git a/pynitrokey/nethsm/client/model/system_info.pyi b/pynitrokey/nethsm/client/model/system_info.pyi deleted file mode 100644 index 4171b020..00000000 --- a/pynitrokey/nethsm/client/model/system_info.pyi +++ /dev/null @@ -1,119 +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 encoded values are Big Endian. # noqa: E501 - - The version of the OpenAPI document: v1 - Generated by: https://openapi-generator.tech -""" - -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from pynitrokey.nethsm.client import schemas # noqa: F401 - - -class SystemInfo( - schemas.DictSchema -): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech - - Do not edit the class manually. - """ - - - class MetaOapg: - required = { - "buildTag", - "hardwareVersion", - "firmwareVersion", - "softwareVersion", - } - - class properties: - firmwareVersion = schemas.StrSchema - softwareVersion = schemas.StrSchema - hardwareVersion = schemas.StrSchema - buildTag = schemas.StrSchema - __annotations__ = { - "firmwareVersion": firmwareVersion, - "softwareVersion": softwareVersion, - "hardwareVersion": hardwareVersion, - "buildTag": buildTag, - } - - buildTag: MetaOapg.properties.buildTag - hardwareVersion: MetaOapg.properties.hardwareVersion - firmwareVersion: MetaOapg.properties.firmwareVersion - softwareVersion: MetaOapg.properties.softwareVersion - - @typing.overload - def __getitem__(self, name: typing_extensions.Literal["firmwareVersion"]) -> MetaOapg.properties.firmwareVersion: ... - - @typing.overload - def __getitem__(self, name: typing_extensions.Literal["softwareVersion"]) -> MetaOapg.properties.softwareVersion: ... - - @typing.overload - def __getitem__(self, name: typing_extensions.Literal["hardwareVersion"]) -> MetaOapg.properties.hardwareVersion: ... - - @typing.overload - def __getitem__(self, name: typing_extensions.Literal["buildTag"]) -> MetaOapg.properties.buildTag: ... - - @typing.overload - def __getitem__(self, name: str) -> schemas.UnsetAnyTypeSchema: ... - - def __getitem__(self, name: typing.Union[typing_extensions.Literal["firmwareVersion", "softwareVersion", "hardwareVersion", "buildTag", ], str]): - # dict_instance[name] accessor - return super().__getitem__(name) - - - @typing.overload - def get_item_oapg(self, name: typing_extensions.Literal["firmwareVersion"]) -> MetaOapg.properties.firmwareVersion: ... - - @typing.overload - def get_item_oapg(self, name: typing_extensions.Literal["softwareVersion"]) -> MetaOapg.properties.softwareVersion: ... - - @typing.overload - def get_item_oapg(self, name: typing_extensions.Literal["hardwareVersion"]) -> MetaOapg.properties.hardwareVersion: ... - - @typing.overload - def get_item_oapg(self, name: typing_extensions.Literal["buildTag"]) -> MetaOapg.properties.buildTag: ... - - @typing.overload - def get_item_oapg(self, name: str) -> typing.Union[schemas.UnsetAnyTypeSchema, schemas.Unset]: ... - - def get_item_oapg(self, name: typing.Union[typing_extensions.Literal["firmwareVersion", "softwareVersion", "hardwareVersion", "buildTag", ], str]): - return super().get_item_oapg(name) - - - def __new__( - cls, - *args: typing.Union[dict, frozendict.frozendict, ], - buildTag: typing.Union[MetaOapg.properties.buildTag, str, ], - hardwareVersion: typing.Union[MetaOapg.properties.hardwareVersion, str, ], - firmwareVersion: typing.Union[MetaOapg.properties.firmwareVersion, str, ], - softwareVersion: typing.Union[MetaOapg.properties.softwareVersion, str, ], - _configuration: typing.Optional[schemas.Configuration] = None, - **kwargs: typing.Union[schemas.AnyTypeSchema, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, None, list, tuple, bytes], - ) -> 'SystemInfo': - return super().__new__( - cls, - *args, - buildTag=buildTag, - hardwareVersion=hardwareVersion, - firmwareVersion=firmwareVersion, - softwareVersion=softwareVersion, - _configuration=_configuration, - **kwargs, - ) diff --git a/pynitrokey/nethsm/client/model/system_state.py b/pynitrokey/nethsm/client/model/system_state.py deleted file mode 100644 index 722fba2b..00000000 --- a/pynitrokey/nethsm/client/model/system_state.py +++ /dev/null @@ -1,54 +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 encoded values are Big Endian. # noqa: E501 - - The version of the OpenAPI document: v1 - Generated by: https://openapi-generator.tech -""" - -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from pynitrokey.nethsm.client import schemas # noqa: F401 - - -class SystemState( - schemas.EnumBase, - schemas.StrSchema -): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech - - Do not edit the class manually. - """ - - - class MetaOapg: - enum_value_to_name = { - "Unprovisioned": "UNPROVISIONED", - "Locked": "LOCKED", - "Operational": "OPERATIONAL", - } - - @schemas.classproperty - def UNPROVISIONED(cls): - return cls("Unprovisioned") - - @schemas.classproperty - def LOCKED(cls): - return cls("Locked") - - @schemas.classproperty - def OPERATIONAL(cls): - return cls("Operational") diff --git a/pynitrokey/nethsm/client/model/system_state.pyi b/pynitrokey/nethsm/client/model/system_state.pyi deleted file mode 100644 index be65fa80..00000000 --- a/pynitrokey/nethsm/client/model/system_state.pyi +++ /dev/null @@ -1,46 +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 encoded values are Big Endian. # noqa: E501 - - The version of the OpenAPI document: v1 - Generated by: https://openapi-generator.tech -""" - -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from pynitrokey.nethsm.client import schemas # noqa: F401 - - -class SystemState( - schemas.EnumBase, - schemas.StrSchema -): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech - - Do not edit the class manually. - """ - - @schemas.classproperty - def UNPROVISIONED(cls): - return cls("Unprovisioned") - - @schemas.classproperty - def LOCKED(cls): - return cls("Locked") - - @schemas.classproperty - def OPERATIONAL(cls): - return cls("Operational") diff --git a/pynitrokey/nethsm/client/model/system_update_data.py b/pynitrokey/nethsm/client/model/system_update_data.py deleted file mode 100644 index 37dc44e2..00000000 --- a/pynitrokey/nethsm/client/model/system_update_data.py +++ /dev/null @@ -1,83 +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 encoded values are Big Endian. # noqa: E501 - - The version of the OpenAPI document: v1 - Generated by: https://openapi-generator.tech -""" - -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from pynitrokey.nethsm.client import schemas # noqa: F401 - - -class SystemUpdateData( - schemas.DictSchema -): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech - - Do not edit the class manually. - """ - - - class MetaOapg: - required = { - "releaseNotes", - } - - class properties: - releaseNotes = schemas.StrSchema - __annotations__ = { - "releaseNotes": releaseNotes, - } - - releaseNotes: MetaOapg.properties.releaseNotes - - @typing.overload - def __getitem__(self, name: typing_extensions.Literal["releaseNotes"]) -> MetaOapg.properties.releaseNotes: ... - - @typing.overload - def __getitem__(self, name: str) -> schemas.UnsetAnyTypeSchema: ... - - def __getitem__(self, name: typing.Union[typing_extensions.Literal["releaseNotes", ], str]): - # dict_instance[name] accessor - return super().__getitem__(name) - - - @typing.overload - def get_item_oapg(self, name: typing_extensions.Literal["releaseNotes"]) -> MetaOapg.properties.releaseNotes: ... - - @typing.overload - def get_item_oapg(self, name: str) -> typing.Union[schemas.UnsetAnyTypeSchema, schemas.Unset]: ... - - def get_item_oapg(self, name: typing.Union[typing_extensions.Literal["releaseNotes", ], str]): - return super().get_item_oapg(name) - - - def __new__( - cls, - *args: typing.Union[dict, frozendict.frozendict, ], - releaseNotes: typing.Union[MetaOapg.properties.releaseNotes, str, ], - _configuration: typing.Optional[schemas.Configuration] = None, - **kwargs: typing.Union[schemas.AnyTypeSchema, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, None, list, tuple, bytes], - ) -> 'SystemUpdateData': - return super().__new__( - cls, - *args, - releaseNotes=releaseNotes, - _configuration=_configuration, - **kwargs, - ) diff --git a/pynitrokey/nethsm/client/model/system_update_data.pyi b/pynitrokey/nethsm/client/model/system_update_data.pyi deleted file mode 100644 index 37dc44e2..00000000 --- a/pynitrokey/nethsm/client/model/system_update_data.pyi +++ /dev/null @@ -1,83 +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 encoded values are Big Endian. # noqa: E501 - - The version of the OpenAPI document: v1 - Generated by: https://openapi-generator.tech -""" - -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from pynitrokey.nethsm.client import schemas # noqa: F401 - - -class SystemUpdateData( - schemas.DictSchema -): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech - - Do not edit the class manually. - """ - - - class MetaOapg: - required = { - "releaseNotes", - } - - class properties: - releaseNotes = schemas.StrSchema - __annotations__ = { - "releaseNotes": releaseNotes, - } - - releaseNotes: MetaOapg.properties.releaseNotes - - @typing.overload - def __getitem__(self, name: typing_extensions.Literal["releaseNotes"]) -> MetaOapg.properties.releaseNotes: ... - - @typing.overload - def __getitem__(self, name: str) -> schemas.UnsetAnyTypeSchema: ... - - def __getitem__(self, name: typing.Union[typing_extensions.Literal["releaseNotes", ], str]): - # dict_instance[name] accessor - return super().__getitem__(name) - - - @typing.overload - def get_item_oapg(self, name: typing_extensions.Literal["releaseNotes"]) -> MetaOapg.properties.releaseNotes: ... - - @typing.overload - def get_item_oapg(self, name: str) -> typing.Union[schemas.UnsetAnyTypeSchema, schemas.Unset]: ... - - def get_item_oapg(self, name: typing.Union[typing_extensions.Literal["releaseNotes", ], str]): - return super().get_item_oapg(name) - - - def __new__( - cls, - *args: typing.Union[dict, frozendict.frozendict, ], - releaseNotes: typing.Union[MetaOapg.properties.releaseNotes, str, ], - _configuration: typing.Optional[schemas.Configuration] = None, - **kwargs: typing.Union[schemas.AnyTypeSchema, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, None, list, tuple, bytes], - ) -> 'SystemUpdateData': - return super().__new__( - cls, - *args, - releaseNotes=releaseNotes, - _configuration=_configuration, - **kwargs, - ) diff --git a/pynitrokey/nethsm/client/model/tag_list.py b/pynitrokey/nethsm/client/model/tag_list.py deleted file mode 100644 index a91bd1a2..00000000 --- a/pynitrokey/nethsm/client/model/tag_list.py +++ /dev/null @@ -1,56 +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 encoded values are Big Endian. # noqa: E501 - - The version of the OpenAPI document: v1 - Generated by: https://openapi-generator.tech -""" - -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from pynitrokey.nethsm.client import schemas # noqa: F401 - - -class TagList( - schemas.ListSchema -): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech - - Do not edit the class manually. - """ - - - class MetaOapg: - - @staticmethod - def items() -> typing.Type['ID']: - return ID - - def __new__( - cls, - arg: typing.Union[typing.Tuple['ID'], typing.List['ID']], - _configuration: typing.Optional[schemas.Configuration] = None, - ) -> 'TagList': - return super().__new__( - cls, - arg, - _configuration=_configuration, - ) - - def __getitem__(self, i: int) -> 'ID': - return super().__getitem__(i) - -from pynitrokey.nethsm.client.model.id import ID diff --git a/pynitrokey/nethsm/client/model/tag_list.pyi b/pynitrokey/nethsm/client/model/tag_list.pyi deleted file mode 100644 index a91bd1a2..00000000 --- a/pynitrokey/nethsm/client/model/tag_list.pyi +++ /dev/null @@ -1,56 +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 encoded values are Big Endian. # noqa: E501 - - The version of the OpenAPI document: v1 - Generated by: https://openapi-generator.tech -""" - -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from pynitrokey.nethsm.client import schemas # noqa: F401 - - -class TagList( - schemas.ListSchema -): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech - - Do not edit the class manually. - """ - - - class MetaOapg: - - @staticmethod - def items() -> typing.Type['ID']: - return ID - - def __new__( - cls, - arg: typing.Union[typing.Tuple['ID'], typing.List['ID']], - _configuration: typing.Optional[schemas.Configuration] = None, - ) -> 'TagList': - return super().__new__( - cls, - arg, - _configuration=_configuration, - ) - - def __getitem__(self, i: int) -> 'ID': - return super().__getitem__(i) - -from pynitrokey.nethsm.client.model.id import ID diff --git a/pynitrokey/nethsm/client/model/time_config.py b/pynitrokey/nethsm/client/model/time_config.py deleted file mode 100644 index 6110c6c2..00000000 --- a/pynitrokey/nethsm/client/model/time_config.py +++ /dev/null @@ -1,83 +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 encoded values are Big Endian. # noqa: E501 - - The version of the OpenAPI document: v1 - Generated by: https://openapi-generator.tech -""" - -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from pynitrokey.nethsm.client import schemas # noqa: F401 - - -class TimeConfig( - schemas.DictSchema -): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech - - Do not edit the class manually. - """ - - - class MetaOapg: - required = { - "time", - } - - class properties: - time = schemas.DateTimeSchema - __annotations__ = { - "time": time, - } - - time: MetaOapg.properties.time - - @typing.overload - def __getitem__(self, name: typing_extensions.Literal["time"]) -> MetaOapg.properties.time: ... - - @typing.overload - def __getitem__(self, name: str) -> schemas.UnsetAnyTypeSchema: ... - - def __getitem__(self, name: typing.Union[typing_extensions.Literal["time", ], str]): - # dict_instance[name] accessor - return super().__getitem__(name) - - - @typing.overload - def get_item_oapg(self, name: typing_extensions.Literal["time"]) -> MetaOapg.properties.time: ... - - @typing.overload - def get_item_oapg(self, name: str) -> typing.Union[schemas.UnsetAnyTypeSchema, schemas.Unset]: ... - - def get_item_oapg(self, name: typing.Union[typing_extensions.Literal["time", ], str]): - return super().get_item_oapg(name) - - - def __new__( - cls, - *args: typing.Union[dict, frozendict.frozendict, ], - time: typing.Union[MetaOapg.properties.time, str, datetime, ], - _configuration: typing.Optional[schemas.Configuration] = None, - **kwargs: typing.Union[schemas.AnyTypeSchema, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, None, list, tuple, bytes], - ) -> 'TimeConfig': - return super().__new__( - cls, - *args, - time=time, - _configuration=_configuration, - **kwargs, - ) diff --git a/pynitrokey/nethsm/client/model/time_config.pyi b/pynitrokey/nethsm/client/model/time_config.pyi deleted file mode 100644 index 6110c6c2..00000000 --- a/pynitrokey/nethsm/client/model/time_config.pyi +++ /dev/null @@ -1,83 +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 encoded values are Big Endian. # noqa: E501 - - The version of the OpenAPI document: v1 - Generated by: https://openapi-generator.tech -""" - -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from pynitrokey.nethsm.client import schemas # noqa: F401 - - -class TimeConfig( - schemas.DictSchema -): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech - - Do not edit the class manually. - """ - - - class MetaOapg: - required = { - "time", - } - - class properties: - time = schemas.DateTimeSchema - __annotations__ = { - "time": time, - } - - time: MetaOapg.properties.time - - @typing.overload - def __getitem__(self, name: typing_extensions.Literal["time"]) -> MetaOapg.properties.time: ... - - @typing.overload - def __getitem__(self, name: str) -> schemas.UnsetAnyTypeSchema: ... - - def __getitem__(self, name: typing.Union[typing_extensions.Literal["time", ], str]): - # dict_instance[name] accessor - return super().__getitem__(name) - - - @typing.overload - def get_item_oapg(self, name: typing_extensions.Literal["time"]) -> MetaOapg.properties.time: ... - - @typing.overload - def get_item_oapg(self, name: str) -> typing.Union[schemas.UnsetAnyTypeSchema, schemas.Unset]: ... - - def get_item_oapg(self, name: typing.Union[typing_extensions.Literal["time", ], str]): - return super().get_item_oapg(name) - - - def __new__( - cls, - *args: typing.Union[dict, frozendict.frozendict, ], - time: typing.Union[MetaOapg.properties.time, str, datetime, ], - _configuration: typing.Optional[schemas.Configuration] = None, - **kwargs: typing.Union[schemas.AnyTypeSchema, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, None, list, tuple, bytes], - ) -> 'TimeConfig': - return super().__new__( - cls, - *args, - time=time, - _configuration=_configuration, - **kwargs, - ) diff --git a/pynitrokey/nethsm/client/model/tls_key_generate_request_data.py b/pynitrokey/nethsm/client/model/tls_key_generate_request_data.py deleted file mode 100644 index 7b9a530a..00000000 --- a/pynitrokey/nethsm/client/model/tls_key_generate_request_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 encoded values are Big Endian. # noqa: E501 - - The version of the OpenAPI document: v1 - Generated by: https://openapi-generator.tech -""" - -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from pynitrokey.nethsm.client import schemas # noqa: F401 - - -class TlsKeyGenerateRequestData( - schemas.DictSchema -): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech - - Do not edit the class manually. - """ - - - class MetaOapg: - required = { - "type", - } - - class properties: - - @staticmethod - def type() -> typing.Type['TlsKeyType']: - return TlsKeyType - - - class length( - schemas.IntSchema - ): - - - class MetaOapg: - inclusive_maximum = 8192 - inclusive_minimum = 128 - __annotations__ = { - "type": type, - "length": length, - } - - type: 'TlsKeyType' - - @typing.overload - def __getitem__(self, name: typing_extensions.Literal["type"]) -> 'TlsKeyType': ... - - @typing.overload - def __getitem__(self, name: typing_extensions.Literal["length"]) -> MetaOapg.properties.length: ... - - @typing.overload - def __getitem__(self, name: str) -> schemas.UnsetAnyTypeSchema: ... - - def __getitem__(self, name: typing.Union[typing_extensions.Literal["type", "length", ], str]): - # dict_instance[name] accessor - return super().__getitem__(name) - - - @typing.overload - def get_item_oapg(self, name: typing_extensions.Literal["type"]) -> 'TlsKeyType': ... - - @typing.overload - def get_item_oapg(self, name: typing_extensions.Literal["length"]) -> typing.Union[MetaOapg.properties.length, schemas.Unset]: ... - - @typing.overload - def get_item_oapg(self, name: str) -> typing.Union[schemas.UnsetAnyTypeSchema, schemas.Unset]: ... - - def get_item_oapg(self, name: typing.Union[typing_extensions.Literal["type", "length", ], str]): - return super().get_item_oapg(name) - - - def __new__( - cls, - *args: typing.Union[dict, frozendict.frozendict, ], - type: 'TlsKeyType', - length: typing.Union[MetaOapg.properties.length, decimal.Decimal, int, schemas.Unset] = schemas.unset, - _configuration: typing.Optional[schemas.Configuration] = None, - **kwargs: typing.Union[schemas.AnyTypeSchema, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, None, list, tuple, bytes], - ) -> 'TlsKeyGenerateRequestData': - return super().__new__( - cls, - *args, - type=type, - length=length, - _configuration=_configuration, - **kwargs, - ) - -from pynitrokey.nethsm.client.model.tls_key_type import TlsKeyType diff --git a/pynitrokey/nethsm/client/model/tls_key_generate_request_data.pyi b/pynitrokey/nethsm/client/model/tls_key_generate_request_data.pyi deleted file mode 100644 index 6ef4539c..00000000 --- a/pynitrokey/nethsm/client/model/tls_key_generate_request_data.pyi +++ /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 encoded values are Big Endian. # noqa: E501 - - The version of the OpenAPI document: v1 - Generated by: https://openapi-generator.tech -""" - -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from pynitrokey.nethsm.client import schemas # noqa: F401 - - -class TlsKeyGenerateRequestData( - schemas.DictSchema -): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech - - Do not edit the class manually. - """ - - - class MetaOapg: - required = { - "type", - } - - class properties: - - @staticmethod - def type() -> typing.Type['TlsKeyType']: - return TlsKeyType - - - class length( - schemas.IntSchema - ): - pass - __annotations__ = { - "type": type, - "length": length, - } - - type: 'TlsKeyType' - - @typing.overload - def __getitem__(self, name: typing_extensions.Literal["type"]) -> 'TlsKeyType': ... - - @typing.overload - def __getitem__(self, name: typing_extensions.Literal["length"]) -> MetaOapg.properties.length: ... - - @typing.overload - def __getitem__(self, name: str) -> schemas.UnsetAnyTypeSchema: ... - - def __getitem__(self, name: typing.Union[typing_extensions.Literal["type", "length", ], str]): - # dict_instance[name] accessor - return super().__getitem__(name) - - - @typing.overload - def get_item_oapg(self, name: typing_extensions.Literal["type"]) -> 'TlsKeyType': ... - - @typing.overload - def get_item_oapg(self, name: typing_extensions.Literal["length"]) -> typing.Union[MetaOapg.properties.length, schemas.Unset]: ... - - @typing.overload - def get_item_oapg(self, name: str) -> typing.Union[schemas.UnsetAnyTypeSchema, schemas.Unset]: ... - - def get_item_oapg(self, name: typing.Union[typing_extensions.Literal["type", "length", ], str]): - return super().get_item_oapg(name) - - - def __new__( - cls, - *args: typing.Union[dict, frozendict.frozendict, ], - type: 'TlsKeyType', - length: typing.Union[MetaOapg.properties.length, decimal.Decimal, int, schemas.Unset] = schemas.unset, - _configuration: typing.Optional[schemas.Configuration] = None, - **kwargs: typing.Union[schemas.AnyTypeSchema, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, None, list, tuple, bytes], - ) -> 'TlsKeyGenerateRequestData': - return super().__new__( - cls, - *args, - type=type, - length=length, - _configuration=_configuration, - **kwargs, - ) - -from pynitrokey.nethsm.client.model.tls_key_type import TlsKeyType diff --git a/pynitrokey/nethsm/client/model/tls_key_type.py b/pynitrokey/nethsm/client/model/tls_key_type.py deleted file mode 100644 index bfea3ba3..00000000 --- a/pynitrokey/nethsm/client/model/tls_key_type.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 encoded values are Big Endian. # noqa: E501 - - The version of the OpenAPI document: v1 - Generated by: https://openapi-generator.tech -""" - -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from pynitrokey.nethsm.client import schemas # noqa: F401 - - -class TlsKeyType( - schemas.EnumBase, - schemas.StrSchema -): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech - - Do not edit the class manually. - """ - - - class MetaOapg: - enum_value_to_name = { - "RSA": "RSA", - "Curve25519": "CURVE25519", - "EC_P224": "EC_P224", - "EC_P256": "EC_P256", - "EC_P384": "EC_P384", - "EC_P521": "EC_P521", - } - - @schemas.classproperty - def RSA(cls): - return cls("RSA") - - @schemas.classproperty - def CURVE25519(cls): - return cls("Curve25519") - - @schemas.classproperty - def EC_P224(cls): - return cls("EC_P224") - - @schemas.classproperty - def EC_P256(cls): - return cls("EC_P256") - - @schemas.classproperty - def EC_P384(cls): - return cls("EC_P384") - - @schemas.classproperty - def EC_P521(cls): - return cls("EC_P521") diff --git a/pynitrokey/nethsm/client/model/tls_key_type.pyi b/pynitrokey/nethsm/client/model/tls_key_type.pyi deleted file mode 100644 index 93cdb503..00000000 --- a/pynitrokey/nethsm/client/model/tls_key_type.pyi +++ /dev/null @@ -1,58 +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 encoded values are Big Endian. # noqa: E501 - - The version of the OpenAPI document: v1 - Generated by: https://openapi-generator.tech -""" - -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from pynitrokey.nethsm.client import schemas # noqa: F401 - - -class TlsKeyType( - schemas.EnumBase, - schemas.StrSchema -): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech - - Do not edit the class manually. - """ - - @schemas.classproperty - def RSA(cls): - return cls("RSA") - - @schemas.classproperty - def CURVE25519(cls): - return cls("Curve25519") - - @schemas.classproperty - def EC_P224(cls): - return cls("EC_P224") - - @schemas.classproperty - def EC_P256(cls): - return cls("EC_P256") - - @schemas.classproperty - def EC_P384(cls): - return cls("EC_P384") - - @schemas.classproperty - def EC_P521(cls): - return cls("EC_P521") diff --git a/pynitrokey/nethsm/client/model/unattended_boot_config.py b/pynitrokey/nethsm/client/model/unattended_boot_config.py deleted file mode 100644 index 6390a565..00000000 --- a/pynitrokey/nethsm/client/model/unattended_boot_config.py +++ /dev/null @@ -1,88 +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 encoded values are Big Endian. # noqa: E501 - - The version of the OpenAPI document: v1 - Generated by: https://openapi-generator.tech -""" - -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from pynitrokey.nethsm.client import schemas # noqa: F401 - - -class UnattendedBootConfig( - schemas.DictSchema -): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech - - Do not edit the class manually. - """ - - - class MetaOapg: - required = { - "status", - } - - class properties: - - @staticmethod - def status() -> typing.Type['Switch']: - return Switch - __annotations__ = { - "status": status, - } - - status: 'Switch' - - @typing.overload - def __getitem__(self, name: typing_extensions.Literal["status"]) -> 'Switch': ... - - @typing.overload - def __getitem__(self, name: str) -> schemas.UnsetAnyTypeSchema: ... - - def __getitem__(self, name: typing.Union[typing_extensions.Literal["status", ], str]): - # dict_instance[name] accessor - return super().__getitem__(name) - - - @typing.overload - def get_item_oapg(self, name: typing_extensions.Literal["status"]) -> 'Switch': ... - - @typing.overload - def get_item_oapg(self, name: str) -> typing.Union[schemas.UnsetAnyTypeSchema, schemas.Unset]: ... - - def get_item_oapg(self, name: typing.Union[typing_extensions.Literal["status", ], str]): - return super().get_item_oapg(name) - - - def __new__( - cls, - *args: typing.Union[dict, frozendict.frozendict, ], - status: 'Switch', - _configuration: typing.Optional[schemas.Configuration] = None, - **kwargs: typing.Union[schemas.AnyTypeSchema, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, None, list, tuple, bytes], - ) -> 'UnattendedBootConfig': - return super().__new__( - cls, - *args, - status=status, - _configuration=_configuration, - **kwargs, - ) - -from pynitrokey.nethsm.client.model.switch import Switch diff --git a/pynitrokey/nethsm/client/model/unattended_boot_config.pyi b/pynitrokey/nethsm/client/model/unattended_boot_config.pyi deleted file mode 100644 index 6390a565..00000000 --- a/pynitrokey/nethsm/client/model/unattended_boot_config.pyi +++ /dev/null @@ -1,88 +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 encoded values are Big Endian. # noqa: E501 - - The version of the OpenAPI document: v1 - Generated by: https://openapi-generator.tech -""" - -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from pynitrokey.nethsm.client import schemas # noqa: F401 - - -class UnattendedBootConfig( - schemas.DictSchema -): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech - - Do not edit the class manually. - """ - - - class MetaOapg: - required = { - "status", - } - - class properties: - - @staticmethod - def status() -> typing.Type['Switch']: - return Switch - __annotations__ = { - "status": status, - } - - status: 'Switch' - - @typing.overload - def __getitem__(self, name: typing_extensions.Literal["status"]) -> 'Switch': ... - - @typing.overload - def __getitem__(self, name: str) -> schemas.UnsetAnyTypeSchema: ... - - def __getitem__(self, name: typing.Union[typing_extensions.Literal["status", ], str]): - # dict_instance[name] accessor - return super().__getitem__(name) - - - @typing.overload - def get_item_oapg(self, name: typing_extensions.Literal["status"]) -> 'Switch': ... - - @typing.overload - def get_item_oapg(self, name: str) -> typing.Union[schemas.UnsetAnyTypeSchema, schemas.Unset]: ... - - def get_item_oapg(self, name: typing.Union[typing_extensions.Literal["status", ], str]): - return super().get_item_oapg(name) - - - def __new__( - cls, - *args: typing.Union[dict, frozendict.frozendict, ], - status: 'Switch', - _configuration: typing.Optional[schemas.Configuration] = None, - **kwargs: typing.Union[schemas.AnyTypeSchema, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, None, list, tuple, bytes], - ) -> 'UnattendedBootConfig': - return super().__new__( - cls, - *args, - status=status, - _configuration=_configuration, - **kwargs, - ) - -from pynitrokey.nethsm.client.model.switch import Switch diff --git a/pynitrokey/nethsm/client/model/unlock_passphrase_config.py b/pynitrokey/nethsm/client/model/unlock_passphrase_config.py deleted file mode 100644 index 3776c474..00000000 --- a/pynitrokey/nethsm/client/model/unlock_passphrase_config.py +++ /dev/null @@ -1,88 +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 encoded values are Big Endian. # noqa: E501 - - The version of the OpenAPI document: v1 - Generated by: https://openapi-generator.tech -""" - -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from pynitrokey.nethsm.client import schemas # noqa: F401 - - -class UnlockPassphraseConfig( - schemas.DictSchema -): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech - - Do not edit the class manually. - """ - - - class MetaOapg: - required = { - "passphrase", - } - - class properties: - - @staticmethod - def passphrase() -> typing.Type['Passphrase']: - return Passphrase - __annotations__ = { - "passphrase": passphrase, - } - - passphrase: 'Passphrase' - - @typing.overload - def __getitem__(self, name: typing_extensions.Literal["passphrase"]) -> 'Passphrase': ... - - @typing.overload - def __getitem__(self, name: str) -> schemas.UnsetAnyTypeSchema: ... - - def __getitem__(self, name: typing.Union[typing_extensions.Literal["passphrase", ], str]): - # dict_instance[name] accessor - return super().__getitem__(name) - - - @typing.overload - def get_item_oapg(self, name: typing_extensions.Literal["passphrase"]) -> 'Passphrase': ... - - @typing.overload - def get_item_oapg(self, name: str) -> typing.Union[schemas.UnsetAnyTypeSchema, schemas.Unset]: ... - - def get_item_oapg(self, name: typing.Union[typing_extensions.Literal["passphrase", ], str]): - return super().get_item_oapg(name) - - - def __new__( - cls, - *args: typing.Union[dict, frozendict.frozendict, ], - passphrase: 'Passphrase', - _configuration: typing.Optional[schemas.Configuration] = None, - **kwargs: typing.Union[schemas.AnyTypeSchema, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, None, list, tuple, bytes], - ) -> 'UnlockPassphraseConfig': - return super().__new__( - cls, - *args, - passphrase=passphrase, - _configuration=_configuration, - **kwargs, - ) - -from pynitrokey.nethsm.client.model.passphrase import Passphrase diff --git a/pynitrokey/nethsm/client/model/unlock_passphrase_config.pyi b/pynitrokey/nethsm/client/model/unlock_passphrase_config.pyi deleted file mode 100644 index 3776c474..00000000 --- a/pynitrokey/nethsm/client/model/unlock_passphrase_config.pyi +++ /dev/null @@ -1,88 +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 encoded values are Big Endian. # noqa: E501 - - The version of the OpenAPI document: v1 - Generated by: https://openapi-generator.tech -""" - -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from pynitrokey.nethsm.client import schemas # noqa: F401 - - -class UnlockPassphraseConfig( - schemas.DictSchema -): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech - - Do not edit the class manually. - """ - - - class MetaOapg: - required = { - "passphrase", - } - - class properties: - - @staticmethod - def passphrase() -> typing.Type['Passphrase']: - return Passphrase - __annotations__ = { - "passphrase": passphrase, - } - - passphrase: 'Passphrase' - - @typing.overload - def __getitem__(self, name: typing_extensions.Literal["passphrase"]) -> 'Passphrase': ... - - @typing.overload - def __getitem__(self, name: str) -> schemas.UnsetAnyTypeSchema: ... - - def __getitem__(self, name: typing.Union[typing_extensions.Literal["passphrase", ], str]): - # dict_instance[name] accessor - return super().__getitem__(name) - - - @typing.overload - def get_item_oapg(self, name: typing_extensions.Literal["passphrase"]) -> 'Passphrase': ... - - @typing.overload - def get_item_oapg(self, name: str) -> typing.Union[schemas.UnsetAnyTypeSchema, schemas.Unset]: ... - - def get_item_oapg(self, name: typing.Union[typing_extensions.Literal["passphrase", ], str]): - return super().get_item_oapg(name) - - - def __new__( - cls, - *args: typing.Union[dict, frozendict.frozendict, ], - passphrase: 'Passphrase', - _configuration: typing.Optional[schemas.Configuration] = None, - **kwargs: typing.Union[schemas.AnyTypeSchema, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, None, list, tuple, bytes], - ) -> 'UnlockPassphraseConfig': - return super().__new__( - cls, - *args, - passphrase=passphrase, - _configuration=_configuration, - **kwargs, - ) - -from pynitrokey.nethsm.client.model.passphrase import Passphrase diff --git a/pynitrokey/nethsm/client/model/unlock_request_data.py b/pynitrokey/nethsm/client/model/unlock_request_data.py deleted file mode 100644 index e4ba8273..00000000 --- a/pynitrokey/nethsm/client/model/unlock_request_data.py +++ /dev/null @@ -1,88 +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 encoded values are Big Endian. # noqa: E501 - - The version of the OpenAPI document: v1 - Generated by: https://openapi-generator.tech -""" - -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from pynitrokey.nethsm.client import schemas # noqa: F401 - - -class UnlockRequestData( - schemas.DictSchema -): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech - - Do not edit the class manually. - """ - - - class MetaOapg: - required = { - "passphrase", - } - - class properties: - - @staticmethod - def passphrase() -> typing.Type['Passphrase']: - return Passphrase - __annotations__ = { - "passphrase": passphrase, - } - - passphrase: 'Passphrase' - - @typing.overload - def __getitem__(self, name: typing_extensions.Literal["passphrase"]) -> 'Passphrase': ... - - @typing.overload - def __getitem__(self, name: str) -> schemas.UnsetAnyTypeSchema: ... - - def __getitem__(self, name: typing.Union[typing_extensions.Literal["passphrase", ], str]): - # dict_instance[name] accessor - return super().__getitem__(name) - - - @typing.overload - def get_item_oapg(self, name: typing_extensions.Literal["passphrase"]) -> 'Passphrase': ... - - @typing.overload - def get_item_oapg(self, name: str) -> typing.Union[schemas.UnsetAnyTypeSchema, schemas.Unset]: ... - - def get_item_oapg(self, name: typing.Union[typing_extensions.Literal["passphrase", ], str]): - return super().get_item_oapg(name) - - - def __new__( - cls, - *args: typing.Union[dict, frozendict.frozendict, ], - passphrase: 'Passphrase', - _configuration: typing.Optional[schemas.Configuration] = None, - **kwargs: typing.Union[schemas.AnyTypeSchema, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, None, list, tuple, bytes], - ) -> 'UnlockRequestData': - return super().__new__( - cls, - *args, - passphrase=passphrase, - _configuration=_configuration, - **kwargs, - ) - -from pynitrokey.nethsm.client.model.passphrase import Passphrase diff --git a/pynitrokey/nethsm/client/model/unlock_request_data.pyi b/pynitrokey/nethsm/client/model/unlock_request_data.pyi deleted file mode 100644 index e4ba8273..00000000 --- a/pynitrokey/nethsm/client/model/unlock_request_data.pyi +++ /dev/null @@ -1,88 +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 encoded values are Big Endian. # noqa: E501 - - The version of the OpenAPI document: v1 - Generated by: https://openapi-generator.tech -""" - -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from pynitrokey.nethsm.client import schemas # noqa: F401 - - -class UnlockRequestData( - schemas.DictSchema -): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech - - Do not edit the class manually. - """ - - - class MetaOapg: - required = { - "passphrase", - } - - class properties: - - @staticmethod - def passphrase() -> typing.Type['Passphrase']: - return Passphrase - __annotations__ = { - "passphrase": passphrase, - } - - passphrase: 'Passphrase' - - @typing.overload - def __getitem__(self, name: typing_extensions.Literal["passphrase"]) -> 'Passphrase': ... - - @typing.overload - def __getitem__(self, name: str) -> schemas.UnsetAnyTypeSchema: ... - - def __getitem__(self, name: typing.Union[typing_extensions.Literal["passphrase", ], str]): - # dict_instance[name] accessor - return super().__getitem__(name) - - - @typing.overload - def get_item_oapg(self, name: typing_extensions.Literal["passphrase"]) -> 'Passphrase': ... - - @typing.overload - def get_item_oapg(self, name: str) -> typing.Union[schemas.UnsetAnyTypeSchema, schemas.Unset]: ... - - def get_item_oapg(self, name: typing.Union[typing_extensions.Literal["passphrase", ], str]): - return super().get_item_oapg(name) - - - def __new__( - cls, - *args: typing.Union[dict, frozendict.frozendict, ], - passphrase: 'Passphrase', - _configuration: typing.Optional[schemas.Configuration] = None, - **kwargs: typing.Union[schemas.AnyTypeSchema, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, None, list, tuple, bytes], - ) -> 'UnlockRequestData': - return super().__new__( - cls, - *args, - passphrase=passphrase, - _configuration=_configuration, - **kwargs, - ) - -from pynitrokey.nethsm.client.model.passphrase import Passphrase diff --git a/pynitrokey/nethsm/client/model/user_data.py b/pynitrokey/nethsm/client/model/user_data.py deleted file mode 100644 index 0ae5fcc1..00000000 --- a/pynitrokey/nethsm/client/model/user_data.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 encoded values are Big Endian. # noqa: E501 - - The version of the OpenAPI document: v1 - Generated by: https://openapi-generator.tech -""" - -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from pynitrokey.nethsm.client import schemas # noqa: F401 - - -class UserData( - schemas.DictSchema -): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech - - Do not edit the class manually. - """ - - - class MetaOapg: - required = { - "realName", - "role", - } - - class properties: - realName = schemas.StrSchema - - @staticmethod - def role() -> typing.Type['UserRole']: - return UserRole - __annotations__ = { - "realName": realName, - "role": role, - } - - realName: MetaOapg.properties.realName - role: 'UserRole' - - @typing.overload - def __getitem__(self, name: typing_extensions.Literal["realName"]) -> MetaOapg.properties.realName: ... - - @typing.overload - def __getitem__(self, name: typing_extensions.Literal["role"]) -> 'UserRole': ... - - @typing.overload - def __getitem__(self, name: str) -> schemas.UnsetAnyTypeSchema: ... - - def __getitem__(self, name: typing.Union[typing_extensions.Literal["realName", "role", ], str]): - # dict_instance[name] accessor - return super().__getitem__(name) - - - @typing.overload - def get_item_oapg(self, name: typing_extensions.Literal["realName"]) -> MetaOapg.properties.realName: ... - - @typing.overload - def get_item_oapg(self, name: typing_extensions.Literal["role"]) -> 'UserRole': ... - - @typing.overload - def get_item_oapg(self, name: str) -> typing.Union[schemas.UnsetAnyTypeSchema, schemas.Unset]: ... - - def get_item_oapg(self, name: typing.Union[typing_extensions.Literal["realName", "role", ], str]): - return super().get_item_oapg(name) - - - def __new__( - cls, - *args: typing.Union[dict, frozendict.frozendict, ], - realName: typing.Union[MetaOapg.properties.realName, str, ], - role: 'UserRole', - _configuration: typing.Optional[schemas.Configuration] = None, - **kwargs: typing.Union[schemas.AnyTypeSchema, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, None, list, tuple, bytes], - ) -> 'UserData': - return super().__new__( - cls, - *args, - realName=realName, - role=role, - _configuration=_configuration, - **kwargs, - ) - -from pynitrokey.nethsm.client.model.user_role import UserRole diff --git a/pynitrokey/nethsm/client/model/user_data.pyi b/pynitrokey/nethsm/client/model/user_data.pyi deleted file mode 100644 index 0ae5fcc1..00000000 --- a/pynitrokey/nethsm/client/model/user_data.pyi +++ /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 encoded values are Big Endian. # noqa: E501 - - The version of the OpenAPI document: v1 - Generated by: https://openapi-generator.tech -""" - -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from pynitrokey.nethsm.client import schemas # noqa: F401 - - -class UserData( - schemas.DictSchema -): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech - - Do not edit the class manually. - """ - - - class MetaOapg: - required = { - "realName", - "role", - } - - class properties: - realName = schemas.StrSchema - - @staticmethod - def role() -> typing.Type['UserRole']: - return UserRole - __annotations__ = { - "realName": realName, - "role": role, - } - - realName: MetaOapg.properties.realName - role: 'UserRole' - - @typing.overload - def __getitem__(self, name: typing_extensions.Literal["realName"]) -> MetaOapg.properties.realName: ... - - @typing.overload - def __getitem__(self, name: typing_extensions.Literal["role"]) -> 'UserRole': ... - - @typing.overload - def __getitem__(self, name: str) -> schemas.UnsetAnyTypeSchema: ... - - def __getitem__(self, name: typing.Union[typing_extensions.Literal["realName", "role", ], str]): - # dict_instance[name] accessor - return super().__getitem__(name) - - - @typing.overload - def get_item_oapg(self, name: typing_extensions.Literal["realName"]) -> MetaOapg.properties.realName: ... - - @typing.overload - def get_item_oapg(self, name: typing_extensions.Literal["role"]) -> 'UserRole': ... - - @typing.overload - def get_item_oapg(self, name: str) -> typing.Union[schemas.UnsetAnyTypeSchema, schemas.Unset]: ... - - def get_item_oapg(self, name: typing.Union[typing_extensions.Literal["realName", "role", ], str]): - return super().get_item_oapg(name) - - - def __new__( - cls, - *args: typing.Union[dict, frozendict.frozendict, ], - realName: typing.Union[MetaOapg.properties.realName, str, ], - role: 'UserRole', - _configuration: typing.Optional[schemas.Configuration] = None, - **kwargs: typing.Union[schemas.AnyTypeSchema, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, None, list, tuple, bytes], - ) -> 'UserData': - return super().__new__( - cls, - *args, - realName=realName, - role=role, - _configuration=_configuration, - **kwargs, - ) - -from pynitrokey.nethsm.client.model.user_role import UserRole diff --git a/pynitrokey/nethsm/client/model/user_item.py b/pynitrokey/nethsm/client/model/user_item.py deleted file mode 100644 index 420502d1..00000000 --- a/pynitrokey/nethsm/client/model/user_item.py +++ /dev/null @@ -1,88 +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 encoded values are Big Endian. # noqa: E501 - - The version of the OpenAPI document: v1 - Generated by: https://openapi-generator.tech -""" - -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from pynitrokey.nethsm.client import schemas # noqa: F401 - - -class UserItem( - schemas.DictSchema -): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech - - Do not edit the class manually. - """ - - - class MetaOapg: - required = { - "user", - } - - class properties: - - @staticmethod - def user() -> typing.Type['ID']: - return ID - __annotations__ = { - "user": user, - } - - user: 'ID' - - @typing.overload - def __getitem__(self, name: typing_extensions.Literal["user"]) -> 'ID': ... - - @typing.overload - def __getitem__(self, name: str) -> schemas.UnsetAnyTypeSchema: ... - - def __getitem__(self, name: typing.Union[typing_extensions.Literal["user", ], str]): - # dict_instance[name] accessor - return super().__getitem__(name) - - - @typing.overload - def get_item_oapg(self, name: typing_extensions.Literal["user"]) -> 'ID': ... - - @typing.overload - def get_item_oapg(self, name: str) -> typing.Union[schemas.UnsetAnyTypeSchema, schemas.Unset]: ... - - def get_item_oapg(self, name: typing.Union[typing_extensions.Literal["user", ], str]): - return super().get_item_oapg(name) - - - def __new__( - cls, - *args: typing.Union[dict, frozendict.frozendict, ], - user: 'ID', - _configuration: typing.Optional[schemas.Configuration] = None, - **kwargs: typing.Union[schemas.AnyTypeSchema, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, None, list, tuple, bytes], - ) -> 'UserItem': - return super().__new__( - cls, - *args, - user=user, - _configuration=_configuration, - **kwargs, - ) - -from pynitrokey.nethsm.client.model.id import ID diff --git a/pynitrokey/nethsm/client/model/user_item.pyi b/pynitrokey/nethsm/client/model/user_item.pyi deleted file mode 100644 index 420502d1..00000000 --- a/pynitrokey/nethsm/client/model/user_item.pyi +++ /dev/null @@ -1,88 +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 encoded values are Big Endian. # noqa: E501 - - The version of the OpenAPI document: v1 - Generated by: https://openapi-generator.tech -""" - -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from pynitrokey.nethsm.client import schemas # noqa: F401 - - -class UserItem( - schemas.DictSchema -): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech - - Do not edit the class manually. - """ - - - class MetaOapg: - required = { - "user", - } - - class properties: - - @staticmethod - def user() -> typing.Type['ID']: - return ID - __annotations__ = { - "user": user, - } - - user: 'ID' - - @typing.overload - def __getitem__(self, name: typing_extensions.Literal["user"]) -> 'ID': ... - - @typing.overload - def __getitem__(self, name: str) -> schemas.UnsetAnyTypeSchema: ... - - def __getitem__(self, name: typing.Union[typing_extensions.Literal["user", ], str]): - # dict_instance[name] accessor - return super().__getitem__(name) - - - @typing.overload - def get_item_oapg(self, name: typing_extensions.Literal["user"]) -> 'ID': ... - - @typing.overload - def get_item_oapg(self, name: str) -> typing.Union[schemas.UnsetAnyTypeSchema, schemas.Unset]: ... - - def get_item_oapg(self, name: typing.Union[typing_extensions.Literal["user", ], str]): - return super().get_item_oapg(name) - - - def __new__( - cls, - *args: typing.Union[dict, frozendict.frozendict, ], - user: 'ID', - _configuration: typing.Optional[schemas.Configuration] = None, - **kwargs: typing.Union[schemas.AnyTypeSchema, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, None, list, tuple, bytes], - ) -> 'UserItem': - return super().__new__( - cls, - *args, - user=user, - _configuration=_configuration, - **kwargs, - ) - -from pynitrokey.nethsm.client.model.id import ID diff --git a/pynitrokey/nethsm/client/model/user_list.py b/pynitrokey/nethsm/client/model/user_list.py deleted file mode 100644 index 53900ee6..00000000 --- a/pynitrokey/nethsm/client/model/user_list.py +++ /dev/null @@ -1,56 +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 encoded values are Big Endian. # noqa: E501 - - The version of the OpenAPI document: v1 - Generated by: https://openapi-generator.tech -""" - -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from pynitrokey.nethsm.client import schemas # noqa: F401 - - -class UserList( - schemas.ListSchema -): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech - - Do not edit the class manually. - """ - - - class MetaOapg: - - @staticmethod - def items() -> typing.Type['UserItem']: - return UserItem - - def __new__( - cls, - arg: typing.Union[typing.Tuple['UserItem'], typing.List['UserItem']], - _configuration: typing.Optional[schemas.Configuration] = None, - ) -> 'UserList': - return super().__new__( - cls, - arg, - _configuration=_configuration, - ) - - def __getitem__(self, i: int) -> 'UserItem': - return super().__getitem__(i) - -from pynitrokey.nethsm.client.model.user_item import UserItem diff --git a/pynitrokey/nethsm/client/model/user_list.pyi b/pynitrokey/nethsm/client/model/user_list.pyi deleted file mode 100644 index 53900ee6..00000000 --- a/pynitrokey/nethsm/client/model/user_list.pyi +++ /dev/null @@ -1,56 +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 encoded values are Big Endian. # noqa: E501 - - The version of the OpenAPI document: v1 - Generated by: https://openapi-generator.tech -""" - -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from pynitrokey.nethsm.client import schemas # noqa: F401 - - -class UserList( - schemas.ListSchema -): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech - - Do not edit the class manually. - """ - - - class MetaOapg: - - @staticmethod - def items() -> typing.Type['UserItem']: - return UserItem - - def __new__( - cls, - arg: typing.Union[typing.Tuple['UserItem'], typing.List['UserItem']], - _configuration: typing.Optional[schemas.Configuration] = None, - ) -> 'UserList': - return super().__new__( - cls, - arg, - _configuration=_configuration, - ) - - def __getitem__(self, i: int) -> 'UserItem': - return super().__getitem__(i) - -from pynitrokey.nethsm.client.model.user_item import UserItem diff --git a/pynitrokey/nethsm/client/model/user_passphrase_post_data.py b/pynitrokey/nethsm/client/model/user_passphrase_post_data.py deleted file mode 100644 index 1039c9e8..00000000 --- a/pynitrokey/nethsm/client/model/user_passphrase_post_data.py +++ /dev/null @@ -1,88 +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 encoded values are Big Endian. # noqa: E501 - - The version of the OpenAPI document: v1 - Generated by: https://openapi-generator.tech -""" - -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from pynitrokey.nethsm.client import schemas # noqa: F401 - - -class UserPassphrasePostData( - schemas.DictSchema -): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech - - Do not edit the class manually. - """ - - - class MetaOapg: - required = { - "passphrase", - } - - class properties: - - @staticmethod - def passphrase() -> typing.Type['Passphrase']: - return Passphrase - __annotations__ = { - "passphrase": passphrase, - } - - passphrase: 'Passphrase' - - @typing.overload - def __getitem__(self, name: typing_extensions.Literal["passphrase"]) -> 'Passphrase': ... - - @typing.overload - def __getitem__(self, name: str) -> schemas.UnsetAnyTypeSchema: ... - - def __getitem__(self, name: typing.Union[typing_extensions.Literal["passphrase", ], str]): - # dict_instance[name] accessor - return super().__getitem__(name) - - - @typing.overload - def get_item_oapg(self, name: typing_extensions.Literal["passphrase"]) -> 'Passphrase': ... - - @typing.overload - def get_item_oapg(self, name: str) -> typing.Union[schemas.UnsetAnyTypeSchema, schemas.Unset]: ... - - def get_item_oapg(self, name: typing.Union[typing_extensions.Literal["passphrase", ], str]): - return super().get_item_oapg(name) - - - def __new__( - cls, - *args: typing.Union[dict, frozendict.frozendict, ], - passphrase: 'Passphrase', - _configuration: typing.Optional[schemas.Configuration] = None, - **kwargs: typing.Union[schemas.AnyTypeSchema, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, None, list, tuple, bytes], - ) -> 'UserPassphrasePostData': - return super().__new__( - cls, - *args, - passphrase=passphrase, - _configuration=_configuration, - **kwargs, - ) - -from pynitrokey.nethsm.client.model.passphrase import Passphrase diff --git a/pynitrokey/nethsm/client/model/user_passphrase_post_data.pyi b/pynitrokey/nethsm/client/model/user_passphrase_post_data.pyi deleted file mode 100644 index 1039c9e8..00000000 --- a/pynitrokey/nethsm/client/model/user_passphrase_post_data.pyi +++ /dev/null @@ -1,88 +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 encoded values are Big Endian. # noqa: E501 - - The version of the OpenAPI document: v1 - Generated by: https://openapi-generator.tech -""" - -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from pynitrokey.nethsm.client import schemas # noqa: F401 - - -class UserPassphrasePostData( - schemas.DictSchema -): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech - - Do not edit the class manually. - """ - - - class MetaOapg: - required = { - "passphrase", - } - - class properties: - - @staticmethod - def passphrase() -> typing.Type['Passphrase']: - return Passphrase - __annotations__ = { - "passphrase": passphrase, - } - - passphrase: 'Passphrase' - - @typing.overload - def __getitem__(self, name: typing_extensions.Literal["passphrase"]) -> 'Passphrase': ... - - @typing.overload - def __getitem__(self, name: str) -> schemas.UnsetAnyTypeSchema: ... - - def __getitem__(self, name: typing.Union[typing_extensions.Literal["passphrase", ], str]): - # dict_instance[name] accessor - return super().__getitem__(name) - - - @typing.overload - def get_item_oapg(self, name: typing_extensions.Literal["passphrase"]) -> 'Passphrase': ... - - @typing.overload - def get_item_oapg(self, name: str) -> typing.Union[schemas.UnsetAnyTypeSchema, schemas.Unset]: ... - - def get_item_oapg(self, name: typing.Union[typing_extensions.Literal["passphrase", ], str]): - return super().get_item_oapg(name) - - - def __new__( - cls, - *args: typing.Union[dict, frozendict.frozendict, ], - passphrase: 'Passphrase', - _configuration: typing.Optional[schemas.Configuration] = None, - **kwargs: typing.Union[schemas.AnyTypeSchema, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, None, list, tuple, bytes], - ) -> 'UserPassphrasePostData': - return super().__new__( - cls, - *args, - passphrase=passphrase, - _configuration=_configuration, - **kwargs, - ) - -from pynitrokey.nethsm.client.model.passphrase import Passphrase diff --git a/pynitrokey/nethsm/client/model/user_post_data.py b/pynitrokey/nethsm/client/model/user_post_data.py deleted file mode 100644 index eeeae801..00000000 --- a/pynitrokey/nethsm/client/model/user_post_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 encoded values are Big Endian. # noqa: E501 - - The version of the OpenAPI document: v1 - Generated by: https://openapi-generator.tech -""" - -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from pynitrokey.nethsm.client import schemas # noqa: F401 - - -class UserPostData( - schemas.DictSchema -): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech - - Do not edit the class manually. - """ - - - class MetaOapg: - required = { - "realName", - "role", - "passphrase", - } - - class properties: - realName = schemas.StrSchema - - @staticmethod - def role() -> typing.Type['UserRole']: - return UserRole - - @staticmethod - def passphrase() -> typing.Type['Passphrase']: - return Passphrase - __annotations__ = { - "realName": realName, - "role": role, - "passphrase": passphrase, - } - - realName: MetaOapg.properties.realName - role: 'UserRole' - passphrase: 'Passphrase' - - @typing.overload - def __getitem__(self, name: typing_extensions.Literal["realName"]) -> MetaOapg.properties.realName: ... - - @typing.overload - def __getitem__(self, name: typing_extensions.Literal["role"]) -> 'UserRole': ... - - @typing.overload - def __getitem__(self, name: typing_extensions.Literal["passphrase"]) -> 'Passphrase': ... - - @typing.overload - def __getitem__(self, name: str) -> schemas.UnsetAnyTypeSchema: ... - - def __getitem__(self, name: typing.Union[typing_extensions.Literal["realName", "role", "passphrase", ], str]): - # dict_instance[name] accessor - return super().__getitem__(name) - - - @typing.overload - def get_item_oapg(self, name: typing_extensions.Literal["realName"]) -> MetaOapg.properties.realName: ... - - @typing.overload - def get_item_oapg(self, name: typing_extensions.Literal["role"]) -> 'UserRole': ... - - @typing.overload - def get_item_oapg(self, name: typing_extensions.Literal["passphrase"]) -> 'Passphrase': ... - - @typing.overload - def get_item_oapg(self, name: str) -> typing.Union[schemas.UnsetAnyTypeSchema, schemas.Unset]: ... - - def get_item_oapg(self, name: typing.Union[typing_extensions.Literal["realName", "role", "passphrase", ], str]): - return super().get_item_oapg(name) - - - def __new__( - cls, - *args: typing.Union[dict, frozendict.frozendict, ], - realName: typing.Union[MetaOapg.properties.realName, str, ], - role: 'UserRole', - passphrase: 'Passphrase', - _configuration: typing.Optional[schemas.Configuration] = None, - **kwargs: typing.Union[schemas.AnyTypeSchema, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, None, list, tuple, bytes], - ) -> 'UserPostData': - return super().__new__( - cls, - *args, - realName=realName, - role=role, - passphrase=passphrase, - _configuration=_configuration, - **kwargs, - ) - -from pynitrokey.nethsm.client.model.passphrase import Passphrase -from pynitrokey.nethsm.client.model.user_role import UserRole diff --git a/pynitrokey/nethsm/client/model/user_post_data.pyi b/pynitrokey/nethsm/client/model/user_post_data.pyi deleted file mode 100644 index eeeae801..00000000 --- a/pynitrokey/nethsm/client/model/user_post_data.pyi +++ /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 encoded values are Big Endian. # noqa: E501 - - The version of the OpenAPI document: v1 - Generated by: https://openapi-generator.tech -""" - -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from pynitrokey.nethsm.client import schemas # noqa: F401 - - -class UserPostData( - schemas.DictSchema -): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech - - Do not edit the class manually. - """ - - - class MetaOapg: - required = { - "realName", - "role", - "passphrase", - } - - class properties: - realName = schemas.StrSchema - - @staticmethod - def role() -> typing.Type['UserRole']: - return UserRole - - @staticmethod - def passphrase() -> typing.Type['Passphrase']: - return Passphrase - __annotations__ = { - "realName": realName, - "role": role, - "passphrase": passphrase, - } - - realName: MetaOapg.properties.realName - role: 'UserRole' - passphrase: 'Passphrase' - - @typing.overload - def __getitem__(self, name: typing_extensions.Literal["realName"]) -> MetaOapg.properties.realName: ... - - @typing.overload - def __getitem__(self, name: typing_extensions.Literal["role"]) -> 'UserRole': ... - - @typing.overload - def __getitem__(self, name: typing_extensions.Literal["passphrase"]) -> 'Passphrase': ... - - @typing.overload - def __getitem__(self, name: str) -> schemas.UnsetAnyTypeSchema: ... - - def __getitem__(self, name: typing.Union[typing_extensions.Literal["realName", "role", "passphrase", ], str]): - # dict_instance[name] accessor - return super().__getitem__(name) - - - @typing.overload - def get_item_oapg(self, name: typing_extensions.Literal["realName"]) -> MetaOapg.properties.realName: ... - - @typing.overload - def get_item_oapg(self, name: typing_extensions.Literal["role"]) -> 'UserRole': ... - - @typing.overload - def get_item_oapg(self, name: typing_extensions.Literal["passphrase"]) -> 'Passphrase': ... - - @typing.overload - def get_item_oapg(self, name: str) -> typing.Union[schemas.UnsetAnyTypeSchema, schemas.Unset]: ... - - def get_item_oapg(self, name: typing.Union[typing_extensions.Literal["realName", "role", "passphrase", ], str]): - return super().get_item_oapg(name) - - - def __new__( - cls, - *args: typing.Union[dict, frozendict.frozendict, ], - realName: typing.Union[MetaOapg.properties.realName, str, ], - role: 'UserRole', - passphrase: 'Passphrase', - _configuration: typing.Optional[schemas.Configuration] = None, - **kwargs: typing.Union[schemas.AnyTypeSchema, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, None, list, tuple, bytes], - ) -> 'UserPostData': - return super().__new__( - cls, - *args, - realName=realName, - role=role, - passphrase=passphrase, - _configuration=_configuration, - **kwargs, - ) - -from pynitrokey.nethsm.client.model.passphrase import Passphrase -from pynitrokey.nethsm.client.model.user_role import UserRole diff --git a/pynitrokey/nethsm/client/model/user_role.py b/pynitrokey/nethsm/client/model/user_role.py deleted file mode 100644 index 4ac3f210..00000000 --- a/pynitrokey/nethsm/client/model/user_role.py +++ /dev/null @@ -1,59 +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 encoded values are Big Endian. # noqa: E501 - - The version of the OpenAPI document: v1 - Generated by: https://openapi-generator.tech -""" - -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from pynitrokey.nethsm.client import schemas # noqa: F401 - - -class UserRole( - schemas.EnumBase, - schemas.StrSchema -): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech - - Do not edit the class manually. - """ - - - class MetaOapg: - enum_value_to_name = { - "Administrator": "ADMINISTRATOR", - "Operator": "OPERATOR", - "Metrics": "METRICS", - "Backup": "BACKUP", - } - - @schemas.classproperty - def ADMINISTRATOR(cls): - return cls("Administrator") - - @schemas.classproperty - def OPERATOR(cls): - return cls("Operator") - - @schemas.classproperty - def METRICS(cls): - return cls("Metrics") - - @schemas.classproperty - def BACKUP(cls): - return cls("Backup") diff --git a/pynitrokey/nethsm/client/model/user_role.pyi b/pynitrokey/nethsm/client/model/user_role.pyi deleted file mode 100644 index cbe3ecfa..00000000 --- a/pynitrokey/nethsm/client/model/user_role.pyi +++ /dev/null @@ -1,50 +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 encoded values are Big Endian. # noqa: E501 - - The version of the OpenAPI document: v1 - Generated by: https://openapi-generator.tech -""" - -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from pynitrokey.nethsm.client import schemas # noqa: F401 - - -class UserRole( - schemas.EnumBase, - schemas.StrSchema -): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech - - Do not edit the class manually. - """ - - @schemas.classproperty - def ADMINISTRATOR(cls): - return cls("Administrator") - - @schemas.classproperty - def OPERATOR(cls): - return cls("Operator") - - @schemas.classproperty - def METRICS(cls): - return cls("Metrics") - - @schemas.classproperty - def BACKUP(cls): - return cls("Backup") diff --git a/pynitrokey/nethsm/client/models/__init__.py b/pynitrokey/nethsm/client/models/__init__.py deleted file mode 100644 index 189aeb8a..00000000 --- a/pynitrokey/nethsm/client/models/__init__.py +++ /dev/null @@ -1,68 +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.model.pet import Pet -# or import this package, but before doing it, use: -# import sys -# sys.setrecursionlimit(n) - -from pynitrokey.nethsm.client.model.backup_passphrase_config import BackupPassphraseConfig -from pynitrokey.nethsm.client.model.base64 import Base64 -from pynitrokey.nethsm.client.model.decrypt_data import DecryptData -from pynitrokey.nethsm.client.model.decrypt_mode import DecryptMode -from pynitrokey.nethsm.client.model.decrypt_request_data import DecryptRequestData -from pynitrokey.nethsm.client.model.distinguished_name import DistinguishedName -from pynitrokey.nethsm.client.model.encrypt_data import EncryptData -from pynitrokey.nethsm.client.model.encrypt_mode import EncryptMode -from pynitrokey.nethsm.client.model.encrypt_request_data import EncryptRequestData -from pynitrokey.nethsm.client.model.health_state_data import HealthStateData -from pynitrokey.nethsm.client.model.id import ID -from pynitrokey.nethsm.client.model.info_data import InfoData -from pynitrokey.nethsm.client.model.key_generate_request_data import KeyGenerateRequestData -from pynitrokey.nethsm.client.model.key_item import KeyItem -from pynitrokey.nethsm.client.model.key_list import KeyList -from pynitrokey.nethsm.client.model.key_mechanism import KeyMechanism -from pynitrokey.nethsm.client.model.key_mechanisms import KeyMechanisms -from pynitrokey.nethsm.client.model.key_private_data import KeyPrivateData -from pynitrokey.nethsm.client.model.key_public_data import KeyPublicData -from pynitrokey.nethsm.client.model.key_restrictions import KeyRestrictions -from pynitrokey.nethsm.client.model.key_type import KeyType -from pynitrokey.nethsm.client.model.log_level import LogLevel -from pynitrokey.nethsm.client.model.logging_config import LoggingConfig -from pynitrokey.nethsm.client.model.network_config import NetworkConfig -from pynitrokey.nethsm.client.model.pgp_private_key import PGPPrivateKey -from pynitrokey.nethsm.client.model.passphrase import Passphrase -from pynitrokey.nethsm.client.model.pem_csr import PemCSR -from pynitrokey.nethsm.client.model.pem_cert import PemCert -from pynitrokey.nethsm.client.model.pem_private_key import PemPrivateKey -from pynitrokey.nethsm.client.model.pem_public_key import PemPublicKey -from pynitrokey.nethsm.client.model.private_key import PrivateKey -from pynitrokey.nethsm.client.model.provision_request_data import ProvisionRequestData -from pynitrokey.nethsm.client.model.public_key import PublicKey -from pynitrokey.nethsm.client.model.random_data import RandomData -from pynitrokey.nethsm.client.model.random_request_data import RandomRequestData -from pynitrokey.nethsm.client.model.sign_data import SignData -from pynitrokey.nethsm.client.model.sign_mode import SignMode -from pynitrokey.nethsm.client.model.sign_request_data import SignRequestData -from pynitrokey.nethsm.client.model.switch import Switch -from pynitrokey.nethsm.client.model.system_info import SystemInfo -from pynitrokey.nethsm.client.model.system_state import SystemState -from pynitrokey.nethsm.client.model.system_update_data import SystemUpdateData -from pynitrokey.nethsm.client.model.tag_list import TagList -from pynitrokey.nethsm.client.model.time_config import TimeConfig -from pynitrokey.nethsm.client.model.tls_key_generate_request_data import TlsKeyGenerateRequestData -from pynitrokey.nethsm.client.model.tls_key_type import TlsKeyType -from pynitrokey.nethsm.client.model.unattended_boot_config import UnattendedBootConfig -from pynitrokey.nethsm.client.model.unlock_passphrase_config import UnlockPassphraseConfig -from pynitrokey.nethsm.client.model.unlock_request_data import UnlockRequestData -from pynitrokey.nethsm.client.model.user_data import UserData -from pynitrokey.nethsm.client.model.user_item import UserItem -from pynitrokey.nethsm.client.model.user_list import UserList -from pynitrokey.nethsm.client.model.user_passphrase_post_data import UserPassphrasePostData -from pynitrokey.nethsm.client.model.user_post_data import UserPostData -from pynitrokey.nethsm.client.model.user_role import UserRole diff --git a/pynitrokey/nethsm/client/paths/__init__.py b/pynitrokey/nethsm/client/paths/__init__.py index 14dba8f8..09cb64f2 100644 --- a/pynitrokey/nethsm/client/paths/__init__.py +++ b/pynitrokey/nethsm/client/paths/__init__.py @@ -1,51 +1,3 @@ # 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 - -import enum - - -class PathValues(str, enum.Enum): - INFO = "/info" - HEALTH_ALIVE = "/health/alive" - HEALTH_READY = "/health/ready" - HEALTH_STATE = "/health/state" - METRICS = "/metrics" - PROVISION = "/provision" - UNLOCK = "/unlock" - LOCK = "/lock" - RANDOM = "/random" - KEYS = "/keys" - KEYS_GENERATE = "/keys/generate" - KEYS_KEY_ID = "/keys/{KeyID}" - KEYS_KEY_ID_PUBLIC_PEM = "/keys/{KeyID}/public.pem" - KEYS_KEY_ID_CSR_PEM = "/keys/{KeyID}/csr.pem" - KEYS_KEY_ID_DECRYPT = "/keys/{KeyID}/decrypt" - KEYS_KEY_ID_ENCRYPT = "/keys/{KeyID}/encrypt" - KEYS_KEY_ID_SIGN = "/keys/{KeyID}/sign" - KEYS_KEY_ID_CERT = "/keys/{KeyID}/cert" - KEYS_KEY_ID_RESTRICTIONS_TAGS_TAG = "/keys/{KeyID}/restrictions/tags/{Tag}" - USERS = "/users" - USERS_USER_ID = "/users/{UserID}" - USERS_USER_ID_PASSPHRASE = "/users/{UserID}/passphrase" - USERS_USER_ID_TAGS = "/users/{UserID}/tags" - USERS_USER_ID_TAGS_TAG = "/users/{UserID}/tags/{Tag}" - CONFIG_UNLOCKPASSPHRASE = "/config/unlock-passphrase" - CONFIG_UNATTENDEDBOOT = "/config/unattended-boot" - CONFIG_TLS_PUBLIC_PEM = "/config/tls/public.pem" - CONFIG_TLS_CERT_PEM = "/config/tls/cert.pem" - CONFIG_TLS_CSR_PEM = "/config/tls/csr.pem" - CONFIG_TLS_GENERATE = "/config/tls/generate" - CONFIG_NETWORK = "/config/network" - CONFIG_LOGGING = "/config/logging" - CONFIG_BACKUPPASSPHRASE = "/config/backup-passphrase" - CONFIG_TIME = "/config/time" - SYSTEM_INFO = "/system/info" - SYSTEM_REBOOT = "/system/reboot" - SYSTEM_SHUTDOWN = "/system/shutdown" - SYSTEM_FACTORYRESET = "/system/factory-reset" - SYSTEM_UPDATE = "/system/update" - SYSTEM_COMMITUPDATE = "/system/commit-update" - SYSTEM_CANCELUPDATE = "/system/cancel-update" - SYSTEM_BACKUP = "/system/backup" - SYSTEM_RESTORE = "/system/restore" +# 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 index 95dbcba2..94b6c416 100644 --- a/pynitrokey/nethsm/client/paths/config_backup_passphrase/__init__.py +++ b/pynitrokey/nethsm/client/paths/config_backup_passphrase/__init__.py @@ -1,7 +1,5 @@ # 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.paths.config_backup_passphrase import Api +# from pynitrokey.nethsm.client.apis.paths.config_backup_passphrase import ConfigBackupPassphrase -from pynitrokey.nethsm.client.paths import PathValues - -path = PathValues.CONFIG_BACKUPPASSPHRASE \ No newline at end of file +path = "/config/backup-passphrase" \ No newline at end of file diff --git a/pynitrokey/nethsm/client/paths/config_backup_passphrase/put.py b/pynitrokey/nethsm/client/paths/config_backup_passphrase/put.py deleted file mode 100644 index 8ac122f8..00000000 --- a/pynitrokey/nethsm/client/paths/config_backup_passphrase/put.py +++ /dev/null @@ -1,354 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from pynitrokey.nethsm.client import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from pynitrokey.nethsm.client import schemas # noqa: F401 - -from pynitrokey.nethsm.client.model.backup_passphrase_config import BackupPassphraseConfig - -from . import path - -# body param -SchemaForRequestBodyApplicationJson = BackupPassphraseConfig - - -request_body_backup_passphrase_config = api_client.RequestBody( - content={ - 'application/json': api_client.MediaType( - schema=SchemaForRequestBodyApplicationJson), - }, - required=True, -) -_auth = [ - 'basic', -] - - -@dataclass -class ApiResponseFor204(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_204 = api_client.OpenApiResponse( - response_cls=ApiResponseFor204, -) - - -@dataclass -class ApiResponseFor400(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_400 = api_client.OpenApiResponse( - response_cls=ApiResponseFor400, -) - - -@dataclass -class ApiResponseFor401(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_401 = api_client.OpenApiResponse( - response_cls=ApiResponseFor401, -) - - -@dataclass -class ApiResponseFor403(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_403 = api_client.OpenApiResponse( - response_cls=ApiResponseFor403, -) - - -@dataclass -class ApiResponseFor412(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_412 = api_client.OpenApiResponse( - response_cls=ApiResponseFor412, -) -_status_code_to_response = { - '204': _response_for_204, - '400': _response_for_400, - '401': _response_for_401, - '403': _response_for_403, - '412': _response_for_412, -} - - -class BaseApi(api_client.Api): - @typing.overload - def _config_backup_passphrase_put_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor204, - ]: ... - - @typing.overload - def _config_backup_passphrase_put_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor204, - ]: ... - - - @typing.overload - def _config_backup_passphrase_put_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _config_backup_passphrase_put_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor204, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _config_backup_passphrase_put_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :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.value - - _headers = HTTPHeaderDict() - # TODO add cookie handling - - if body is schemas.unset: - raise exceptions.ApiValueError( - 'The required body parameter has an invalid value of: unset. Set a valid value instead') - _fields = None - _body = None - serialized_data = request_body_backup_passphrase_config.serialize(body, content_type) - _headers.add('Content-Type', content_type) - if 'fields' in serialized_data: - _fields = serialized_data['fields'] - elif 'body' in serialized_data: - _body = serialized_data['body'] - response = self.api_client.call_api( - resource_path=used_path, - method='put'.upper(), - headers=_headers, - fields=_fields, - body=_body, - auth_settings=_auth, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class ConfigBackupPassphrasePut(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def config_backup_passphrase_put( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor204, - ]: ... - - @typing.overload - def config_backup_passphrase_put( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor204, - ]: ... - - - @typing.overload - def config_backup_passphrase_put( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def config_backup_passphrase_put( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor204, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def config_backup_passphrase_put( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._config_backup_passphrase_put_oapg( - body=body, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForput(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def put( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor204, - ]: ... - - @typing.overload - def put( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor204, - ]: ... - - - @typing.overload - def put( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def put( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor204, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def put( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._config_backup_passphrase_put_oapg( - body=body, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/pynitrokey/nethsm/client/paths/config_backup_passphrase/put.pyi b/pynitrokey/nethsm/client/paths/config_backup_passphrase/put.pyi deleted file mode 100644 index 8cd7d326..00000000 --- a/pynitrokey/nethsm/client/paths/config_backup_passphrase/put.pyi +++ /dev/null @@ -1,342 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from pynitrokey.nethsm.client import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from pynitrokey.nethsm.client import schemas # noqa: F401 - -from pynitrokey.nethsm.client.model.backup_passphrase_config import BackupPassphraseConfig - -# body param -SchemaForRequestBodyApplicationJson = BackupPassphraseConfig - - -request_body_backup_passphrase_config = api_client.RequestBody( - content={ - 'application/json': api_client.MediaType( - schema=SchemaForRequestBodyApplicationJson), - }, - required=True, -) - - -@dataclass -class ApiResponseFor204(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_204 = api_client.OpenApiResponse( - response_cls=ApiResponseFor204, -) - - -@dataclass -class ApiResponseFor400(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_400 = api_client.OpenApiResponse( - response_cls=ApiResponseFor400, -) - - -@dataclass -class ApiResponseFor401(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_401 = api_client.OpenApiResponse( - response_cls=ApiResponseFor401, -) - - -@dataclass -class ApiResponseFor403(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_403 = api_client.OpenApiResponse( - response_cls=ApiResponseFor403, -) - - -@dataclass -class ApiResponseFor412(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_412 = api_client.OpenApiResponse( - response_cls=ApiResponseFor412, -) - - -class BaseApi(api_client.Api): - @typing.overload - def _config_backup_passphrase_put_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor204, - ]: ... - - @typing.overload - def _config_backup_passphrase_put_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor204, - ]: ... - - - @typing.overload - def _config_backup_passphrase_put_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _config_backup_passphrase_put_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor204, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _config_backup_passphrase_put_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :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.value - - _headers = HTTPHeaderDict() - # TODO add cookie handling - - if body is schemas.unset: - raise exceptions.ApiValueError( - 'The required body parameter has an invalid value of: unset. Set a valid value instead') - _fields = None - _body = None - serialized_data = request_body_backup_passphrase_config.serialize(body, content_type) - _headers.add('Content-Type', content_type) - if 'fields' in serialized_data: - _fields = serialized_data['fields'] - elif 'body' in serialized_data: - _body = serialized_data['body'] - response = self.api_client.call_api( - resource_path=used_path, - method='put'.upper(), - headers=_headers, - fields=_fields, - body=_body, - auth_settings=_auth, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class ConfigBackupPassphrasePut(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def config_backup_passphrase_put( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor204, - ]: ... - - @typing.overload - def config_backup_passphrase_put( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor204, - ]: ... - - - @typing.overload - def config_backup_passphrase_put( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def config_backup_passphrase_put( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor204, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def config_backup_passphrase_put( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._config_backup_passphrase_put_oapg( - body=body, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForput(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def put( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor204, - ]: ... - - @typing.overload - def put( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor204, - ]: ... - - - @typing.overload - def put( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def put( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor204, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def put( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._config_backup_passphrase_put_oapg( - body=body, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/pynitrokey/nethsm/client/paths/config_backup_passphrase/put/__init__.py b/pynitrokey/nethsm/client/paths/config_backup_passphrase/put/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/pynitrokey/nethsm/client/paths/config_backup_passphrase/put/operation.py b/pynitrokey/nethsm/client/paths/config_backup_passphrase/put/operation.py new file mode 100644 index 00000000..5fd0bcae --- /dev/null +++ b/pynitrokey/nethsm/client/paths/config_backup_passphrase/put/operation.py @@ -0,0 +1,188 @@ +# 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 new file mode 100644 index 00000000..ad29c4a8 --- /dev/null +++ b/pynitrokey/nethsm/client/paths/config_backup_passphrase/put/request_body/__init__.py @@ -0,0 +1,20 @@ +# 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 new file mode 100644 index 00000000..e69de29b 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 new file mode 100644 index 00000000..e69de29b 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 new file mode 100644 index 00000000..618a9699 --- /dev/null +++ b/pynitrokey/nethsm/client/paths/config_backup_passphrase/put/request_body/content/application_json/schema.py @@ -0,0 +1,13 @@ +# 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 new file mode 100644 index 00000000..e69de29b 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 new file mode 100644 index 00000000..8e822e77 --- /dev/null +++ b/pynitrokey/nethsm/client/paths/config_backup_passphrase/put/responses/response_204/__init__.py @@ -0,0 +1,20 @@ +# coding: utf-8 + +""" + Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator +""" + +from pynitrokey.nethsm.client.shared_imports.response_imports import * # 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 new file mode 100644 index 00000000..0458793b --- /dev/null +++ b/pynitrokey/nethsm/client/paths/config_backup_passphrase/put/responses/response_400/__init__.py @@ -0,0 +1,20 @@ +# coding: utf-8 + +""" + Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator +""" + +from pynitrokey.nethsm.client.shared_imports.response_imports import * # 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 new file mode 100644 index 00000000..cee35061 --- /dev/null +++ b/pynitrokey/nethsm/client/paths/config_backup_passphrase/put/responses/response_401/__init__.py @@ -0,0 +1,20 @@ +# coding: utf-8 + +""" + Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator +""" + +from pynitrokey.nethsm.client.shared_imports.response_imports import * # 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 new file mode 100644 index 00000000..7bc0249d --- /dev/null +++ b/pynitrokey/nethsm/client/paths/config_backup_passphrase/put/responses/response_403/__init__.py @@ -0,0 +1,20 @@ +# coding: utf-8 + +""" + Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator +""" + +from pynitrokey.nethsm.client.shared_imports.response_imports import * # 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 new file mode 100644 index 00000000..088c436c --- /dev/null +++ b/pynitrokey/nethsm/client/paths/config_backup_passphrase/put/responses/response_406/__init__.py @@ -0,0 +1,20 @@ +# coding: utf-8 + +""" + Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator +""" + +from pynitrokey.nethsm.client.shared_imports.response_imports import * # 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 new file mode 100644 index 00000000..50b6212f --- /dev/null +++ b/pynitrokey/nethsm/client/paths/config_backup_passphrase/put/responses/response_412/__init__.py @@ -0,0 +1,20 @@ +# coding: utf-8 + +""" + Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator +""" + +from pynitrokey.nethsm.client.shared_imports.response_imports import * # 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 new file mode 100644 index 00000000..e69de29b 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 new file mode 100644 index 00000000..f3b60942 --- /dev/null +++ b/pynitrokey/nethsm/client/paths/config_backup_passphrase/put/security/security_requirement_object_0.py @@ -0,0 +1,11 @@ +# 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 index a3e64f48..0edb58ed 100644 --- a/pynitrokey/nethsm/client/paths/config_logging/__init__.py +++ b/pynitrokey/nethsm/client/paths/config_logging/__init__.py @@ -1,7 +1,5 @@ # 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.paths.config_logging import Api +# from pynitrokey.nethsm.client.apis.paths.config_logging import ConfigLogging -from pynitrokey.nethsm.client.paths import PathValues - -path = PathValues.CONFIG_LOGGING \ No newline at end of file +path = "/config/logging" \ No newline at end of file diff --git a/pynitrokey/nethsm/client/paths/config_logging/get.py b/pynitrokey/nethsm/client/paths/config_logging/get.py deleted file mode 100644 index 45b766f9..00000000 --- a/pynitrokey/nethsm/client/paths/config_logging/get.py +++ /dev/null @@ -1,277 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from pynitrokey.nethsm.client import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from pynitrokey.nethsm.client import schemas # noqa: F401 - -from pynitrokey.nethsm.client.model.logging_config import LoggingConfig - -from . import path - -_auth = [ - 'basic', -] -SchemaFor200ResponseBodyApplicationJson = LoggingConfig - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: typing.Union[ - SchemaFor200ResponseBodyApplicationJson, - ] - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, - content={ - 'application/json': api_client.MediaType( - schema=SchemaFor200ResponseBodyApplicationJson), - }, -) - - -@dataclass -class ApiResponseFor401(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_401 = api_client.OpenApiResponse( - response_cls=ApiResponseFor401, -) - - -@dataclass -class ApiResponseFor403(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_403 = api_client.OpenApiResponse( - response_cls=ApiResponseFor403, -) - - -@dataclass -class ApiResponseFor412(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_412 = api_client.OpenApiResponse( - response_cls=ApiResponseFor412, -) -_status_code_to_response = { - '200': _response_for_200, - '401': _response_for_401, - '403': _response_for_403, - '412': _response_for_412, -} -_all_accept_content_types = ( - 'application/json', -) - - -class BaseApi(api_client.Api): - @typing.overload - def _config_logging_get_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _config_logging_get_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _config_logging_get_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _config_logging_get_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :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.value - - _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) - - response = self.api_client.call_api( - resource_path=used_path, - method='get'.upper(), - headers=_headers, - auth_settings=_auth, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class ConfigLoggingGet(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def config_logging_get( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def config_logging_get( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def config_logging_get( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def config_logging_get( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._config_logging_get_oapg( - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForget(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def get( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def get( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def get( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def get( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._config_logging_get_oapg( - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/pynitrokey/nethsm/client/paths/config_logging/get.pyi b/pynitrokey/nethsm/client/paths/config_logging/get.pyi deleted file mode 100644 index f1dfc0d2..00000000 --- a/pynitrokey/nethsm/client/paths/config_logging/get.pyi +++ /dev/null @@ -1,266 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from pynitrokey.nethsm.client import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from pynitrokey.nethsm.client import schemas # noqa: F401 - -from pynitrokey.nethsm.client.model.logging_config import LoggingConfig - -SchemaFor200ResponseBodyApplicationJson = LoggingConfig - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: typing.Union[ - SchemaFor200ResponseBodyApplicationJson, - ] - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, - content={ - 'application/json': api_client.MediaType( - schema=SchemaFor200ResponseBodyApplicationJson), - }, -) - - -@dataclass -class ApiResponseFor401(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_401 = api_client.OpenApiResponse( - response_cls=ApiResponseFor401, -) - - -@dataclass -class ApiResponseFor403(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_403 = api_client.OpenApiResponse( - response_cls=ApiResponseFor403, -) - - -@dataclass -class ApiResponseFor412(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_412 = api_client.OpenApiResponse( - response_cls=ApiResponseFor412, -) -_all_accept_content_types = ( - 'application/json', -) - - -class BaseApi(api_client.Api): - @typing.overload - def _config_logging_get_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _config_logging_get_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _config_logging_get_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _config_logging_get_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :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.value - - _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) - - response = self.api_client.call_api( - resource_path=used_path, - method='get'.upper(), - headers=_headers, - auth_settings=_auth, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class ConfigLoggingGet(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def config_logging_get( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def config_logging_get( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def config_logging_get( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def config_logging_get( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._config_logging_get_oapg( - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForget(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def get( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def get( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def get( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def get( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._config_logging_get_oapg( - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/pynitrokey/nethsm/client/paths/config_logging/get/__init__.py b/pynitrokey/nethsm/client/paths/config_logging/get/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/pynitrokey/nethsm/client/paths/config_logging/get/operation.py b/pynitrokey/nethsm/client/paths/config_logging/get/operation.py new file mode 100644 index 00000000..bdc06b65 --- /dev/null +++ b/pynitrokey/nethsm/client/paths/config_logging/get/operation.py @@ -0,0 +1,164 @@ +# 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 new file mode 100644 index 00000000..e69de29b 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 new file mode 100644 index 00000000..65c12b2e --- /dev/null +++ b/pynitrokey/nethsm/client/paths/config_logging/get/responses/response_200/__init__.py @@ -0,0 +1,29 @@ +# coding: utf-8 + +""" + Generated 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 new file mode 100644 index 00000000..e69de29b 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 new file mode 100644 index 00000000..e69de29b 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 new file mode 100644 index 00000000..86e80370 --- /dev/null +++ b/pynitrokey/nethsm/client/paths/config_logging/get/responses/response_200/content/application_json/schema.py @@ -0,0 +1,13 @@ +# 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 new file mode 100644 index 00000000..cee35061 --- /dev/null +++ b/pynitrokey/nethsm/client/paths/config_logging/get/responses/response_401/__init__.py @@ -0,0 +1,20 @@ +# coding: utf-8 + +""" + Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator +""" + +from pynitrokey.nethsm.client.shared_imports.response_imports import * # 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 new file mode 100644 index 00000000..7bc0249d --- /dev/null +++ b/pynitrokey/nethsm/client/paths/config_logging/get/responses/response_403/__init__.py @@ -0,0 +1,20 @@ +# coding: utf-8 + +""" + Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator +""" + +from pynitrokey.nethsm.client.shared_imports.response_imports import * # 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 new file mode 100644 index 00000000..088c436c --- /dev/null +++ b/pynitrokey/nethsm/client/paths/config_logging/get/responses/response_406/__init__.py @@ -0,0 +1,20 @@ +# coding: utf-8 + +""" + Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator +""" + +from pynitrokey.nethsm.client.shared_imports.response_imports import * # 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 new file mode 100644 index 00000000..50b6212f --- /dev/null +++ b/pynitrokey/nethsm/client/paths/config_logging/get/responses/response_412/__init__.py @@ -0,0 +1,20 @@ +# coding: utf-8 + +""" + Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator +""" + +from pynitrokey.nethsm.client.shared_imports.response_imports import * # 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 new file mode 100644 index 00000000..e69de29b 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 new file mode 100644 index 00000000..f3b60942 --- /dev/null +++ b/pynitrokey/nethsm/client/paths/config_logging/get/security/security_requirement_object_0.py @@ -0,0 +1,11 @@ +# 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.py b/pynitrokey/nethsm/client/paths/config_logging/put.py deleted file mode 100644 index dc8bfb99..00000000 --- a/pynitrokey/nethsm/client/paths/config_logging/put.py +++ /dev/null @@ -1,354 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from pynitrokey.nethsm.client import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from pynitrokey.nethsm.client import schemas # noqa: F401 - -from pynitrokey.nethsm.client.model.logging_config import LoggingConfig - -from . import path - -# body param -SchemaForRequestBodyApplicationJson = LoggingConfig - - -request_body_logging_config = api_client.RequestBody( - content={ - 'application/json': api_client.MediaType( - schema=SchemaForRequestBodyApplicationJson), - }, - required=True, -) -_auth = [ - 'basic', -] - - -@dataclass -class ApiResponseFor204(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_204 = api_client.OpenApiResponse( - response_cls=ApiResponseFor204, -) - - -@dataclass -class ApiResponseFor400(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_400 = api_client.OpenApiResponse( - response_cls=ApiResponseFor400, -) - - -@dataclass -class ApiResponseFor401(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_401 = api_client.OpenApiResponse( - response_cls=ApiResponseFor401, -) - - -@dataclass -class ApiResponseFor403(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_403 = api_client.OpenApiResponse( - response_cls=ApiResponseFor403, -) - - -@dataclass -class ApiResponseFor412(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_412 = api_client.OpenApiResponse( - response_cls=ApiResponseFor412, -) -_status_code_to_response = { - '204': _response_for_204, - '400': _response_for_400, - '401': _response_for_401, - '403': _response_for_403, - '412': _response_for_412, -} - - -class BaseApi(api_client.Api): - @typing.overload - def _config_logging_put_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor204, - ]: ... - - @typing.overload - def _config_logging_put_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor204, - ]: ... - - - @typing.overload - def _config_logging_put_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _config_logging_put_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor204, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _config_logging_put_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :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.value - - _headers = HTTPHeaderDict() - # TODO add cookie handling - - if body is schemas.unset: - raise exceptions.ApiValueError( - 'The required body parameter has an invalid value of: unset. Set a valid value instead') - _fields = None - _body = None - serialized_data = request_body_logging_config.serialize(body, content_type) - _headers.add('Content-Type', content_type) - if 'fields' in serialized_data: - _fields = serialized_data['fields'] - elif 'body' in serialized_data: - _body = serialized_data['body'] - response = self.api_client.call_api( - resource_path=used_path, - method='put'.upper(), - headers=_headers, - fields=_fields, - body=_body, - auth_settings=_auth, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class ConfigLoggingPut(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def config_logging_put( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor204, - ]: ... - - @typing.overload - def config_logging_put( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor204, - ]: ... - - - @typing.overload - def config_logging_put( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def config_logging_put( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor204, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def config_logging_put( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._config_logging_put_oapg( - body=body, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForput(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def put( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor204, - ]: ... - - @typing.overload - def put( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor204, - ]: ... - - - @typing.overload - def put( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def put( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor204, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def put( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._config_logging_put_oapg( - body=body, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/pynitrokey/nethsm/client/paths/config_logging/put.pyi b/pynitrokey/nethsm/client/paths/config_logging/put.pyi deleted file mode 100644 index 315214fc..00000000 --- a/pynitrokey/nethsm/client/paths/config_logging/put.pyi +++ /dev/null @@ -1,342 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from pynitrokey.nethsm.client import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from pynitrokey.nethsm.client import schemas # noqa: F401 - -from pynitrokey.nethsm.client.model.logging_config import LoggingConfig - -# body param -SchemaForRequestBodyApplicationJson = LoggingConfig - - -request_body_logging_config = api_client.RequestBody( - content={ - 'application/json': api_client.MediaType( - schema=SchemaForRequestBodyApplicationJson), - }, - required=True, -) - - -@dataclass -class ApiResponseFor204(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_204 = api_client.OpenApiResponse( - response_cls=ApiResponseFor204, -) - - -@dataclass -class ApiResponseFor400(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_400 = api_client.OpenApiResponse( - response_cls=ApiResponseFor400, -) - - -@dataclass -class ApiResponseFor401(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_401 = api_client.OpenApiResponse( - response_cls=ApiResponseFor401, -) - - -@dataclass -class ApiResponseFor403(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_403 = api_client.OpenApiResponse( - response_cls=ApiResponseFor403, -) - - -@dataclass -class ApiResponseFor412(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_412 = api_client.OpenApiResponse( - response_cls=ApiResponseFor412, -) - - -class BaseApi(api_client.Api): - @typing.overload - def _config_logging_put_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor204, - ]: ... - - @typing.overload - def _config_logging_put_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor204, - ]: ... - - - @typing.overload - def _config_logging_put_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _config_logging_put_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor204, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _config_logging_put_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :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.value - - _headers = HTTPHeaderDict() - # TODO add cookie handling - - if body is schemas.unset: - raise exceptions.ApiValueError( - 'The required body parameter has an invalid value of: unset. Set a valid value instead') - _fields = None - _body = None - serialized_data = request_body_logging_config.serialize(body, content_type) - _headers.add('Content-Type', content_type) - if 'fields' in serialized_data: - _fields = serialized_data['fields'] - elif 'body' in serialized_data: - _body = serialized_data['body'] - response = self.api_client.call_api( - resource_path=used_path, - method='put'.upper(), - headers=_headers, - fields=_fields, - body=_body, - auth_settings=_auth, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class ConfigLoggingPut(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def config_logging_put( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor204, - ]: ... - - @typing.overload - def config_logging_put( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor204, - ]: ... - - - @typing.overload - def config_logging_put( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def config_logging_put( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor204, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def config_logging_put( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._config_logging_put_oapg( - body=body, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForput(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def put( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor204, - ]: ... - - @typing.overload - def put( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor204, - ]: ... - - - @typing.overload - def put( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def put( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor204, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def put( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._config_logging_put_oapg( - body=body, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/pynitrokey/nethsm/client/paths/config_logging/put/__init__.py b/pynitrokey/nethsm/client/paths/config_logging/put/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/pynitrokey/nethsm/client/paths/config_logging/put/operation.py b/pynitrokey/nethsm/client/paths/config_logging/put/operation.py new file mode 100644 index 00000000..0fcbdb21 --- /dev/null +++ b/pynitrokey/nethsm/client/paths/config_logging/put/operation.py @@ -0,0 +1,188 @@ +# 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 new file mode 100644 index 00000000..ad29c4a8 --- /dev/null +++ b/pynitrokey/nethsm/client/paths/config_logging/put/request_body/__init__.py @@ -0,0 +1,20 @@ +# 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 new file mode 100644 index 00000000..e69de29b 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 new file mode 100644 index 00000000..e69de29b 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 new file mode 100644 index 00000000..86e80370 --- /dev/null +++ b/pynitrokey/nethsm/client/paths/config_logging/put/request_body/content/application_json/schema.py @@ -0,0 +1,13 @@ +# 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 new file mode 100644 index 00000000..e69de29b 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 new file mode 100644 index 00000000..8e822e77 --- /dev/null +++ b/pynitrokey/nethsm/client/paths/config_logging/put/responses/response_204/__init__.py @@ -0,0 +1,20 @@ +# coding: utf-8 + +""" + Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator +""" + +from pynitrokey.nethsm.client.shared_imports.response_imports import * # 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 new file mode 100644 index 00000000..0458793b --- /dev/null +++ b/pynitrokey/nethsm/client/paths/config_logging/put/responses/response_400/__init__.py @@ -0,0 +1,20 @@ +# coding: utf-8 + +""" + Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator +""" + +from pynitrokey.nethsm.client.shared_imports.response_imports import * # 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 new file mode 100644 index 00000000..cee35061 --- /dev/null +++ b/pynitrokey/nethsm/client/paths/config_logging/put/responses/response_401/__init__.py @@ -0,0 +1,20 @@ +# coding: utf-8 + +""" + Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator +""" + +from pynitrokey.nethsm.client.shared_imports.response_imports import * # 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 new file mode 100644 index 00000000..7bc0249d --- /dev/null +++ b/pynitrokey/nethsm/client/paths/config_logging/put/responses/response_403/__init__.py @@ -0,0 +1,20 @@ +# coding: utf-8 + +""" + Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator +""" + +from pynitrokey.nethsm.client.shared_imports.response_imports import * # 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 new file mode 100644 index 00000000..088c436c --- /dev/null +++ b/pynitrokey/nethsm/client/paths/config_logging/put/responses/response_406/__init__.py @@ -0,0 +1,20 @@ +# coding: utf-8 + +""" + Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator +""" + +from pynitrokey.nethsm.client.shared_imports.response_imports import * # 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 new file mode 100644 index 00000000..50b6212f --- /dev/null +++ b/pynitrokey/nethsm/client/paths/config_logging/put/responses/response_412/__init__.py @@ -0,0 +1,20 @@ +# coding: utf-8 + +""" + Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator +""" + +from pynitrokey.nethsm.client.shared_imports.response_imports import * # 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 new file mode 100644 index 00000000..e69de29b 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 new file mode 100644 index 00000000..f3b60942 --- /dev/null +++ b/pynitrokey/nethsm/client/paths/config_logging/put/security/security_requirement_object_0.py @@ -0,0 +1,11 @@ +# 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 index fa0c9bf4..d4aff038 100644 --- a/pynitrokey/nethsm/client/paths/config_network/__init__.py +++ b/pynitrokey/nethsm/client/paths/config_network/__init__.py @@ -1,7 +1,5 @@ # 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.paths.config_network import Api +# from pynitrokey.nethsm.client.apis.paths.config_network import ConfigNetwork -from pynitrokey.nethsm.client.paths import PathValues - -path = PathValues.CONFIG_NETWORK \ No newline at end of file +path = "/config/network" \ No newline at end of file diff --git a/pynitrokey/nethsm/client/paths/config_network/get.py b/pynitrokey/nethsm/client/paths/config_network/get.py deleted file mode 100644 index 2a36c0f8..00000000 --- a/pynitrokey/nethsm/client/paths/config_network/get.py +++ /dev/null @@ -1,277 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from pynitrokey.nethsm.client import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from pynitrokey.nethsm.client import schemas # noqa: F401 - -from pynitrokey.nethsm.client.model.network_config import NetworkConfig - -from . import path - -_auth = [ - 'basic', -] -SchemaFor200ResponseBodyApplicationJson = NetworkConfig - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: typing.Union[ - SchemaFor200ResponseBodyApplicationJson, - ] - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, - content={ - 'application/json': api_client.MediaType( - schema=SchemaFor200ResponseBodyApplicationJson), - }, -) - - -@dataclass -class ApiResponseFor401(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_401 = api_client.OpenApiResponse( - response_cls=ApiResponseFor401, -) - - -@dataclass -class ApiResponseFor403(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_403 = api_client.OpenApiResponse( - response_cls=ApiResponseFor403, -) - - -@dataclass -class ApiResponseFor412(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_412 = api_client.OpenApiResponse( - response_cls=ApiResponseFor412, -) -_status_code_to_response = { - '200': _response_for_200, - '401': _response_for_401, - '403': _response_for_403, - '412': _response_for_412, -} -_all_accept_content_types = ( - 'application/json', -) - - -class BaseApi(api_client.Api): - @typing.overload - def _config_network_get_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _config_network_get_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _config_network_get_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _config_network_get_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :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.value - - _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) - - response = self.api_client.call_api( - resource_path=used_path, - method='get'.upper(), - headers=_headers, - auth_settings=_auth, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class ConfigNetworkGet(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def config_network_get( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def config_network_get( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def config_network_get( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def config_network_get( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._config_network_get_oapg( - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForget(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def get( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def get( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def get( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def get( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._config_network_get_oapg( - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/pynitrokey/nethsm/client/paths/config_network/get.pyi b/pynitrokey/nethsm/client/paths/config_network/get.pyi deleted file mode 100644 index d8e76a46..00000000 --- a/pynitrokey/nethsm/client/paths/config_network/get.pyi +++ /dev/null @@ -1,266 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from pynitrokey.nethsm.client import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from pynitrokey.nethsm.client import schemas # noqa: F401 - -from pynitrokey.nethsm.client.model.network_config import NetworkConfig - -SchemaFor200ResponseBodyApplicationJson = NetworkConfig - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: typing.Union[ - SchemaFor200ResponseBodyApplicationJson, - ] - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, - content={ - 'application/json': api_client.MediaType( - schema=SchemaFor200ResponseBodyApplicationJson), - }, -) - - -@dataclass -class ApiResponseFor401(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_401 = api_client.OpenApiResponse( - response_cls=ApiResponseFor401, -) - - -@dataclass -class ApiResponseFor403(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_403 = api_client.OpenApiResponse( - response_cls=ApiResponseFor403, -) - - -@dataclass -class ApiResponseFor412(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_412 = api_client.OpenApiResponse( - response_cls=ApiResponseFor412, -) -_all_accept_content_types = ( - 'application/json', -) - - -class BaseApi(api_client.Api): - @typing.overload - def _config_network_get_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _config_network_get_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _config_network_get_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _config_network_get_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :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.value - - _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) - - response = self.api_client.call_api( - resource_path=used_path, - method='get'.upper(), - headers=_headers, - auth_settings=_auth, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class ConfigNetworkGet(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def config_network_get( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def config_network_get( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def config_network_get( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def config_network_get( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._config_network_get_oapg( - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForget(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def get( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def get( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def get( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def get( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._config_network_get_oapg( - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/pynitrokey/nethsm/client/paths/config_network/get/__init__.py b/pynitrokey/nethsm/client/paths/config_network/get/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/pynitrokey/nethsm/client/paths/config_network/get/operation.py b/pynitrokey/nethsm/client/paths/config_network/get/operation.py new file mode 100644 index 00000000..fd8ca859 --- /dev/null +++ b/pynitrokey/nethsm/client/paths/config_network/get/operation.py @@ -0,0 +1,164 @@ +# 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 new file mode 100644 index 00000000..e69de29b 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 new file mode 100644 index 00000000..1f15f988 --- /dev/null +++ b/pynitrokey/nethsm/client/paths/config_network/get/responses/response_200/__init__.py @@ -0,0 +1,29 @@ +# coding: utf-8 + +""" + Generated 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 new file mode 100644 index 00000000..e69de29b 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 new file mode 100644 index 00000000..e69de29b 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 new file mode 100644 index 00000000..81451e56 --- /dev/null +++ b/pynitrokey/nethsm/client/paths/config_network/get/responses/response_200/content/application_json/schema.py @@ -0,0 +1,13 @@ +# 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 new file mode 100644 index 00000000..cee35061 --- /dev/null +++ b/pynitrokey/nethsm/client/paths/config_network/get/responses/response_401/__init__.py @@ -0,0 +1,20 @@ +# coding: utf-8 + +""" + Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator +""" + +from pynitrokey.nethsm.client.shared_imports.response_imports import * # 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 new file mode 100644 index 00000000..7bc0249d --- /dev/null +++ b/pynitrokey/nethsm/client/paths/config_network/get/responses/response_403/__init__.py @@ -0,0 +1,20 @@ +# coding: utf-8 + +""" + Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator +""" + +from pynitrokey.nethsm.client.shared_imports.response_imports import * # 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 new file mode 100644 index 00000000..088c436c --- /dev/null +++ b/pynitrokey/nethsm/client/paths/config_network/get/responses/response_406/__init__.py @@ -0,0 +1,20 @@ +# coding: utf-8 + +""" + Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator +""" + +from pynitrokey.nethsm.client.shared_imports.response_imports import * # 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 new file mode 100644 index 00000000..50b6212f --- /dev/null +++ b/pynitrokey/nethsm/client/paths/config_network/get/responses/response_412/__init__.py @@ -0,0 +1,20 @@ +# coding: utf-8 + +""" + Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator +""" + +from pynitrokey.nethsm.client.shared_imports.response_imports import * # 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 new file mode 100644 index 00000000..e69de29b 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 new file mode 100644 index 00000000..f3b60942 --- /dev/null +++ b/pynitrokey/nethsm/client/paths/config_network/get/security/security_requirement_object_0.py @@ -0,0 +1,11 @@ +# 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.py b/pynitrokey/nethsm/client/paths/config_network/put.py deleted file mode 100644 index fe9f7894..00000000 --- a/pynitrokey/nethsm/client/paths/config_network/put.py +++ /dev/null @@ -1,354 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from pynitrokey.nethsm.client import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from pynitrokey.nethsm.client import schemas # noqa: F401 - -from pynitrokey.nethsm.client.model.network_config import NetworkConfig - -from . import path - -# body param -SchemaForRequestBodyApplicationJson = NetworkConfig - - -request_body_network_config = api_client.RequestBody( - content={ - 'application/json': api_client.MediaType( - schema=SchemaForRequestBodyApplicationJson), - }, - required=True, -) -_auth = [ - 'basic', -] - - -@dataclass -class ApiResponseFor204(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_204 = api_client.OpenApiResponse( - response_cls=ApiResponseFor204, -) - - -@dataclass -class ApiResponseFor400(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_400 = api_client.OpenApiResponse( - response_cls=ApiResponseFor400, -) - - -@dataclass -class ApiResponseFor401(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_401 = api_client.OpenApiResponse( - response_cls=ApiResponseFor401, -) - - -@dataclass -class ApiResponseFor403(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_403 = api_client.OpenApiResponse( - response_cls=ApiResponseFor403, -) - - -@dataclass -class ApiResponseFor412(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_412 = api_client.OpenApiResponse( - response_cls=ApiResponseFor412, -) -_status_code_to_response = { - '204': _response_for_204, - '400': _response_for_400, - '401': _response_for_401, - '403': _response_for_403, - '412': _response_for_412, -} - - -class BaseApi(api_client.Api): - @typing.overload - def _config_network_put_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor204, - ]: ... - - @typing.overload - def _config_network_put_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor204, - ]: ... - - - @typing.overload - def _config_network_put_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _config_network_put_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor204, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _config_network_put_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :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.value - - _headers = HTTPHeaderDict() - # TODO add cookie handling - - if body is schemas.unset: - raise exceptions.ApiValueError( - 'The required body parameter has an invalid value of: unset. Set a valid value instead') - _fields = None - _body = None - serialized_data = request_body_network_config.serialize(body, content_type) - _headers.add('Content-Type', content_type) - if 'fields' in serialized_data: - _fields = serialized_data['fields'] - elif 'body' in serialized_data: - _body = serialized_data['body'] - response = self.api_client.call_api( - resource_path=used_path, - method='put'.upper(), - headers=_headers, - fields=_fields, - body=_body, - auth_settings=_auth, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class ConfigNetworkPut(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def config_network_put( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor204, - ]: ... - - @typing.overload - def config_network_put( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor204, - ]: ... - - - @typing.overload - def config_network_put( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def config_network_put( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor204, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def config_network_put( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._config_network_put_oapg( - body=body, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForput(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def put( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor204, - ]: ... - - @typing.overload - def put( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor204, - ]: ... - - - @typing.overload - def put( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def put( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor204, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def put( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._config_network_put_oapg( - body=body, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/pynitrokey/nethsm/client/paths/config_network/put.pyi b/pynitrokey/nethsm/client/paths/config_network/put.pyi deleted file mode 100644 index 8e337359..00000000 --- a/pynitrokey/nethsm/client/paths/config_network/put.pyi +++ /dev/null @@ -1,342 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from pynitrokey.nethsm.client import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from pynitrokey.nethsm.client import schemas # noqa: F401 - -from pynitrokey.nethsm.client.model.network_config import NetworkConfig - -# body param -SchemaForRequestBodyApplicationJson = NetworkConfig - - -request_body_network_config = api_client.RequestBody( - content={ - 'application/json': api_client.MediaType( - schema=SchemaForRequestBodyApplicationJson), - }, - required=True, -) - - -@dataclass -class ApiResponseFor204(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_204 = api_client.OpenApiResponse( - response_cls=ApiResponseFor204, -) - - -@dataclass -class ApiResponseFor400(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_400 = api_client.OpenApiResponse( - response_cls=ApiResponseFor400, -) - - -@dataclass -class ApiResponseFor401(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_401 = api_client.OpenApiResponse( - response_cls=ApiResponseFor401, -) - - -@dataclass -class ApiResponseFor403(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_403 = api_client.OpenApiResponse( - response_cls=ApiResponseFor403, -) - - -@dataclass -class ApiResponseFor412(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_412 = api_client.OpenApiResponse( - response_cls=ApiResponseFor412, -) - - -class BaseApi(api_client.Api): - @typing.overload - def _config_network_put_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor204, - ]: ... - - @typing.overload - def _config_network_put_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor204, - ]: ... - - - @typing.overload - def _config_network_put_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _config_network_put_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor204, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _config_network_put_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :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.value - - _headers = HTTPHeaderDict() - # TODO add cookie handling - - if body is schemas.unset: - raise exceptions.ApiValueError( - 'The required body parameter has an invalid value of: unset. Set a valid value instead') - _fields = None - _body = None - serialized_data = request_body_network_config.serialize(body, content_type) - _headers.add('Content-Type', content_type) - if 'fields' in serialized_data: - _fields = serialized_data['fields'] - elif 'body' in serialized_data: - _body = serialized_data['body'] - response = self.api_client.call_api( - resource_path=used_path, - method='put'.upper(), - headers=_headers, - fields=_fields, - body=_body, - auth_settings=_auth, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class ConfigNetworkPut(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def config_network_put( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor204, - ]: ... - - @typing.overload - def config_network_put( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor204, - ]: ... - - - @typing.overload - def config_network_put( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def config_network_put( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor204, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def config_network_put( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._config_network_put_oapg( - body=body, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForput(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def put( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor204, - ]: ... - - @typing.overload - def put( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor204, - ]: ... - - - @typing.overload - def put( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def put( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor204, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def put( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._config_network_put_oapg( - body=body, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/pynitrokey/nethsm/client/paths/config_network/put/__init__.py b/pynitrokey/nethsm/client/paths/config_network/put/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/pynitrokey/nethsm/client/paths/config_network/put/operation.py b/pynitrokey/nethsm/client/paths/config_network/put/operation.py new file mode 100644 index 00000000..72e4c925 --- /dev/null +++ b/pynitrokey/nethsm/client/paths/config_network/put/operation.py @@ -0,0 +1,188 @@ +# 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 new file mode 100644 index 00000000..ad29c4a8 --- /dev/null +++ b/pynitrokey/nethsm/client/paths/config_network/put/request_body/__init__.py @@ -0,0 +1,20 @@ +# 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 new file mode 100644 index 00000000..e69de29b 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 new file mode 100644 index 00000000..e69de29b 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 new file mode 100644 index 00000000..81451e56 --- /dev/null +++ b/pynitrokey/nethsm/client/paths/config_network/put/request_body/content/application_json/schema.py @@ -0,0 +1,13 @@ +# 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 new file mode 100644 index 00000000..e69de29b 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 new file mode 100644 index 00000000..8e822e77 --- /dev/null +++ b/pynitrokey/nethsm/client/paths/config_network/put/responses/response_204/__init__.py @@ -0,0 +1,20 @@ +# coding: utf-8 + +""" + Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator +""" + +from pynitrokey.nethsm.client.shared_imports.response_imports import * # 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 new file mode 100644 index 00000000..0458793b --- /dev/null +++ b/pynitrokey/nethsm/client/paths/config_network/put/responses/response_400/__init__.py @@ -0,0 +1,20 @@ +# coding: utf-8 + +""" + Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator +""" + +from pynitrokey.nethsm.client.shared_imports.response_imports import * # 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 new file mode 100644 index 00000000..cee35061 --- /dev/null +++ b/pynitrokey/nethsm/client/paths/config_network/put/responses/response_401/__init__.py @@ -0,0 +1,20 @@ +# coding: utf-8 + +""" + Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator +""" + +from pynitrokey.nethsm.client.shared_imports.response_imports import * # 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 new file mode 100644 index 00000000..7bc0249d --- /dev/null +++ b/pynitrokey/nethsm/client/paths/config_network/put/responses/response_403/__init__.py @@ -0,0 +1,20 @@ +# coding: utf-8 + +""" + Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator +""" + +from pynitrokey.nethsm.client.shared_imports.response_imports import * # 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 new file mode 100644 index 00000000..088c436c --- /dev/null +++ b/pynitrokey/nethsm/client/paths/config_network/put/responses/response_406/__init__.py @@ -0,0 +1,20 @@ +# coding: utf-8 + +""" + Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator +""" + +from pynitrokey.nethsm.client.shared_imports.response_imports import * # 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 new file mode 100644 index 00000000..50b6212f --- /dev/null +++ b/pynitrokey/nethsm/client/paths/config_network/put/responses/response_412/__init__.py @@ -0,0 +1,20 @@ +# coding: utf-8 + +""" + Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator +""" + +from pynitrokey.nethsm.client.shared_imports.response_imports import * # 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 new file mode 100644 index 00000000..e69de29b 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 new file mode 100644 index 00000000..f3b60942 --- /dev/null +++ b/pynitrokey/nethsm/client/paths/config_network/put/security/security_requirement_object_0.py @@ -0,0 +1,11 @@ +# 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 index aa6c5087..94ec6ac1 100644 --- a/pynitrokey/nethsm/client/paths/config_time/__init__.py +++ b/pynitrokey/nethsm/client/paths/config_time/__init__.py @@ -1,7 +1,5 @@ # 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.paths.config_time import Api +# from pynitrokey.nethsm.client.apis.paths.config_time import ConfigTime -from pynitrokey.nethsm.client.paths import PathValues - -path = PathValues.CONFIG_TIME \ No newline at end of file +path = "/config/time" \ No newline at end of file diff --git a/pynitrokey/nethsm/client/paths/config_time/get.py b/pynitrokey/nethsm/client/paths/config_time/get.py deleted file mode 100644 index d77ec809..00000000 --- a/pynitrokey/nethsm/client/paths/config_time/get.py +++ /dev/null @@ -1,277 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from pynitrokey.nethsm.client import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from pynitrokey.nethsm.client import schemas # noqa: F401 - -from pynitrokey.nethsm.client.model.time_config import TimeConfig - -from . import path - -_auth = [ - 'basic', -] -SchemaFor200ResponseBodyApplicationJson = TimeConfig - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: typing.Union[ - SchemaFor200ResponseBodyApplicationJson, - ] - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, - content={ - 'application/json': api_client.MediaType( - schema=SchemaFor200ResponseBodyApplicationJson), - }, -) - - -@dataclass -class ApiResponseFor401(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_401 = api_client.OpenApiResponse( - response_cls=ApiResponseFor401, -) - - -@dataclass -class ApiResponseFor403(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_403 = api_client.OpenApiResponse( - response_cls=ApiResponseFor403, -) - - -@dataclass -class ApiResponseFor412(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_412 = api_client.OpenApiResponse( - response_cls=ApiResponseFor412, -) -_status_code_to_response = { - '200': _response_for_200, - '401': _response_for_401, - '403': _response_for_403, - '412': _response_for_412, -} -_all_accept_content_types = ( - 'application/json', -) - - -class BaseApi(api_client.Api): - @typing.overload - def _config_time_get_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _config_time_get_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _config_time_get_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _config_time_get_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :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.value - - _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) - - response = self.api_client.call_api( - resource_path=used_path, - method='get'.upper(), - headers=_headers, - auth_settings=_auth, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class ConfigTimeGet(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def config_time_get( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def config_time_get( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def config_time_get( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def config_time_get( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._config_time_get_oapg( - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForget(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def get( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def get( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def get( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def get( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._config_time_get_oapg( - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/pynitrokey/nethsm/client/paths/config_time/get.pyi b/pynitrokey/nethsm/client/paths/config_time/get.pyi deleted file mode 100644 index 3d7bed10..00000000 --- a/pynitrokey/nethsm/client/paths/config_time/get.pyi +++ /dev/null @@ -1,266 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from pynitrokey.nethsm.client import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from pynitrokey.nethsm.client import schemas # noqa: F401 - -from pynitrokey.nethsm.client.model.time_config import TimeConfig - -SchemaFor200ResponseBodyApplicationJson = TimeConfig - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: typing.Union[ - SchemaFor200ResponseBodyApplicationJson, - ] - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, - content={ - 'application/json': api_client.MediaType( - schema=SchemaFor200ResponseBodyApplicationJson), - }, -) - - -@dataclass -class ApiResponseFor401(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_401 = api_client.OpenApiResponse( - response_cls=ApiResponseFor401, -) - - -@dataclass -class ApiResponseFor403(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_403 = api_client.OpenApiResponse( - response_cls=ApiResponseFor403, -) - - -@dataclass -class ApiResponseFor412(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_412 = api_client.OpenApiResponse( - response_cls=ApiResponseFor412, -) -_all_accept_content_types = ( - 'application/json', -) - - -class BaseApi(api_client.Api): - @typing.overload - def _config_time_get_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _config_time_get_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _config_time_get_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _config_time_get_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :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.value - - _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) - - response = self.api_client.call_api( - resource_path=used_path, - method='get'.upper(), - headers=_headers, - auth_settings=_auth, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class ConfigTimeGet(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def config_time_get( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def config_time_get( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def config_time_get( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def config_time_get( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._config_time_get_oapg( - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForget(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def get( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def get( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def get( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def get( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._config_time_get_oapg( - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/pynitrokey/nethsm/client/paths/config_time/get/__init__.py b/pynitrokey/nethsm/client/paths/config_time/get/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/pynitrokey/nethsm/client/paths/config_time/get/operation.py b/pynitrokey/nethsm/client/paths/config_time/get/operation.py new file mode 100644 index 00000000..247acdce --- /dev/null +++ b/pynitrokey/nethsm/client/paths/config_time/get/operation.py @@ -0,0 +1,164 @@ +# 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 new file mode 100644 index 00000000..e69de29b 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 new file mode 100644 index 00000000..4b27f146 --- /dev/null +++ b/pynitrokey/nethsm/client/paths/config_time/get/responses/response_200/__init__.py @@ -0,0 +1,29 @@ +# coding: utf-8 + +""" + Generated 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 new file mode 100644 index 00000000..e69de29b 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 new file mode 100644 index 00000000..e69de29b 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 new file mode 100644 index 00000000..301a2cce --- /dev/null +++ b/pynitrokey/nethsm/client/paths/config_time/get/responses/response_200/content/application_json/schema.py @@ -0,0 +1,13 @@ +# 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 new file mode 100644 index 00000000..cee35061 --- /dev/null +++ b/pynitrokey/nethsm/client/paths/config_time/get/responses/response_401/__init__.py @@ -0,0 +1,20 @@ +# coding: utf-8 + +""" + Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator +""" + +from pynitrokey.nethsm.client.shared_imports.response_imports import * # 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 new file mode 100644 index 00000000..7bc0249d --- /dev/null +++ b/pynitrokey/nethsm/client/paths/config_time/get/responses/response_403/__init__.py @@ -0,0 +1,20 @@ +# coding: utf-8 + +""" + Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator +""" + +from pynitrokey.nethsm.client.shared_imports.response_imports import * # 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 new file mode 100644 index 00000000..088c436c --- /dev/null +++ b/pynitrokey/nethsm/client/paths/config_time/get/responses/response_406/__init__.py @@ -0,0 +1,20 @@ +# coding: utf-8 + +""" + Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator +""" + +from pynitrokey.nethsm.client.shared_imports.response_imports import * # 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 new file mode 100644 index 00000000..50b6212f --- /dev/null +++ b/pynitrokey/nethsm/client/paths/config_time/get/responses/response_412/__init__.py @@ -0,0 +1,20 @@ +# coding: utf-8 + +""" + Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator +""" + +from pynitrokey.nethsm.client.shared_imports.response_imports import * # 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 new file mode 100644 index 00000000..e69de29b 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 new file mode 100644 index 00000000..f3b60942 --- /dev/null +++ b/pynitrokey/nethsm/client/paths/config_time/get/security/security_requirement_object_0.py @@ -0,0 +1,11 @@ +# 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.py b/pynitrokey/nethsm/client/paths/config_time/put.py deleted file mode 100644 index 97c61295..00000000 --- a/pynitrokey/nethsm/client/paths/config_time/put.py +++ /dev/null @@ -1,354 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from pynitrokey.nethsm.client import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from pynitrokey.nethsm.client import schemas # noqa: F401 - -from pynitrokey.nethsm.client.model.time_config import TimeConfig - -from . import path - -# body param -SchemaForRequestBodyApplicationJson = TimeConfig - - -request_body_time_config = api_client.RequestBody( - content={ - 'application/json': api_client.MediaType( - schema=SchemaForRequestBodyApplicationJson), - }, - required=True, -) -_auth = [ - 'basic', -] - - -@dataclass -class ApiResponseFor204(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_204 = api_client.OpenApiResponse( - response_cls=ApiResponseFor204, -) - - -@dataclass -class ApiResponseFor400(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_400 = api_client.OpenApiResponse( - response_cls=ApiResponseFor400, -) - - -@dataclass -class ApiResponseFor401(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_401 = api_client.OpenApiResponse( - response_cls=ApiResponseFor401, -) - - -@dataclass -class ApiResponseFor403(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_403 = api_client.OpenApiResponse( - response_cls=ApiResponseFor403, -) - - -@dataclass -class ApiResponseFor412(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_412 = api_client.OpenApiResponse( - response_cls=ApiResponseFor412, -) -_status_code_to_response = { - '204': _response_for_204, - '400': _response_for_400, - '401': _response_for_401, - '403': _response_for_403, - '412': _response_for_412, -} - - -class BaseApi(api_client.Api): - @typing.overload - def _config_time_put_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor204, - ]: ... - - @typing.overload - def _config_time_put_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor204, - ]: ... - - - @typing.overload - def _config_time_put_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _config_time_put_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor204, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _config_time_put_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :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.value - - _headers = HTTPHeaderDict() - # TODO add cookie handling - - if body is schemas.unset: - raise exceptions.ApiValueError( - 'The required body parameter has an invalid value of: unset. Set a valid value instead') - _fields = None - _body = None - serialized_data = request_body_time_config.serialize(body, content_type) - _headers.add('Content-Type', content_type) - if 'fields' in serialized_data: - _fields = serialized_data['fields'] - elif 'body' in serialized_data: - _body = serialized_data['body'] - response = self.api_client.call_api( - resource_path=used_path, - method='put'.upper(), - headers=_headers, - fields=_fields, - body=_body, - auth_settings=_auth, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class ConfigTimePut(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def config_time_put( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor204, - ]: ... - - @typing.overload - def config_time_put( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor204, - ]: ... - - - @typing.overload - def config_time_put( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def config_time_put( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor204, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def config_time_put( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._config_time_put_oapg( - body=body, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForput(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def put( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor204, - ]: ... - - @typing.overload - def put( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor204, - ]: ... - - - @typing.overload - def put( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def put( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor204, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def put( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._config_time_put_oapg( - body=body, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/pynitrokey/nethsm/client/paths/config_time/put.pyi b/pynitrokey/nethsm/client/paths/config_time/put.pyi deleted file mode 100644 index 052ea685..00000000 --- a/pynitrokey/nethsm/client/paths/config_time/put.pyi +++ /dev/null @@ -1,342 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from pynitrokey.nethsm.client import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from pynitrokey.nethsm.client import schemas # noqa: F401 - -from pynitrokey.nethsm.client.model.time_config import TimeConfig - -# body param -SchemaForRequestBodyApplicationJson = TimeConfig - - -request_body_time_config = api_client.RequestBody( - content={ - 'application/json': api_client.MediaType( - schema=SchemaForRequestBodyApplicationJson), - }, - required=True, -) - - -@dataclass -class ApiResponseFor204(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_204 = api_client.OpenApiResponse( - response_cls=ApiResponseFor204, -) - - -@dataclass -class ApiResponseFor400(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_400 = api_client.OpenApiResponse( - response_cls=ApiResponseFor400, -) - - -@dataclass -class ApiResponseFor401(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_401 = api_client.OpenApiResponse( - response_cls=ApiResponseFor401, -) - - -@dataclass -class ApiResponseFor403(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_403 = api_client.OpenApiResponse( - response_cls=ApiResponseFor403, -) - - -@dataclass -class ApiResponseFor412(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_412 = api_client.OpenApiResponse( - response_cls=ApiResponseFor412, -) - - -class BaseApi(api_client.Api): - @typing.overload - def _config_time_put_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor204, - ]: ... - - @typing.overload - def _config_time_put_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor204, - ]: ... - - - @typing.overload - def _config_time_put_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _config_time_put_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor204, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _config_time_put_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :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.value - - _headers = HTTPHeaderDict() - # TODO add cookie handling - - if body is schemas.unset: - raise exceptions.ApiValueError( - 'The required body parameter has an invalid value of: unset. Set a valid value instead') - _fields = None - _body = None - serialized_data = request_body_time_config.serialize(body, content_type) - _headers.add('Content-Type', content_type) - if 'fields' in serialized_data: - _fields = serialized_data['fields'] - elif 'body' in serialized_data: - _body = serialized_data['body'] - response = self.api_client.call_api( - resource_path=used_path, - method='put'.upper(), - headers=_headers, - fields=_fields, - body=_body, - auth_settings=_auth, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class ConfigTimePut(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def config_time_put( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor204, - ]: ... - - @typing.overload - def config_time_put( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor204, - ]: ... - - - @typing.overload - def config_time_put( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def config_time_put( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor204, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def config_time_put( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._config_time_put_oapg( - body=body, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForput(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def put( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor204, - ]: ... - - @typing.overload - def put( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor204, - ]: ... - - - @typing.overload - def put( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def put( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor204, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def put( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._config_time_put_oapg( - body=body, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/pynitrokey/nethsm/client/paths/config_time/put/__init__.py b/pynitrokey/nethsm/client/paths/config_time/put/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/pynitrokey/nethsm/client/paths/config_time/put/operation.py b/pynitrokey/nethsm/client/paths/config_time/put/operation.py new file mode 100644 index 00000000..e223b6fe --- /dev/null +++ b/pynitrokey/nethsm/client/paths/config_time/put/operation.py @@ -0,0 +1,188 @@ +# 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 new file mode 100644 index 00000000..ad29c4a8 --- /dev/null +++ b/pynitrokey/nethsm/client/paths/config_time/put/request_body/__init__.py @@ -0,0 +1,20 @@ +# 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 new file mode 100644 index 00000000..e69de29b 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 new file mode 100644 index 00000000..e69de29b 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 new file mode 100644 index 00000000..301a2cce --- /dev/null +++ b/pynitrokey/nethsm/client/paths/config_time/put/request_body/content/application_json/schema.py @@ -0,0 +1,13 @@ +# 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 new file mode 100644 index 00000000..e69de29b 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 new file mode 100644 index 00000000..8e822e77 --- /dev/null +++ b/pynitrokey/nethsm/client/paths/config_time/put/responses/response_204/__init__.py @@ -0,0 +1,20 @@ +# coding: utf-8 + +""" + Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator +""" + +from pynitrokey.nethsm.client.shared_imports.response_imports import * # 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 new file mode 100644 index 00000000..0458793b --- /dev/null +++ b/pynitrokey/nethsm/client/paths/config_time/put/responses/response_400/__init__.py @@ -0,0 +1,20 @@ +# coding: utf-8 + +""" + Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator +""" + +from pynitrokey.nethsm.client.shared_imports.response_imports import * # 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 new file mode 100644 index 00000000..cee35061 --- /dev/null +++ b/pynitrokey/nethsm/client/paths/config_time/put/responses/response_401/__init__.py @@ -0,0 +1,20 @@ +# coding: utf-8 + +""" + Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator +""" + +from pynitrokey.nethsm.client.shared_imports.response_imports import * # 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 new file mode 100644 index 00000000..7bc0249d --- /dev/null +++ b/pynitrokey/nethsm/client/paths/config_time/put/responses/response_403/__init__.py @@ -0,0 +1,20 @@ +# coding: utf-8 + +""" + Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator +""" + +from pynitrokey.nethsm.client.shared_imports.response_imports import * # 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 new file mode 100644 index 00000000..088c436c --- /dev/null +++ b/pynitrokey/nethsm/client/paths/config_time/put/responses/response_406/__init__.py @@ -0,0 +1,20 @@ +# coding: utf-8 + +""" + Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator +""" + +from pynitrokey.nethsm.client.shared_imports.response_imports import * # 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 new file mode 100644 index 00000000..50b6212f --- /dev/null +++ b/pynitrokey/nethsm/client/paths/config_time/put/responses/response_412/__init__.py @@ -0,0 +1,20 @@ +# coding: utf-8 + +""" + Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator +""" + +from pynitrokey.nethsm.client.shared_imports.response_imports import * # 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 new file mode 100644 index 00000000..e69de29b 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 new file mode 100644 index 00000000..f3b60942 --- /dev/null +++ b/pynitrokey/nethsm/client/paths/config_time/put/security/security_requirement_object_0.py @@ -0,0 +1,11 @@ +# 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 index ab25decb..8e88cb9c 100644 --- a/pynitrokey/nethsm/client/paths/config_tls_cert_pem/__init__.py +++ b/pynitrokey/nethsm/client/paths/config_tls_cert_pem/__init__.py @@ -1,7 +1,5 @@ # 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.paths.config_tls_cert_pem import Api +# from pynitrokey.nethsm.client.apis.paths.config_tls_cert_pem import ConfigTlsCertPem -from pynitrokey.nethsm.client.paths import PathValues - -path = PathValues.CONFIG_TLS_CERT_PEM \ No newline at end of file +path = "/config/tls/cert.pem" \ No newline at end of file diff --git a/pynitrokey/nethsm/client/paths/config_tls_cert_pem/get.py b/pynitrokey/nethsm/client/paths/config_tls_cert_pem/get.py deleted file mode 100644 index b43330df..00000000 --- a/pynitrokey/nethsm/client/paths/config_tls_cert_pem/get.py +++ /dev/null @@ -1,275 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from pynitrokey.nethsm.client import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from pynitrokey.nethsm.client import schemas # noqa: F401 - -from . import path - -_auth = [ - 'basic', -] -SchemaFor200ResponseBodyApplicationXPemFile = schemas.StrSchema - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: typing.Union[ - SchemaFor200ResponseBodyApplicationXPemFile, - ] - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, - content={ - 'application/x-pem-file': api_client.MediaType( - schema=SchemaFor200ResponseBodyApplicationXPemFile), - }, -) - - -@dataclass -class ApiResponseFor401(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_401 = api_client.OpenApiResponse( - response_cls=ApiResponseFor401, -) - - -@dataclass -class ApiResponseFor403(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_403 = api_client.OpenApiResponse( - response_cls=ApiResponseFor403, -) - - -@dataclass -class ApiResponseFor412(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_412 = api_client.OpenApiResponse( - response_cls=ApiResponseFor412, -) -_status_code_to_response = { - '200': _response_for_200, - '401': _response_for_401, - '403': _response_for_403, - '412': _response_for_412, -} -_all_accept_content_types = ( - 'application/x-pem-file', -) - - -class BaseApi(api_client.Api): - @typing.overload - def _config_tls_cert_pem_get_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _config_tls_cert_pem_get_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _config_tls_cert_pem_get_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _config_tls_cert_pem_get_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :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.value - - _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) - - response = self.api_client.call_api( - resource_path=used_path, - method='get'.upper(), - headers=_headers, - auth_settings=_auth, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class ConfigTlsCertPemGet(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def config_tls_cert_pem_get( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def config_tls_cert_pem_get( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def config_tls_cert_pem_get( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def config_tls_cert_pem_get( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._config_tls_cert_pem_get_oapg( - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForget(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def get( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def get( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def get( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def get( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._config_tls_cert_pem_get_oapg( - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/pynitrokey/nethsm/client/paths/config_tls_cert_pem/get.pyi b/pynitrokey/nethsm/client/paths/config_tls_cert_pem/get.pyi deleted file mode 100644 index d0f460ae..00000000 --- a/pynitrokey/nethsm/client/paths/config_tls_cert_pem/get.pyi +++ /dev/null @@ -1,264 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from pynitrokey.nethsm.client import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from pynitrokey.nethsm.client import schemas # noqa: F401 - -SchemaFor200ResponseBodyApplicationXPemFile = schemas.StrSchema - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: typing.Union[ - SchemaFor200ResponseBodyApplicationXPemFile, - ] - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, - content={ - 'application/x-pem-file': api_client.MediaType( - schema=SchemaFor200ResponseBodyApplicationXPemFile), - }, -) - - -@dataclass -class ApiResponseFor401(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_401 = api_client.OpenApiResponse( - response_cls=ApiResponseFor401, -) - - -@dataclass -class ApiResponseFor403(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_403 = api_client.OpenApiResponse( - response_cls=ApiResponseFor403, -) - - -@dataclass -class ApiResponseFor412(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_412 = api_client.OpenApiResponse( - response_cls=ApiResponseFor412, -) -_all_accept_content_types = ( - 'application/x-pem-file', -) - - -class BaseApi(api_client.Api): - @typing.overload - def _config_tls_cert_pem_get_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _config_tls_cert_pem_get_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _config_tls_cert_pem_get_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _config_tls_cert_pem_get_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :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.value - - _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) - - response = self.api_client.call_api( - resource_path=used_path, - method='get'.upper(), - headers=_headers, - auth_settings=_auth, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class ConfigTlsCertPemGet(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def config_tls_cert_pem_get( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def config_tls_cert_pem_get( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def config_tls_cert_pem_get( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def config_tls_cert_pem_get( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._config_tls_cert_pem_get_oapg( - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForget(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def get( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def get( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def get( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def get( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._config_tls_cert_pem_get_oapg( - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - 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 new file mode 100644 index 00000000..e69de29b 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 new file mode 100644 index 00000000..dadd3d43 --- /dev/null +++ b/pynitrokey/nethsm/client/paths/config_tls_cert_pem/get/operation.py @@ -0,0 +1,169 @@ +# 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 new file mode 100644 index 00000000..e69de29b 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 new file mode 100644 index 00000000..9354e71e --- /dev/null +++ b/pynitrokey/nethsm/client/paths/config_tls_cert_pem/get/responses/response_200/__init__.py @@ -0,0 +1,29 @@ +# coding: utf-8 + +""" + Generated 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 new file mode 100644 index 00000000..e69de29b 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 new file mode 100644 index 00000000..e69de29b 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 new file mode 100644 index 00000000..1457aaf5 --- /dev/null +++ b/pynitrokey/nethsm/client/paths/config_tls_cert_pem/get/responses/response_200/content/application_x_pem_file/schema.py @@ -0,0 +1,13 @@ +# 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 new file mode 100644 index 00000000..cee35061 --- /dev/null +++ b/pynitrokey/nethsm/client/paths/config_tls_cert_pem/get/responses/response_401/__init__.py @@ -0,0 +1,20 @@ +# coding: utf-8 + +""" + Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator +""" + +from pynitrokey.nethsm.client.shared_imports.response_imports import * # 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 new file mode 100644 index 00000000..7bc0249d --- /dev/null +++ b/pynitrokey/nethsm/client/paths/config_tls_cert_pem/get/responses/response_403/__init__.py @@ -0,0 +1,20 @@ +# coding: utf-8 + +""" + Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator +""" + +from pynitrokey.nethsm.client.shared_imports.response_imports import * # 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 new file mode 100644 index 00000000..088c436c --- /dev/null +++ b/pynitrokey/nethsm/client/paths/config_tls_cert_pem/get/responses/response_406/__init__.py @@ -0,0 +1,20 @@ +# coding: utf-8 + +""" + Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator +""" + +from pynitrokey.nethsm.client.shared_imports.response_imports import * # 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 new file mode 100644 index 00000000..50b6212f --- /dev/null +++ b/pynitrokey/nethsm/client/paths/config_tls_cert_pem/get/responses/response_412/__init__.py @@ -0,0 +1,20 @@ +# coding: utf-8 + +""" + Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator +""" + +from pynitrokey.nethsm.client.shared_imports.response_imports import * # 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 new file mode 100644 index 00000000..0339058b --- /dev/null +++ b/pynitrokey/nethsm/client/paths/config_tls_cert_pem/get/responses/response_415/__init__.py @@ -0,0 +1,20 @@ +# coding: utf-8 + +""" + Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator +""" + +from pynitrokey.nethsm.client.shared_imports.response_imports import * # 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 new file mode 100644 index 00000000..e69de29b 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 new file mode 100644 index 00000000..f3b60942 --- /dev/null +++ b/pynitrokey/nethsm/client/paths/config_tls_cert_pem/get/security/security_requirement_object_0.py @@ -0,0 +1,11 @@ +# 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.py b/pynitrokey/nethsm/client/paths/config_tls_cert_pem/put.py deleted file mode 100644 index fc79661e..00000000 --- a/pynitrokey/nethsm/client/paths/config_tls_cert_pem/put.py +++ /dev/null @@ -1,339 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from pynitrokey.nethsm.client import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from pynitrokey.nethsm.client import schemas # noqa: F401 - -from . import path - -# body param -SchemaForRequestBodyApplicationXPemFile = schemas.StrSchema - - -request_body_body = api_client.RequestBody( - content={ - 'application/x-pem-file': api_client.MediaType( - schema=SchemaForRequestBodyApplicationXPemFile), - }, - required=True, -) -_auth = [ - 'basic', -] - - -@dataclass -class ApiResponseFor201(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_201 = api_client.OpenApiResponse( - response_cls=ApiResponseFor201, -) - - -@dataclass -class ApiResponseFor401(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_401 = api_client.OpenApiResponse( - response_cls=ApiResponseFor401, -) - - -@dataclass -class ApiResponseFor403(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_403 = api_client.OpenApiResponse( - response_cls=ApiResponseFor403, -) - - -@dataclass -class ApiResponseFor412(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_412 = api_client.OpenApiResponse( - response_cls=ApiResponseFor412, -) -_status_code_to_response = { - '201': _response_for_201, - '401': _response_for_401, - '403': _response_for_403, - '412': _response_for_412, -} - - -class BaseApi(api_client.Api): - @typing.overload - def _config_tls_cert_pem_put_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationXPemFile,str, ], - content_type: typing_extensions.Literal["application/x-pem-file"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor201, - ]: ... - - @typing.overload - def _config_tls_cert_pem_put_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationXPemFile,str, ], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor201, - ]: ... - - - @typing.overload - def _config_tls_cert_pem_put_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationXPemFile,str, ], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _config_tls_cert_pem_put_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationXPemFile,str, ], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor201, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _config_tls_cert_pem_put_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationXPemFile,str, ], - content_type: str = 'application/x-pem-file', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :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.value - - _headers = HTTPHeaderDict() - # TODO add cookie handling - - if body is schemas.unset: - raise exceptions.ApiValueError( - 'The required body parameter has an invalid value of: unset. Set a valid value instead') - _fields = None - _body = None - serialized_data = request_body_body.serialize(body, content_type) - _headers.add('Content-Type', content_type) - if 'fields' in serialized_data: - _fields = serialized_data['fields'] - elif 'body' in serialized_data: - _body = serialized_data['body'] - response = self.api_client.call_api( - resource_path=used_path, - method='put'.upper(), - headers=_headers, - fields=_fields, - body=_body, - auth_settings=_auth, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class ConfigTlsCertPemPut(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def config_tls_cert_pem_put( - self, - body: typing.Union[SchemaForRequestBodyApplicationXPemFile,str, ], - content_type: typing_extensions.Literal["application/x-pem-file"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor201, - ]: ... - - @typing.overload - def config_tls_cert_pem_put( - self, - body: typing.Union[SchemaForRequestBodyApplicationXPemFile,str, ], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor201, - ]: ... - - - @typing.overload - def config_tls_cert_pem_put( - self, - body: typing.Union[SchemaForRequestBodyApplicationXPemFile,str, ], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def config_tls_cert_pem_put( - self, - body: typing.Union[SchemaForRequestBodyApplicationXPemFile,str, ], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor201, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def config_tls_cert_pem_put( - self, - body: typing.Union[SchemaForRequestBodyApplicationXPemFile,str, ], - content_type: str = 'application/x-pem-file', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._config_tls_cert_pem_put_oapg( - body=body, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForput(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def put( - self, - body: typing.Union[SchemaForRequestBodyApplicationXPemFile,str, ], - content_type: typing_extensions.Literal["application/x-pem-file"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor201, - ]: ... - - @typing.overload - def put( - self, - body: typing.Union[SchemaForRequestBodyApplicationXPemFile,str, ], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor201, - ]: ... - - - @typing.overload - def put( - self, - body: typing.Union[SchemaForRequestBodyApplicationXPemFile,str, ], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def put( - self, - body: typing.Union[SchemaForRequestBodyApplicationXPemFile,str, ], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor201, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def put( - self, - body: typing.Union[SchemaForRequestBodyApplicationXPemFile,str, ], - content_type: str = 'application/x-pem-file', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._config_tls_cert_pem_put_oapg( - body=body, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/pynitrokey/nethsm/client/paths/config_tls_cert_pem/put.pyi b/pynitrokey/nethsm/client/paths/config_tls_cert_pem/put.pyi deleted file mode 100644 index 7a1b0434..00000000 --- a/pynitrokey/nethsm/client/paths/config_tls_cert_pem/put.pyi +++ /dev/null @@ -1,328 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from pynitrokey.nethsm.client import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from pynitrokey.nethsm.client import schemas # noqa: F401 - -# body param -SchemaForRequestBodyApplicationXPemFile = schemas.StrSchema - - -request_body_body = api_client.RequestBody( - content={ - 'application/x-pem-file': api_client.MediaType( - schema=SchemaForRequestBodyApplicationXPemFile), - }, - required=True, -) - - -@dataclass -class ApiResponseFor201(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_201 = api_client.OpenApiResponse( - response_cls=ApiResponseFor201, -) - - -@dataclass -class ApiResponseFor401(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_401 = api_client.OpenApiResponse( - response_cls=ApiResponseFor401, -) - - -@dataclass -class ApiResponseFor403(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_403 = api_client.OpenApiResponse( - response_cls=ApiResponseFor403, -) - - -@dataclass -class ApiResponseFor412(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_412 = api_client.OpenApiResponse( - response_cls=ApiResponseFor412, -) - - -class BaseApi(api_client.Api): - @typing.overload - def _config_tls_cert_pem_put_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationXPemFile,str, ], - content_type: typing_extensions.Literal["application/x-pem-file"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor201, - ]: ... - - @typing.overload - def _config_tls_cert_pem_put_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationXPemFile,str, ], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor201, - ]: ... - - - @typing.overload - def _config_tls_cert_pem_put_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationXPemFile,str, ], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _config_tls_cert_pem_put_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationXPemFile,str, ], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor201, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _config_tls_cert_pem_put_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationXPemFile,str, ], - content_type: str = 'application/x-pem-file', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :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.value - - _headers = HTTPHeaderDict() - # TODO add cookie handling - - if body is schemas.unset: - raise exceptions.ApiValueError( - 'The required body parameter has an invalid value of: unset. Set a valid value instead') - _fields = None - _body = None - serialized_data = request_body_body.serialize(body, content_type) - _headers.add('Content-Type', content_type) - if 'fields' in serialized_data: - _fields = serialized_data['fields'] - elif 'body' in serialized_data: - _body = serialized_data['body'] - response = self.api_client.call_api( - resource_path=used_path, - method='put'.upper(), - headers=_headers, - fields=_fields, - body=_body, - auth_settings=_auth, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class ConfigTlsCertPemPut(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def config_tls_cert_pem_put( - self, - body: typing.Union[SchemaForRequestBodyApplicationXPemFile,str, ], - content_type: typing_extensions.Literal["application/x-pem-file"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor201, - ]: ... - - @typing.overload - def config_tls_cert_pem_put( - self, - body: typing.Union[SchemaForRequestBodyApplicationXPemFile,str, ], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor201, - ]: ... - - - @typing.overload - def config_tls_cert_pem_put( - self, - body: typing.Union[SchemaForRequestBodyApplicationXPemFile,str, ], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def config_tls_cert_pem_put( - self, - body: typing.Union[SchemaForRequestBodyApplicationXPemFile,str, ], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor201, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def config_tls_cert_pem_put( - self, - body: typing.Union[SchemaForRequestBodyApplicationXPemFile,str, ], - content_type: str = 'application/x-pem-file', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._config_tls_cert_pem_put_oapg( - body=body, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForput(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def put( - self, - body: typing.Union[SchemaForRequestBodyApplicationXPemFile,str, ], - content_type: typing_extensions.Literal["application/x-pem-file"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor201, - ]: ... - - @typing.overload - def put( - self, - body: typing.Union[SchemaForRequestBodyApplicationXPemFile,str, ], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor201, - ]: ... - - - @typing.overload - def put( - self, - body: typing.Union[SchemaForRequestBodyApplicationXPemFile,str, ], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def put( - self, - body: typing.Union[SchemaForRequestBodyApplicationXPemFile,str, ], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor201, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def put( - self, - body: typing.Union[SchemaForRequestBodyApplicationXPemFile,str, ], - content_type: str = 'application/x-pem-file', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._config_tls_cert_pem_put_oapg( - body=body, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - 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 new file mode 100644 index 00000000..e69de29b 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 new file mode 100644 index 00000000..f4159986 --- /dev/null +++ b/pynitrokey/nethsm/client/paths/config_tls_cert_pem/put/operation.py @@ -0,0 +1,179 @@ +# 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 new file mode 100644 index 00000000..1744b1b6 --- /dev/null +++ b/pynitrokey/nethsm/client/paths/config_tls_cert_pem/put/request_body/__init__.py @@ -0,0 +1,20 @@ +# 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 new file mode 100644 index 00000000..e69de29b 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 new file mode 100644 index 00000000..e69de29b 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 new file mode 100644 index 00000000..1457aaf5 --- /dev/null +++ b/pynitrokey/nethsm/client/paths/config_tls_cert_pem/put/request_body/content/application_x_pem_file/schema.py @@ -0,0 +1,13 @@ +# 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 new file mode 100644 index 00000000..e69de29b 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 new file mode 100644 index 00000000..dca4edc5 --- /dev/null +++ b/pynitrokey/nethsm/client/paths/config_tls_cert_pem/put/responses/response_201/__init__.py @@ -0,0 +1,20 @@ +# coding: utf-8 + +""" + Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator +""" + +from pynitrokey.nethsm.client.shared_imports.response_imports import * # 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 new file mode 100644 index 00000000..0458793b --- /dev/null +++ b/pynitrokey/nethsm/client/paths/config_tls_cert_pem/put/responses/response_400/__init__.py @@ -0,0 +1,20 @@ +# coding: utf-8 + +""" + Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator +""" + +from pynitrokey.nethsm.client.shared_imports.response_imports import * # 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 new file mode 100644 index 00000000..cee35061 --- /dev/null +++ b/pynitrokey/nethsm/client/paths/config_tls_cert_pem/put/responses/response_401/__init__.py @@ -0,0 +1,20 @@ +# coding: utf-8 + +""" + Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator +""" + +from pynitrokey.nethsm.client.shared_imports.response_imports import * # 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 new file mode 100644 index 00000000..7bc0249d --- /dev/null +++ b/pynitrokey/nethsm/client/paths/config_tls_cert_pem/put/responses/response_403/__init__.py @@ -0,0 +1,20 @@ +# coding: utf-8 + +""" + Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator +""" + +from pynitrokey.nethsm.client.shared_imports.response_imports import * # 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 new file mode 100644 index 00000000..088c436c --- /dev/null +++ b/pynitrokey/nethsm/client/paths/config_tls_cert_pem/put/responses/response_406/__init__.py @@ -0,0 +1,20 @@ +# coding: utf-8 + +""" + Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator +""" + +from pynitrokey.nethsm.client.shared_imports.response_imports import * # 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 new file mode 100644 index 00000000..50b6212f --- /dev/null +++ b/pynitrokey/nethsm/client/paths/config_tls_cert_pem/put/responses/response_412/__init__.py @@ -0,0 +1,20 @@ +# coding: utf-8 + +""" + Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator +""" + +from pynitrokey.nethsm.client.shared_imports.response_imports import * # 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 new file mode 100644 index 00000000..e69de29b 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 new file mode 100644 index 00000000..f3b60942 --- /dev/null +++ b/pynitrokey/nethsm/client/paths/config_tls_cert_pem/put/security/security_requirement_object_0.py @@ -0,0 +1,11 @@ +# 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 index 50cedf97..7cf72761 100644 --- a/pynitrokey/nethsm/client/paths/config_tls_csr_pem/__init__.py +++ b/pynitrokey/nethsm/client/paths/config_tls_csr_pem/__init__.py @@ -1,7 +1,5 @@ # 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.paths.config_tls_csr_pem import Api +# from pynitrokey.nethsm.client.apis.paths.config_tls_csr_pem import ConfigTlsCsrPem -from pynitrokey.nethsm.client.paths import PathValues - -path = PathValues.CONFIG_TLS_CSR_PEM \ No newline at end of file +path = "/config/tls/csr.pem" \ No newline at end of file diff --git a/pynitrokey/nethsm/client/paths/config_tls_csr_pem/post.py b/pynitrokey/nethsm/client/paths/config_tls_csr_pem/post.py deleted file mode 100644 index b4a2cf65..00000000 --- a/pynitrokey/nethsm/client/paths/config_tls_csr_pem/post.py +++ /dev/null @@ -1,371 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from pynitrokey.nethsm.client import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from pynitrokey.nethsm.client import schemas # noqa: F401 - -from pynitrokey.nethsm.client.model.distinguished_name import DistinguishedName - -from . import path - -# body param -SchemaForRequestBodyApplicationJson = DistinguishedName - - -request_body_distinguished_name = api_client.RequestBody( - content={ - 'application/json': api_client.MediaType( - schema=SchemaForRequestBodyApplicationJson), - }, - required=True, -) -_auth = [ - 'basic', -] -SchemaFor200ResponseBodyApplicationXPemFile = schemas.StrSchema - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: typing.Union[ - SchemaFor200ResponseBodyApplicationXPemFile, - ] - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, - content={ - 'application/x-pem-file': api_client.MediaType( - schema=SchemaFor200ResponseBodyApplicationXPemFile), - }, -) - - -@dataclass -class ApiResponseFor401(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_401 = api_client.OpenApiResponse( - response_cls=ApiResponseFor401, -) - - -@dataclass -class ApiResponseFor403(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_403 = api_client.OpenApiResponse( - response_cls=ApiResponseFor403, -) - - -@dataclass -class ApiResponseFor412(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_412 = api_client.OpenApiResponse( - response_cls=ApiResponseFor412, -) -_status_code_to_response = { - '200': _response_for_200, - '401': _response_for_401, - '403': _response_for_403, - '412': _response_for_412, -} -_all_accept_content_types = ( - 'application/x-pem-file', -) - - -class BaseApi(api_client.Api): - @typing.overload - def _config_tls_csr_pem_post_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _config_tls_csr_pem_post_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def _config_tls_csr_pem_post_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _config_tls_csr_pem_post_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _config_tls_csr_pem_post_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :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.value - - _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) - - if body is schemas.unset: - raise exceptions.ApiValueError( - 'The required body parameter has an invalid value of: unset. Set a valid value instead') - _fields = None - _body = None - serialized_data = request_body_distinguished_name.serialize(body, content_type) - _headers.add('Content-Type', content_type) - if 'fields' in serialized_data: - _fields = serialized_data['fields'] - elif 'body' in serialized_data: - _body = serialized_data['body'] - response = self.api_client.call_api( - resource_path=used_path, - method='post'.upper(), - headers=_headers, - fields=_fields, - body=_body, - auth_settings=_auth, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class ConfigTlsCsrPemPost(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def config_tls_csr_pem_post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def config_tls_csr_pem_post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def config_tls_csr_pem_post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def config_tls_csr_pem_post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def config_tls_csr_pem_post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._config_tls_csr_pem_post_oapg( - body=body, - content_type=content_type, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForpost(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._config_tls_csr_pem_post_oapg( - body=body, - content_type=content_type, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/pynitrokey/nethsm/client/paths/config_tls_csr_pem/post.pyi b/pynitrokey/nethsm/client/paths/config_tls_csr_pem/post.pyi deleted file mode 100644 index 559f3250..00000000 --- a/pynitrokey/nethsm/client/paths/config_tls_csr_pem/post.pyi +++ /dev/null @@ -1,360 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from pynitrokey.nethsm.client import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from pynitrokey.nethsm.client import schemas # noqa: F401 - -from pynitrokey.nethsm.client.model.distinguished_name import DistinguishedName - -# body param -SchemaForRequestBodyApplicationJson = DistinguishedName - - -request_body_distinguished_name = api_client.RequestBody( - content={ - 'application/json': api_client.MediaType( - schema=SchemaForRequestBodyApplicationJson), - }, - required=True, -) -SchemaFor200ResponseBodyApplicationXPemFile = schemas.StrSchema - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: typing.Union[ - SchemaFor200ResponseBodyApplicationXPemFile, - ] - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, - content={ - 'application/x-pem-file': api_client.MediaType( - schema=SchemaFor200ResponseBodyApplicationXPemFile), - }, -) - - -@dataclass -class ApiResponseFor401(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_401 = api_client.OpenApiResponse( - response_cls=ApiResponseFor401, -) - - -@dataclass -class ApiResponseFor403(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_403 = api_client.OpenApiResponse( - response_cls=ApiResponseFor403, -) - - -@dataclass -class ApiResponseFor412(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_412 = api_client.OpenApiResponse( - response_cls=ApiResponseFor412, -) -_all_accept_content_types = ( - 'application/x-pem-file', -) - - -class BaseApi(api_client.Api): - @typing.overload - def _config_tls_csr_pem_post_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _config_tls_csr_pem_post_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def _config_tls_csr_pem_post_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _config_tls_csr_pem_post_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _config_tls_csr_pem_post_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :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.value - - _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) - - if body is schemas.unset: - raise exceptions.ApiValueError( - 'The required body parameter has an invalid value of: unset. Set a valid value instead') - _fields = None - _body = None - serialized_data = request_body_distinguished_name.serialize(body, content_type) - _headers.add('Content-Type', content_type) - if 'fields' in serialized_data: - _fields = serialized_data['fields'] - elif 'body' in serialized_data: - _body = serialized_data['body'] - response = self.api_client.call_api( - resource_path=used_path, - method='post'.upper(), - headers=_headers, - fields=_fields, - body=_body, - auth_settings=_auth, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class ConfigTlsCsrPemPost(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def config_tls_csr_pem_post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def config_tls_csr_pem_post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def config_tls_csr_pem_post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def config_tls_csr_pem_post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def config_tls_csr_pem_post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._config_tls_csr_pem_post_oapg( - body=body, - content_type=content_type, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForpost(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._config_tls_csr_pem_post_oapg( - body=body, - content_type=content_type, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - 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 new file mode 100644 index 00000000..e69de29b 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 new file mode 100644 index 00000000..8c6285e0 --- /dev/null +++ b/pynitrokey/nethsm/client/paths/config_tls_csr_pem/post/operation.py @@ -0,0 +1,190 @@ +# 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 new file mode 100644 index 00000000..ad29c4a8 --- /dev/null +++ b/pynitrokey/nethsm/client/paths/config_tls_csr_pem/post/request_body/__init__.py @@ -0,0 +1,20 @@ +# 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 new file mode 100644 index 00000000..e69de29b 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 new file mode 100644 index 00000000..e69de29b 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 new file mode 100644 index 00000000..500078b6 --- /dev/null +++ b/pynitrokey/nethsm/client/paths/config_tls_csr_pem/post/request_body/content/application_json/schema.py @@ -0,0 +1,13 @@ +# 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 new file mode 100644 index 00000000..e69de29b 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 new file mode 100644 index 00000000..9354e71e --- /dev/null +++ b/pynitrokey/nethsm/client/paths/config_tls_csr_pem/post/responses/response_200/__init__.py @@ -0,0 +1,29 @@ +# coding: utf-8 + +""" + Generated 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 new file mode 100644 index 00000000..e69de29b 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 new file mode 100644 index 00000000..e69de29b 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 new file mode 100644 index 00000000..dadf2ae9 --- /dev/null +++ b/pynitrokey/nethsm/client/paths/config_tls_csr_pem/post/responses/response_200/content/application_x_pem_file/schema.py @@ -0,0 +1,13 @@ +# 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 new file mode 100644 index 00000000..cee35061 --- /dev/null +++ b/pynitrokey/nethsm/client/paths/config_tls_csr_pem/post/responses/response_401/__init__.py @@ -0,0 +1,20 @@ +# coding: utf-8 + +""" + Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator +""" + +from pynitrokey.nethsm.client.shared_imports.response_imports import * # 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 new file mode 100644 index 00000000..7bc0249d --- /dev/null +++ b/pynitrokey/nethsm/client/paths/config_tls_csr_pem/post/responses/response_403/__init__.py @@ -0,0 +1,20 @@ +# coding: utf-8 + +""" + Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator +""" + +from pynitrokey.nethsm.client.shared_imports.response_imports import * # 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 new file mode 100644 index 00000000..088c436c --- /dev/null +++ b/pynitrokey/nethsm/client/paths/config_tls_csr_pem/post/responses/response_406/__init__.py @@ -0,0 +1,20 @@ +# coding: utf-8 + +""" + Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator +""" + +from pynitrokey.nethsm.client.shared_imports.response_imports import * # 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 new file mode 100644 index 00000000..50b6212f --- /dev/null +++ b/pynitrokey/nethsm/client/paths/config_tls_csr_pem/post/responses/response_412/__init__.py @@ -0,0 +1,20 @@ +# coding: utf-8 + +""" + Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator +""" + +from pynitrokey.nethsm.client.shared_imports.response_imports import * # 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 new file mode 100644 index 00000000..e69de29b 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 new file mode 100644 index 00000000..f3b60942 --- /dev/null +++ b/pynitrokey/nethsm/client/paths/config_tls_csr_pem/post/security/security_requirement_object_0.py @@ -0,0 +1,11 @@ +# 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 index 658d07b4..28210b0f 100644 --- a/pynitrokey/nethsm/client/paths/config_tls_generate/__init__.py +++ b/pynitrokey/nethsm/client/paths/config_tls_generate/__init__.py @@ -1,7 +1,5 @@ # 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.paths.config_tls_generate import Api +# from pynitrokey.nethsm.client.apis.paths.config_tls_generate import ConfigTlsGenerate -from pynitrokey.nethsm.client.paths import PathValues - -path = PathValues.CONFIG_TLS_GENERATE \ No newline at end of file +path = "/config/tls/generate" \ No newline at end of file diff --git a/pynitrokey/nethsm/client/paths/config_tls_generate/post.py b/pynitrokey/nethsm/client/paths/config_tls_generate/post.py deleted file mode 100644 index 2f06dfa8..00000000 --- a/pynitrokey/nethsm/client/paths/config_tls_generate/post.py +++ /dev/null @@ -1,354 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from pynitrokey.nethsm.client import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from pynitrokey.nethsm.client import schemas # noqa: F401 - -from pynitrokey.nethsm.client.model.tls_key_generate_request_data import TlsKeyGenerateRequestData - -from . import path - -# body param -SchemaForRequestBodyApplicationJson = TlsKeyGenerateRequestData - - -request_body_tls_key_generate_request_data = api_client.RequestBody( - content={ - 'application/json': api_client.MediaType( - schema=SchemaForRequestBodyApplicationJson), - }, - required=True, -) -_auth = [ - 'basic', -] - - -@dataclass -class ApiResponseFor204(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_204 = api_client.OpenApiResponse( - response_cls=ApiResponseFor204, -) - - -@dataclass -class ApiResponseFor400(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_400 = api_client.OpenApiResponse( - response_cls=ApiResponseFor400, -) - - -@dataclass -class ApiResponseFor401(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_401 = api_client.OpenApiResponse( - response_cls=ApiResponseFor401, -) - - -@dataclass -class ApiResponseFor403(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_403 = api_client.OpenApiResponse( - response_cls=ApiResponseFor403, -) - - -@dataclass -class ApiResponseFor412(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_412 = api_client.OpenApiResponse( - response_cls=ApiResponseFor412, -) -_status_code_to_response = { - '204': _response_for_204, - '400': _response_for_400, - '401': _response_for_401, - '403': _response_for_403, - '412': _response_for_412, -} - - -class BaseApi(api_client.Api): - @typing.overload - def _config_tls_generate_post_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor204, - ]: ... - - @typing.overload - def _config_tls_generate_post_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor204, - ]: ... - - - @typing.overload - def _config_tls_generate_post_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _config_tls_generate_post_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor204, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _config_tls_generate_post_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :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.value - - _headers = HTTPHeaderDict() - # TODO add cookie handling - - if body is schemas.unset: - raise exceptions.ApiValueError( - 'The required body parameter has an invalid value of: unset. Set a valid value instead') - _fields = None - _body = None - serialized_data = request_body_tls_key_generate_request_data.serialize(body, content_type) - _headers.add('Content-Type', content_type) - if 'fields' in serialized_data: - _fields = serialized_data['fields'] - elif 'body' in serialized_data: - _body = serialized_data['body'] - response = self.api_client.call_api( - resource_path=used_path, - method='post'.upper(), - headers=_headers, - fields=_fields, - body=_body, - auth_settings=_auth, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class ConfigTlsGeneratePost(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def config_tls_generate_post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor204, - ]: ... - - @typing.overload - def config_tls_generate_post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor204, - ]: ... - - - @typing.overload - def config_tls_generate_post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def config_tls_generate_post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor204, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def config_tls_generate_post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._config_tls_generate_post_oapg( - body=body, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForpost(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor204, - ]: ... - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor204, - ]: ... - - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor204, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._config_tls_generate_post_oapg( - body=body, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/pynitrokey/nethsm/client/paths/config_tls_generate/post.pyi b/pynitrokey/nethsm/client/paths/config_tls_generate/post.pyi deleted file mode 100644 index b0eb65c8..00000000 --- a/pynitrokey/nethsm/client/paths/config_tls_generate/post.pyi +++ /dev/null @@ -1,342 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from pynitrokey.nethsm.client import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from pynitrokey.nethsm.client import schemas # noqa: F401 - -from pynitrokey.nethsm.client.model.tls_key_generate_request_data import TlsKeyGenerateRequestData - -# body param -SchemaForRequestBodyApplicationJson = TlsKeyGenerateRequestData - - -request_body_tls_key_generate_request_data = api_client.RequestBody( - content={ - 'application/json': api_client.MediaType( - schema=SchemaForRequestBodyApplicationJson), - }, - required=True, -) - - -@dataclass -class ApiResponseFor204(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_204 = api_client.OpenApiResponse( - response_cls=ApiResponseFor204, -) - - -@dataclass -class ApiResponseFor400(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_400 = api_client.OpenApiResponse( - response_cls=ApiResponseFor400, -) - - -@dataclass -class ApiResponseFor401(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_401 = api_client.OpenApiResponse( - response_cls=ApiResponseFor401, -) - - -@dataclass -class ApiResponseFor403(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_403 = api_client.OpenApiResponse( - response_cls=ApiResponseFor403, -) - - -@dataclass -class ApiResponseFor412(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_412 = api_client.OpenApiResponse( - response_cls=ApiResponseFor412, -) - - -class BaseApi(api_client.Api): - @typing.overload - def _config_tls_generate_post_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor204, - ]: ... - - @typing.overload - def _config_tls_generate_post_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor204, - ]: ... - - - @typing.overload - def _config_tls_generate_post_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _config_tls_generate_post_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor204, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _config_tls_generate_post_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :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.value - - _headers = HTTPHeaderDict() - # TODO add cookie handling - - if body is schemas.unset: - raise exceptions.ApiValueError( - 'The required body parameter has an invalid value of: unset. Set a valid value instead') - _fields = None - _body = None - serialized_data = request_body_tls_key_generate_request_data.serialize(body, content_type) - _headers.add('Content-Type', content_type) - if 'fields' in serialized_data: - _fields = serialized_data['fields'] - elif 'body' in serialized_data: - _body = serialized_data['body'] - response = self.api_client.call_api( - resource_path=used_path, - method='post'.upper(), - headers=_headers, - fields=_fields, - body=_body, - auth_settings=_auth, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class ConfigTlsGeneratePost(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def config_tls_generate_post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor204, - ]: ... - - @typing.overload - def config_tls_generate_post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor204, - ]: ... - - - @typing.overload - def config_tls_generate_post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def config_tls_generate_post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor204, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def config_tls_generate_post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._config_tls_generate_post_oapg( - body=body, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForpost(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor204, - ]: ... - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor204, - ]: ... - - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor204, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._config_tls_generate_post_oapg( - body=body, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/pynitrokey/nethsm/client/paths/config_tls_generate/post/__init__.py b/pynitrokey/nethsm/client/paths/config_tls_generate/post/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/pynitrokey/nethsm/client/paths/config_tls_generate/post/operation.py b/pynitrokey/nethsm/client/paths/config_tls_generate/post/operation.py new file mode 100644 index 00000000..99c0232c --- /dev/null +++ b/pynitrokey/nethsm/client/paths/config_tls_generate/post/operation.py @@ -0,0 +1,188 @@ +# 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 new file mode 100644 index 00000000..ad29c4a8 --- /dev/null +++ b/pynitrokey/nethsm/client/paths/config_tls_generate/post/request_body/__init__.py @@ -0,0 +1,20 @@ +# 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 new file mode 100644 index 00000000..e69de29b 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 new file mode 100644 index 00000000..e69de29b 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 new file mode 100644 index 00000000..ee5dfcca --- /dev/null +++ b/pynitrokey/nethsm/client/paths/config_tls_generate/post/request_body/content/application_json/schema.py @@ -0,0 +1,13 @@ +# 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 new file mode 100644 index 00000000..e69de29b 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 new file mode 100644 index 00000000..8e822e77 --- /dev/null +++ b/pynitrokey/nethsm/client/paths/config_tls_generate/post/responses/response_204/__init__.py @@ -0,0 +1,20 @@ +# coding: utf-8 + +""" + Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator +""" + +from pynitrokey.nethsm.client.shared_imports.response_imports import * # 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 new file mode 100644 index 00000000..0458793b --- /dev/null +++ b/pynitrokey/nethsm/client/paths/config_tls_generate/post/responses/response_400/__init__.py @@ -0,0 +1,20 @@ +# coding: utf-8 + +""" + Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator +""" + +from pynitrokey.nethsm.client.shared_imports.response_imports import * # 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 new file mode 100644 index 00000000..cee35061 --- /dev/null +++ b/pynitrokey/nethsm/client/paths/config_tls_generate/post/responses/response_401/__init__.py @@ -0,0 +1,20 @@ +# coding: utf-8 + +""" + Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator +""" + +from pynitrokey.nethsm.client.shared_imports.response_imports import * # 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 new file mode 100644 index 00000000..7bc0249d --- /dev/null +++ b/pynitrokey/nethsm/client/paths/config_tls_generate/post/responses/response_403/__init__.py @@ -0,0 +1,20 @@ +# coding: utf-8 + +""" + Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator +""" + +from pynitrokey.nethsm.client.shared_imports.response_imports import * # 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 new file mode 100644 index 00000000..088c436c --- /dev/null +++ b/pynitrokey/nethsm/client/paths/config_tls_generate/post/responses/response_406/__init__.py @@ -0,0 +1,20 @@ +# coding: utf-8 + +""" + Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator +""" + +from pynitrokey.nethsm.client.shared_imports.response_imports import * # 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 new file mode 100644 index 00000000..50b6212f --- /dev/null +++ b/pynitrokey/nethsm/client/paths/config_tls_generate/post/responses/response_412/__init__.py @@ -0,0 +1,20 @@ +# coding: utf-8 + +""" + Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator +""" + +from pynitrokey.nethsm.client.shared_imports.response_imports import * # 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 new file mode 100644 index 00000000..e69de29b 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 new file mode 100644 index 00000000..f3b60942 --- /dev/null +++ b/pynitrokey/nethsm/client/paths/config_tls_generate/post/security/security_requirement_object_0.py @@ -0,0 +1,11 @@ +# 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 index 6b8c0b23..ff36a9bf 100644 --- a/pynitrokey/nethsm/client/paths/config_tls_public_pem/__init__.py +++ b/pynitrokey/nethsm/client/paths/config_tls_public_pem/__init__.py @@ -1,7 +1,5 @@ # 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.paths.config_tls_public_pem import Api +# from pynitrokey.nethsm.client.apis.paths.config_tls_public_pem import ConfigTlsPublicPem -from pynitrokey.nethsm.client.paths import PathValues - -path = PathValues.CONFIG_TLS_PUBLIC_PEM \ No newline at end of file +path = "/config/tls/public.pem" \ No newline at end of file diff --git a/pynitrokey/nethsm/client/paths/config_tls_public_pem/get.py b/pynitrokey/nethsm/client/paths/config_tls_public_pem/get.py deleted file mode 100644 index 591b651f..00000000 --- a/pynitrokey/nethsm/client/paths/config_tls_public_pem/get.py +++ /dev/null @@ -1,275 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from pynitrokey.nethsm.client import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from pynitrokey.nethsm.client import schemas # noqa: F401 - -from . import path - -_auth = [ - 'basic', -] -SchemaFor200ResponseBodyApplicationXPemFile = schemas.StrSchema - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: typing.Union[ - SchemaFor200ResponseBodyApplicationXPemFile, - ] - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, - content={ - 'application/x-pem-file': api_client.MediaType( - schema=SchemaFor200ResponseBodyApplicationXPemFile), - }, -) - - -@dataclass -class ApiResponseFor401(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_401 = api_client.OpenApiResponse( - response_cls=ApiResponseFor401, -) - - -@dataclass -class ApiResponseFor403(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_403 = api_client.OpenApiResponse( - response_cls=ApiResponseFor403, -) - - -@dataclass -class ApiResponseFor412(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_412 = api_client.OpenApiResponse( - response_cls=ApiResponseFor412, -) -_status_code_to_response = { - '200': _response_for_200, - '401': _response_for_401, - '403': _response_for_403, - '412': _response_for_412, -} -_all_accept_content_types = ( - 'application/x-pem-file', -) - - -class BaseApi(api_client.Api): - @typing.overload - def _config_tls_public_pem_get_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _config_tls_public_pem_get_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _config_tls_public_pem_get_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _config_tls_public_pem_get_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :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.value - - _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) - - response = self.api_client.call_api( - resource_path=used_path, - method='get'.upper(), - headers=_headers, - auth_settings=_auth, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class ConfigTlsPublicPemGet(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def config_tls_public_pem_get( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def config_tls_public_pem_get( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def config_tls_public_pem_get( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def config_tls_public_pem_get( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._config_tls_public_pem_get_oapg( - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForget(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def get( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def get( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def get( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def get( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._config_tls_public_pem_get_oapg( - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/pynitrokey/nethsm/client/paths/config_tls_public_pem/get.pyi b/pynitrokey/nethsm/client/paths/config_tls_public_pem/get.pyi deleted file mode 100644 index ef0d95a4..00000000 --- a/pynitrokey/nethsm/client/paths/config_tls_public_pem/get.pyi +++ /dev/null @@ -1,264 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from pynitrokey.nethsm.client import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from pynitrokey.nethsm.client import schemas # noqa: F401 - -SchemaFor200ResponseBodyApplicationXPemFile = schemas.StrSchema - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: typing.Union[ - SchemaFor200ResponseBodyApplicationXPemFile, - ] - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, - content={ - 'application/x-pem-file': api_client.MediaType( - schema=SchemaFor200ResponseBodyApplicationXPemFile), - }, -) - - -@dataclass -class ApiResponseFor401(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_401 = api_client.OpenApiResponse( - response_cls=ApiResponseFor401, -) - - -@dataclass -class ApiResponseFor403(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_403 = api_client.OpenApiResponse( - response_cls=ApiResponseFor403, -) - - -@dataclass -class ApiResponseFor412(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_412 = api_client.OpenApiResponse( - response_cls=ApiResponseFor412, -) -_all_accept_content_types = ( - 'application/x-pem-file', -) - - -class BaseApi(api_client.Api): - @typing.overload - def _config_tls_public_pem_get_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _config_tls_public_pem_get_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _config_tls_public_pem_get_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _config_tls_public_pem_get_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :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.value - - _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) - - response = self.api_client.call_api( - resource_path=used_path, - method='get'.upper(), - headers=_headers, - auth_settings=_auth, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class ConfigTlsPublicPemGet(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def config_tls_public_pem_get( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def config_tls_public_pem_get( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def config_tls_public_pem_get( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def config_tls_public_pem_get( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._config_tls_public_pem_get_oapg( - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForget(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def get( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def get( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def get( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def get( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._config_tls_public_pem_get_oapg( - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - 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 new file mode 100644 index 00000000..e69de29b 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 new file mode 100644 index 00000000..1bd86592 --- /dev/null +++ b/pynitrokey/nethsm/client/paths/config_tls_public_pem/get/operation.py @@ -0,0 +1,164 @@ +# 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 new file mode 100644 index 00000000..e69de29b 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 new file mode 100644 index 00000000..9354e71e --- /dev/null +++ b/pynitrokey/nethsm/client/paths/config_tls_public_pem/get/responses/response_200/__init__.py @@ -0,0 +1,29 @@ +# coding: utf-8 + +""" + Generated 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 new file mode 100644 index 00000000..e69de29b 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 new file mode 100644 index 00000000..e69de29b 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 new file mode 100644 index 00000000..82e35dcd --- /dev/null +++ b/pynitrokey/nethsm/client/paths/config_tls_public_pem/get/responses/response_200/content/application_x_pem_file/schema.py @@ -0,0 +1,13 @@ +# 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 new file mode 100644 index 00000000..cee35061 --- /dev/null +++ b/pynitrokey/nethsm/client/paths/config_tls_public_pem/get/responses/response_401/__init__.py @@ -0,0 +1,20 @@ +# coding: utf-8 + +""" + Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator +""" + +from pynitrokey.nethsm.client.shared_imports.response_imports import * # 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 new file mode 100644 index 00000000..7bc0249d --- /dev/null +++ b/pynitrokey/nethsm/client/paths/config_tls_public_pem/get/responses/response_403/__init__.py @@ -0,0 +1,20 @@ +# coding: utf-8 + +""" + Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator +""" + +from pynitrokey.nethsm.client.shared_imports.response_imports import * # 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 new file mode 100644 index 00000000..088c436c --- /dev/null +++ b/pynitrokey/nethsm/client/paths/config_tls_public_pem/get/responses/response_406/__init__.py @@ -0,0 +1,20 @@ +# coding: utf-8 + +""" + Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator +""" + +from pynitrokey.nethsm.client.shared_imports.response_imports import * # 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 new file mode 100644 index 00000000..50b6212f --- /dev/null +++ b/pynitrokey/nethsm/client/paths/config_tls_public_pem/get/responses/response_412/__init__.py @@ -0,0 +1,20 @@ +# coding: utf-8 + +""" + Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator +""" + +from pynitrokey.nethsm.client.shared_imports.response_imports import * # 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 new file mode 100644 index 00000000..e69de29b 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 new file mode 100644 index 00000000..f3b60942 --- /dev/null +++ b/pynitrokey/nethsm/client/paths/config_tls_public_pem/get/security/security_requirement_object_0.py @@ -0,0 +1,11 @@ +# 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 index 0bde7d07..ef3a989a 100644 --- a/pynitrokey/nethsm/client/paths/config_unattended_boot/__init__.py +++ b/pynitrokey/nethsm/client/paths/config_unattended_boot/__init__.py @@ -1,7 +1,5 @@ # 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.paths.config_unattended_boot import Api +# from pynitrokey.nethsm.client.apis.paths.config_unattended_boot import ConfigUnattendedBoot -from pynitrokey.nethsm.client.paths import PathValues - -path = PathValues.CONFIG_UNATTENDEDBOOT \ No newline at end of file +path = "/config/unattended-boot" \ No newline at end of file diff --git a/pynitrokey/nethsm/client/paths/config_unattended_boot/get.py b/pynitrokey/nethsm/client/paths/config_unattended_boot/get.py deleted file mode 100644 index ef18bb2b..00000000 --- a/pynitrokey/nethsm/client/paths/config_unattended_boot/get.py +++ /dev/null @@ -1,277 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from pynitrokey.nethsm.client import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from pynitrokey.nethsm.client import schemas # noqa: F401 - -from pynitrokey.nethsm.client.model.unattended_boot_config import UnattendedBootConfig - -from . import path - -_auth = [ - 'basic', -] -SchemaFor200ResponseBodyApplicationJson = UnattendedBootConfig - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: typing.Union[ - SchemaFor200ResponseBodyApplicationJson, - ] - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, - content={ - 'application/json': api_client.MediaType( - schema=SchemaFor200ResponseBodyApplicationJson), - }, -) - - -@dataclass -class ApiResponseFor401(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_401 = api_client.OpenApiResponse( - response_cls=ApiResponseFor401, -) - - -@dataclass -class ApiResponseFor403(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_403 = api_client.OpenApiResponse( - response_cls=ApiResponseFor403, -) - - -@dataclass -class ApiResponseFor412(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_412 = api_client.OpenApiResponse( - response_cls=ApiResponseFor412, -) -_status_code_to_response = { - '200': _response_for_200, - '401': _response_for_401, - '403': _response_for_403, - '412': _response_for_412, -} -_all_accept_content_types = ( - 'application/json', -) - - -class BaseApi(api_client.Api): - @typing.overload - def _config_unattended_boot_get_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _config_unattended_boot_get_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _config_unattended_boot_get_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _config_unattended_boot_get_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :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.value - - _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) - - response = self.api_client.call_api( - resource_path=used_path, - method='get'.upper(), - headers=_headers, - auth_settings=_auth, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class ConfigUnattendedBootGet(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def config_unattended_boot_get( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def config_unattended_boot_get( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def config_unattended_boot_get( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def config_unattended_boot_get( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._config_unattended_boot_get_oapg( - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForget(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def get( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def get( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def get( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def get( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._config_unattended_boot_get_oapg( - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/pynitrokey/nethsm/client/paths/config_unattended_boot/get.pyi b/pynitrokey/nethsm/client/paths/config_unattended_boot/get.pyi deleted file mode 100644 index 3329412b..00000000 --- a/pynitrokey/nethsm/client/paths/config_unattended_boot/get.pyi +++ /dev/null @@ -1,266 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from pynitrokey.nethsm.client import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from pynitrokey.nethsm.client import schemas # noqa: F401 - -from pynitrokey.nethsm.client.model.unattended_boot_config import UnattendedBootConfig - -SchemaFor200ResponseBodyApplicationJson = UnattendedBootConfig - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: typing.Union[ - SchemaFor200ResponseBodyApplicationJson, - ] - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, - content={ - 'application/json': api_client.MediaType( - schema=SchemaFor200ResponseBodyApplicationJson), - }, -) - - -@dataclass -class ApiResponseFor401(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_401 = api_client.OpenApiResponse( - response_cls=ApiResponseFor401, -) - - -@dataclass -class ApiResponseFor403(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_403 = api_client.OpenApiResponse( - response_cls=ApiResponseFor403, -) - - -@dataclass -class ApiResponseFor412(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_412 = api_client.OpenApiResponse( - response_cls=ApiResponseFor412, -) -_all_accept_content_types = ( - 'application/json', -) - - -class BaseApi(api_client.Api): - @typing.overload - def _config_unattended_boot_get_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _config_unattended_boot_get_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _config_unattended_boot_get_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _config_unattended_boot_get_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :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.value - - _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) - - response = self.api_client.call_api( - resource_path=used_path, - method='get'.upper(), - headers=_headers, - auth_settings=_auth, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class ConfigUnattendedBootGet(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def config_unattended_boot_get( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def config_unattended_boot_get( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def config_unattended_boot_get( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def config_unattended_boot_get( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._config_unattended_boot_get_oapg( - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForget(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def get( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def get( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def get( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def get( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._config_unattended_boot_get_oapg( - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/pynitrokey/nethsm/client/paths/config_unattended_boot/get/__init__.py b/pynitrokey/nethsm/client/paths/config_unattended_boot/get/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/pynitrokey/nethsm/client/paths/config_unattended_boot/get/operation.py b/pynitrokey/nethsm/client/paths/config_unattended_boot/get/operation.py new file mode 100644 index 00000000..a902fd34 --- /dev/null +++ b/pynitrokey/nethsm/client/paths/config_unattended_boot/get/operation.py @@ -0,0 +1,164 @@ +# 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 new file mode 100644 index 00000000..e69de29b 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 new file mode 100644 index 00000000..e1abe789 --- /dev/null +++ b/pynitrokey/nethsm/client/paths/config_unattended_boot/get/responses/response_200/__init__.py @@ -0,0 +1,29 @@ +# coding: utf-8 + +""" + Generated 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 new file mode 100644 index 00000000..e69de29b 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 new file mode 100644 index 00000000..e69de29b 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 new file mode 100644 index 00000000..db31944e --- /dev/null +++ b/pynitrokey/nethsm/client/paths/config_unattended_boot/get/responses/response_200/content/application_json/schema.py @@ -0,0 +1,13 @@ +# 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 new file mode 100644 index 00000000..cee35061 --- /dev/null +++ b/pynitrokey/nethsm/client/paths/config_unattended_boot/get/responses/response_401/__init__.py @@ -0,0 +1,20 @@ +# coding: utf-8 + +""" + Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator +""" + +from pynitrokey.nethsm.client.shared_imports.response_imports import * # 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 new file mode 100644 index 00000000..7bc0249d --- /dev/null +++ b/pynitrokey/nethsm/client/paths/config_unattended_boot/get/responses/response_403/__init__.py @@ -0,0 +1,20 @@ +# coding: utf-8 + +""" + Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator +""" + +from pynitrokey.nethsm.client.shared_imports.response_imports import * # 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 new file mode 100644 index 00000000..088c436c --- /dev/null +++ b/pynitrokey/nethsm/client/paths/config_unattended_boot/get/responses/response_406/__init__.py @@ -0,0 +1,20 @@ +# coding: utf-8 + +""" + Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator +""" + +from pynitrokey.nethsm.client.shared_imports.response_imports import * # 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 new file mode 100644 index 00000000..50b6212f --- /dev/null +++ b/pynitrokey/nethsm/client/paths/config_unattended_boot/get/responses/response_412/__init__.py @@ -0,0 +1,20 @@ +# coding: utf-8 + +""" + Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator +""" + +from pynitrokey.nethsm.client.shared_imports.response_imports import * # 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 new file mode 100644 index 00000000..e69de29b 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 new file mode 100644 index 00000000..f3b60942 --- /dev/null +++ b/pynitrokey/nethsm/client/paths/config_unattended_boot/get/security/security_requirement_object_0.py @@ -0,0 +1,11 @@ +# 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.py b/pynitrokey/nethsm/client/paths/config_unattended_boot/put.py deleted file mode 100644 index 1a4d839e..00000000 --- a/pynitrokey/nethsm/client/paths/config_unattended_boot/put.py +++ /dev/null @@ -1,354 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from pynitrokey.nethsm.client import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from pynitrokey.nethsm.client import schemas # noqa: F401 - -from pynitrokey.nethsm.client.model.unattended_boot_config import UnattendedBootConfig - -from . import path - -# body param -SchemaForRequestBodyApplicationJson = UnattendedBootConfig - - -request_body_unattended_boot_config = api_client.RequestBody( - content={ - 'application/json': api_client.MediaType( - schema=SchemaForRequestBodyApplicationJson), - }, - required=True, -) -_auth = [ - 'basic', -] - - -@dataclass -class ApiResponseFor204(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_204 = api_client.OpenApiResponse( - response_cls=ApiResponseFor204, -) - - -@dataclass -class ApiResponseFor400(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_400 = api_client.OpenApiResponse( - response_cls=ApiResponseFor400, -) - - -@dataclass -class ApiResponseFor401(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_401 = api_client.OpenApiResponse( - response_cls=ApiResponseFor401, -) - - -@dataclass -class ApiResponseFor403(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_403 = api_client.OpenApiResponse( - response_cls=ApiResponseFor403, -) - - -@dataclass -class ApiResponseFor412(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_412 = api_client.OpenApiResponse( - response_cls=ApiResponseFor412, -) -_status_code_to_response = { - '204': _response_for_204, - '400': _response_for_400, - '401': _response_for_401, - '403': _response_for_403, - '412': _response_for_412, -} - - -class BaseApi(api_client.Api): - @typing.overload - def _config_unattended_boot_put_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor204, - ]: ... - - @typing.overload - def _config_unattended_boot_put_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor204, - ]: ... - - - @typing.overload - def _config_unattended_boot_put_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _config_unattended_boot_put_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor204, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _config_unattended_boot_put_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :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.value - - _headers = HTTPHeaderDict() - # TODO add cookie handling - - if body is schemas.unset: - raise exceptions.ApiValueError( - 'The required body parameter has an invalid value of: unset. Set a valid value instead') - _fields = None - _body = None - serialized_data = request_body_unattended_boot_config.serialize(body, content_type) - _headers.add('Content-Type', content_type) - if 'fields' in serialized_data: - _fields = serialized_data['fields'] - elif 'body' in serialized_data: - _body = serialized_data['body'] - response = self.api_client.call_api( - resource_path=used_path, - method='put'.upper(), - headers=_headers, - fields=_fields, - body=_body, - auth_settings=_auth, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class ConfigUnattendedBootPut(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def config_unattended_boot_put( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor204, - ]: ... - - @typing.overload - def config_unattended_boot_put( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor204, - ]: ... - - - @typing.overload - def config_unattended_boot_put( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def config_unattended_boot_put( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor204, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def config_unattended_boot_put( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._config_unattended_boot_put_oapg( - body=body, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForput(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def put( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor204, - ]: ... - - @typing.overload - def put( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor204, - ]: ... - - - @typing.overload - def put( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def put( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor204, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def put( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._config_unattended_boot_put_oapg( - body=body, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/pynitrokey/nethsm/client/paths/config_unattended_boot/put.pyi b/pynitrokey/nethsm/client/paths/config_unattended_boot/put.pyi deleted file mode 100644 index 494dfc17..00000000 --- a/pynitrokey/nethsm/client/paths/config_unattended_boot/put.pyi +++ /dev/null @@ -1,342 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from pynitrokey.nethsm.client import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from pynitrokey.nethsm.client import schemas # noqa: F401 - -from pynitrokey.nethsm.client.model.unattended_boot_config import UnattendedBootConfig - -# body param -SchemaForRequestBodyApplicationJson = UnattendedBootConfig - - -request_body_unattended_boot_config = api_client.RequestBody( - content={ - 'application/json': api_client.MediaType( - schema=SchemaForRequestBodyApplicationJson), - }, - required=True, -) - - -@dataclass -class ApiResponseFor204(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_204 = api_client.OpenApiResponse( - response_cls=ApiResponseFor204, -) - - -@dataclass -class ApiResponseFor400(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_400 = api_client.OpenApiResponse( - response_cls=ApiResponseFor400, -) - - -@dataclass -class ApiResponseFor401(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_401 = api_client.OpenApiResponse( - response_cls=ApiResponseFor401, -) - - -@dataclass -class ApiResponseFor403(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_403 = api_client.OpenApiResponse( - response_cls=ApiResponseFor403, -) - - -@dataclass -class ApiResponseFor412(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_412 = api_client.OpenApiResponse( - response_cls=ApiResponseFor412, -) - - -class BaseApi(api_client.Api): - @typing.overload - def _config_unattended_boot_put_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor204, - ]: ... - - @typing.overload - def _config_unattended_boot_put_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor204, - ]: ... - - - @typing.overload - def _config_unattended_boot_put_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _config_unattended_boot_put_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor204, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _config_unattended_boot_put_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :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.value - - _headers = HTTPHeaderDict() - # TODO add cookie handling - - if body is schemas.unset: - raise exceptions.ApiValueError( - 'The required body parameter has an invalid value of: unset. Set a valid value instead') - _fields = None - _body = None - serialized_data = request_body_unattended_boot_config.serialize(body, content_type) - _headers.add('Content-Type', content_type) - if 'fields' in serialized_data: - _fields = serialized_data['fields'] - elif 'body' in serialized_data: - _body = serialized_data['body'] - response = self.api_client.call_api( - resource_path=used_path, - method='put'.upper(), - headers=_headers, - fields=_fields, - body=_body, - auth_settings=_auth, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class ConfigUnattendedBootPut(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def config_unattended_boot_put( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor204, - ]: ... - - @typing.overload - def config_unattended_boot_put( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor204, - ]: ... - - - @typing.overload - def config_unattended_boot_put( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def config_unattended_boot_put( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor204, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def config_unattended_boot_put( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._config_unattended_boot_put_oapg( - body=body, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForput(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def put( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor204, - ]: ... - - @typing.overload - def put( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor204, - ]: ... - - - @typing.overload - def put( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def put( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor204, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def put( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._config_unattended_boot_put_oapg( - body=body, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/pynitrokey/nethsm/client/paths/config_unattended_boot/put/__init__.py b/pynitrokey/nethsm/client/paths/config_unattended_boot/put/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/pynitrokey/nethsm/client/paths/config_unattended_boot/put/operation.py b/pynitrokey/nethsm/client/paths/config_unattended_boot/put/operation.py new file mode 100644 index 00000000..9a2c47fe --- /dev/null +++ b/pynitrokey/nethsm/client/paths/config_unattended_boot/put/operation.py @@ -0,0 +1,188 @@ +# 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 new file mode 100644 index 00000000..ad29c4a8 --- /dev/null +++ b/pynitrokey/nethsm/client/paths/config_unattended_boot/put/request_body/__init__.py @@ -0,0 +1,20 @@ +# 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 new file mode 100644 index 00000000..e69de29b 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 new file mode 100644 index 00000000..e69de29b 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 new file mode 100644 index 00000000..db31944e --- /dev/null +++ b/pynitrokey/nethsm/client/paths/config_unattended_boot/put/request_body/content/application_json/schema.py @@ -0,0 +1,13 @@ +# 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 new file mode 100644 index 00000000..e69de29b 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 new file mode 100644 index 00000000..8e822e77 --- /dev/null +++ b/pynitrokey/nethsm/client/paths/config_unattended_boot/put/responses/response_204/__init__.py @@ -0,0 +1,20 @@ +# coding: utf-8 + +""" + Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator +""" + +from pynitrokey.nethsm.client.shared_imports.response_imports import * # 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 new file mode 100644 index 00000000..0458793b --- /dev/null +++ b/pynitrokey/nethsm/client/paths/config_unattended_boot/put/responses/response_400/__init__.py @@ -0,0 +1,20 @@ +# coding: utf-8 + +""" + Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator +""" + +from pynitrokey.nethsm.client.shared_imports.response_imports import * # 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 new file mode 100644 index 00000000..cee35061 --- /dev/null +++ b/pynitrokey/nethsm/client/paths/config_unattended_boot/put/responses/response_401/__init__.py @@ -0,0 +1,20 @@ +# coding: utf-8 + +""" + Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator +""" + +from pynitrokey.nethsm.client.shared_imports.response_imports import * # 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 new file mode 100644 index 00000000..7bc0249d --- /dev/null +++ b/pynitrokey/nethsm/client/paths/config_unattended_boot/put/responses/response_403/__init__.py @@ -0,0 +1,20 @@ +# coding: utf-8 + +""" + Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator +""" + +from pynitrokey.nethsm.client.shared_imports.response_imports import * # 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 new file mode 100644 index 00000000..088c436c --- /dev/null +++ b/pynitrokey/nethsm/client/paths/config_unattended_boot/put/responses/response_406/__init__.py @@ -0,0 +1,20 @@ +# coding: utf-8 + +""" + Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator +""" + +from pynitrokey.nethsm.client.shared_imports.response_imports import * # 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 new file mode 100644 index 00000000..50b6212f --- /dev/null +++ b/pynitrokey/nethsm/client/paths/config_unattended_boot/put/responses/response_412/__init__.py @@ -0,0 +1,20 @@ +# coding: utf-8 + +""" + Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator +""" + +from pynitrokey.nethsm.client.shared_imports.response_imports import * # 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 new file mode 100644 index 00000000..e69de29b 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 new file mode 100644 index 00000000..f3b60942 --- /dev/null +++ b/pynitrokey/nethsm/client/paths/config_unattended_boot/put/security/security_requirement_object_0.py @@ -0,0 +1,11 @@ +# 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 index c3f2203e..6269ca96 100644 --- a/pynitrokey/nethsm/client/paths/config_unlock_passphrase/__init__.py +++ b/pynitrokey/nethsm/client/paths/config_unlock_passphrase/__init__.py @@ -1,7 +1,5 @@ # 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.paths.config_unlock_passphrase import Api +# from pynitrokey.nethsm.client.apis.paths.config_unlock_passphrase import ConfigUnlockPassphrase -from pynitrokey.nethsm.client.paths import PathValues - -path = PathValues.CONFIG_UNLOCKPASSPHRASE \ No newline at end of file +path = "/config/unlock-passphrase" \ No newline at end of file diff --git a/pynitrokey/nethsm/client/paths/config_unlock_passphrase/put.py b/pynitrokey/nethsm/client/paths/config_unlock_passphrase/put.py deleted file mode 100644 index bb2a924c..00000000 --- a/pynitrokey/nethsm/client/paths/config_unlock_passphrase/put.py +++ /dev/null @@ -1,354 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from pynitrokey.nethsm.client import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from pynitrokey.nethsm.client import schemas # noqa: F401 - -from pynitrokey.nethsm.client.model.unlock_passphrase_config import UnlockPassphraseConfig - -from . import path - -# body param -SchemaForRequestBodyApplicationJson = UnlockPassphraseConfig - - -request_body_unlock_passphrase_config = api_client.RequestBody( - content={ - 'application/json': api_client.MediaType( - schema=SchemaForRequestBodyApplicationJson), - }, - required=True, -) -_auth = [ - 'basic', -] - - -@dataclass -class ApiResponseFor204(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_204 = api_client.OpenApiResponse( - response_cls=ApiResponseFor204, -) - - -@dataclass -class ApiResponseFor400(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_400 = api_client.OpenApiResponse( - response_cls=ApiResponseFor400, -) - - -@dataclass -class ApiResponseFor401(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_401 = api_client.OpenApiResponse( - response_cls=ApiResponseFor401, -) - - -@dataclass -class ApiResponseFor403(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_403 = api_client.OpenApiResponse( - response_cls=ApiResponseFor403, -) - - -@dataclass -class ApiResponseFor412(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_412 = api_client.OpenApiResponse( - response_cls=ApiResponseFor412, -) -_status_code_to_response = { - '204': _response_for_204, - '400': _response_for_400, - '401': _response_for_401, - '403': _response_for_403, - '412': _response_for_412, -} - - -class BaseApi(api_client.Api): - @typing.overload - def _config_unlock_passphrase_put_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor204, - ]: ... - - @typing.overload - def _config_unlock_passphrase_put_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor204, - ]: ... - - - @typing.overload - def _config_unlock_passphrase_put_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _config_unlock_passphrase_put_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor204, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _config_unlock_passphrase_put_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :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.value - - _headers = HTTPHeaderDict() - # TODO add cookie handling - - if body is schemas.unset: - raise exceptions.ApiValueError( - 'The required body parameter has an invalid value of: unset. Set a valid value instead') - _fields = None - _body = None - serialized_data = request_body_unlock_passphrase_config.serialize(body, content_type) - _headers.add('Content-Type', content_type) - if 'fields' in serialized_data: - _fields = serialized_data['fields'] - elif 'body' in serialized_data: - _body = serialized_data['body'] - response = self.api_client.call_api( - resource_path=used_path, - method='put'.upper(), - headers=_headers, - fields=_fields, - body=_body, - auth_settings=_auth, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class ConfigUnlockPassphrasePut(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def config_unlock_passphrase_put( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor204, - ]: ... - - @typing.overload - def config_unlock_passphrase_put( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor204, - ]: ... - - - @typing.overload - def config_unlock_passphrase_put( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def config_unlock_passphrase_put( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor204, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def config_unlock_passphrase_put( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._config_unlock_passphrase_put_oapg( - body=body, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForput(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def put( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor204, - ]: ... - - @typing.overload - def put( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor204, - ]: ... - - - @typing.overload - def put( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def put( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor204, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def put( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._config_unlock_passphrase_put_oapg( - body=body, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/pynitrokey/nethsm/client/paths/config_unlock_passphrase/put.pyi b/pynitrokey/nethsm/client/paths/config_unlock_passphrase/put.pyi deleted file mode 100644 index e7651e00..00000000 --- a/pynitrokey/nethsm/client/paths/config_unlock_passphrase/put.pyi +++ /dev/null @@ -1,342 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from pynitrokey.nethsm.client import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from pynitrokey.nethsm.client import schemas # noqa: F401 - -from pynitrokey.nethsm.client.model.unlock_passphrase_config import UnlockPassphraseConfig - -# body param -SchemaForRequestBodyApplicationJson = UnlockPassphraseConfig - - -request_body_unlock_passphrase_config = api_client.RequestBody( - content={ - 'application/json': api_client.MediaType( - schema=SchemaForRequestBodyApplicationJson), - }, - required=True, -) - - -@dataclass -class ApiResponseFor204(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_204 = api_client.OpenApiResponse( - response_cls=ApiResponseFor204, -) - - -@dataclass -class ApiResponseFor400(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_400 = api_client.OpenApiResponse( - response_cls=ApiResponseFor400, -) - - -@dataclass -class ApiResponseFor401(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_401 = api_client.OpenApiResponse( - response_cls=ApiResponseFor401, -) - - -@dataclass -class ApiResponseFor403(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_403 = api_client.OpenApiResponse( - response_cls=ApiResponseFor403, -) - - -@dataclass -class ApiResponseFor412(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_412 = api_client.OpenApiResponse( - response_cls=ApiResponseFor412, -) - - -class BaseApi(api_client.Api): - @typing.overload - def _config_unlock_passphrase_put_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor204, - ]: ... - - @typing.overload - def _config_unlock_passphrase_put_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor204, - ]: ... - - - @typing.overload - def _config_unlock_passphrase_put_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _config_unlock_passphrase_put_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor204, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _config_unlock_passphrase_put_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :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.value - - _headers = HTTPHeaderDict() - # TODO add cookie handling - - if body is schemas.unset: - raise exceptions.ApiValueError( - 'The required body parameter has an invalid value of: unset. Set a valid value instead') - _fields = None - _body = None - serialized_data = request_body_unlock_passphrase_config.serialize(body, content_type) - _headers.add('Content-Type', content_type) - if 'fields' in serialized_data: - _fields = serialized_data['fields'] - elif 'body' in serialized_data: - _body = serialized_data['body'] - response = self.api_client.call_api( - resource_path=used_path, - method='put'.upper(), - headers=_headers, - fields=_fields, - body=_body, - auth_settings=_auth, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class ConfigUnlockPassphrasePut(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def config_unlock_passphrase_put( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor204, - ]: ... - - @typing.overload - def config_unlock_passphrase_put( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor204, - ]: ... - - - @typing.overload - def config_unlock_passphrase_put( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def config_unlock_passphrase_put( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor204, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def config_unlock_passphrase_put( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._config_unlock_passphrase_put_oapg( - body=body, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForput(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def put( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor204, - ]: ... - - @typing.overload - def put( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor204, - ]: ... - - - @typing.overload - def put( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def put( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor204, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def put( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._config_unlock_passphrase_put_oapg( - body=body, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/pynitrokey/nethsm/client/paths/config_unlock_passphrase/put/__init__.py b/pynitrokey/nethsm/client/paths/config_unlock_passphrase/put/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/pynitrokey/nethsm/client/paths/config_unlock_passphrase/put/operation.py b/pynitrokey/nethsm/client/paths/config_unlock_passphrase/put/operation.py new file mode 100644 index 00000000..802bf589 --- /dev/null +++ b/pynitrokey/nethsm/client/paths/config_unlock_passphrase/put/operation.py @@ -0,0 +1,188 @@ +# 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 new file mode 100644 index 00000000..ad29c4a8 --- /dev/null +++ b/pynitrokey/nethsm/client/paths/config_unlock_passphrase/put/request_body/__init__.py @@ -0,0 +1,20 @@ +# 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 new file mode 100644 index 00000000..e69de29b 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 new file mode 100644 index 00000000..e69de29b 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 new file mode 100644 index 00000000..0d8ba277 --- /dev/null +++ b/pynitrokey/nethsm/client/paths/config_unlock_passphrase/put/request_body/content/application_json/schema.py @@ -0,0 +1,13 @@ +# 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 new file mode 100644 index 00000000..e69de29b 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 new file mode 100644 index 00000000..8e822e77 --- /dev/null +++ b/pynitrokey/nethsm/client/paths/config_unlock_passphrase/put/responses/response_204/__init__.py @@ -0,0 +1,20 @@ +# coding: utf-8 + +""" + Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator +""" + +from pynitrokey.nethsm.client.shared_imports.response_imports import * # 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 new file mode 100644 index 00000000..0458793b --- /dev/null +++ b/pynitrokey/nethsm/client/paths/config_unlock_passphrase/put/responses/response_400/__init__.py @@ -0,0 +1,20 @@ +# coding: utf-8 + +""" + Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator +""" + +from pynitrokey.nethsm.client.shared_imports.response_imports import * # 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 new file mode 100644 index 00000000..cee35061 --- /dev/null +++ b/pynitrokey/nethsm/client/paths/config_unlock_passphrase/put/responses/response_401/__init__.py @@ -0,0 +1,20 @@ +# coding: utf-8 + +""" + Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator +""" + +from pynitrokey.nethsm.client.shared_imports.response_imports import * # 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 new file mode 100644 index 00000000..7bc0249d --- /dev/null +++ b/pynitrokey/nethsm/client/paths/config_unlock_passphrase/put/responses/response_403/__init__.py @@ -0,0 +1,20 @@ +# coding: utf-8 + +""" + Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator +""" + +from pynitrokey.nethsm.client.shared_imports.response_imports import * # 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 new file mode 100644 index 00000000..088c436c --- /dev/null +++ b/pynitrokey/nethsm/client/paths/config_unlock_passphrase/put/responses/response_406/__init__.py @@ -0,0 +1,20 @@ +# coding: utf-8 + +""" + Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator +""" + +from pynitrokey.nethsm.client.shared_imports.response_imports import * # 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 new file mode 100644 index 00000000..50b6212f --- /dev/null +++ b/pynitrokey/nethsm/client/paths/config_unlock_passphrase/put/responses/response_412/__init__.py @@ -0,0 +1,20 @@ +# coding: utf-8 + +""" + Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator +""" + +from pynitrokey.nethsm.client.shared_imports.response_imports import * # 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 new file mode 100644 index 00000000..e69de29b 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 new file mode 100644 index 00000000..f3b60942 --- /dev/null +++ b/pynitrokey/nethsm/client/paths/config_unlock_passphrase/put/security/security_requirement_object_0.py @@ -0,0 +1,11 @@ +# 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 index 1374303b..ec7e97f5 100644 --- a/pynitrokey/nethsm/client/paths/health_alive/__init__.py +++ b/pynitrokey/nethsm/client/paths/health_alive/__init__.py @@ -1,7 +1,5 @@ # 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.paths.health_alive import Api +# from pynitrokey.nethsm.client.apis.paths.health_alive import HealthAlive -from pynitrokey.nethsm.client.paths import PathValues - -path = PathValues.HEALTH_ALIVE \ No newline at end of file +path = "/health/alive" \ No newline at end of file diff --git a/pynitrokey/nethsm/client/paths/health_alive/get.py b/pynitrokey/nethsm/client/paths/health_alive/get.py deleted file mode 100644 index 661b8554..00000000 --- a/pynitrokey/nethsm/client/paths/health_alive/get.py +++ /dev/null @@ -1,214 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 - -from pynitrokey.nethsm.client import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from pynitrokey.nethsm.client import schemas # noqa: F401 - -from . import path - - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, -) - - -@dataclass -class ApiResponseFor412(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_412 = api_client.OpenApiResponse( - response_cls=ApiResponseFor412, -) -_status_code_to_response = { - '200': _response_for_200, - '412': _response_for_412, -} - - -class BaseApi(api_client.Api): - @typing.overload - def _health_alive_get_oapg( - self, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _health_alive_get_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _health_alive_get_oapg( - self, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _health_alive_get_oapg( - self, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :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.value - # TODO add cookie handling - - response = self.api_client.call_api( - resource_path=used_path, - method='get'.upper(), - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class HealthAliveGet(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def health_alive_get( - self, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def health_alive_get( - self, - skip_deserialization: typing_extensions.Literal[True], - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def health_alive_get( - self, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def health_alive_get( - self, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._health_alive_get_oapg( - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForget(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def get( - self, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def get( - self, - skip_deserialization: typing_extensions.Literal[True], - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def get( - self, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def get( - self, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._health_alive_get_oapg( - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/pynitrokey/nethsm/client/paths/health_alive/get.pyi b/pynitrokey/nethsm/client/paths/health_alive/get.pyi deleted file mode 100644 index d25525a0..00000000 --- a/pynitrokey/nethsm/client/paths/health_alive/get.pyi +++ /dev/null @@ -1,208 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 - -from pynitrokey.nethsm.client import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from pynitrokey.nethsm.client import schemas # noqa: F401 - - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, -) - - -@dataclass -class ApiResponseFor412(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_412 = api_client.OpenApiResponse( - response_cls=ApiResponseFor412, -) - - -class BaseApi(api_client.Api): - @typing.overload - def _health_alive_get_oapg( - self, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _health_alive_get_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _health_alive_get_oapg( - self, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _health_alive_get_oapg( - self, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :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.value - # TODO add cookie handling - - response = self.api_client.call_api( - resource_path=used_path, - method='get'.upper(), - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class HealthAliveGet(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def health_alive_get( - self, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def health_alive_get( - self, - skip_deserialization: typing_extensions.Literal[True], - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def health_alive_get( - self, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def health_alive_get( - self, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._health_alive_get_oapg( - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForget(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def get( - self, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def get( - self, - skip_deserialization: typing_extensions.Literal[True], - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def get( - self, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def get( - self, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._health_alive_get_oapg( - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/pynitrokey/nethsm/client/paths/health_alive/get/__init__.py b/pynitrokey/nethsm/client/paths/health_alive/get/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/pynitrokey/nethsm/client/paths/health_alive/get/operation.py b/pynitrokey/nethsm/client/paths/health_alive/get/operation.py new file mode 100644 index 00000000..ed0cabd5 --- /dev/null +++ b/pynitrokey/nethsm/client/paths/health_alive/get/operation.py @@ -0,0 +1,131 @@ +# 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 new file mode 100644 index 00000000..e69de29b 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 new file mode 100644 index 00000000..fc4b07d0 --- /dev/null +++ b/pynitrokey/nethsm/client/paths/health_alive/get/responses/response_200/__init__.py @@ -0,0 +1,20 @@ +# coding: utf-8 + +""" + Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator +""" + +from pynitrokey.nethsm.client.shared_imports.response_imports import * # 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 new file mode 100644 index 00000000..088c436c --- /dev/null +++ b/pynitrokey/nethsm/client/paths/health_alive/get/responses/response_406/__init__.py @@ -0,0 +1,20 @@ +# coding: utf-8 + +""" + Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator +""" + +from pynitrokey.nethsm.client.shared_imports.response_imports import * # 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 new file mode 100644 index 00000000..50b6212f --- /dev/null +++ b/pynitrokey/nethsm/client/paths/health_alive/get/responses/response_412/__init__.py @@ -0,0 +1,20 @@ +# coding: utf-8 + +""" + Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator +""" + +from pynitrokey.nethsm.client.shared_imports.response_imports import * # 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 index 959f3ef8..203b1df0 100644 --- a/pynitrokey/nethsm/client/paths/health_ready/__init__.py +++ b/pynitrokey/nethsm/client/paths/health_ready/__init__.py @@ -1,7 +1,5 @@ # 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.paths.health_ready import Api +# from pynitrokey.nethsm.client.apis.paths.health_ready import HealthReady -from pynitrokey.nethsm.client.paths import PathValues - -path = PathValues.HEALTH_READY \ No newline at end of file +path = "/health/ready" \ No newline at end of file diff --git a/pynitrokey/nethsm/client/paths/health_ready/get.py b/pynitrokey/nethsm/client/paths/health_ready/get.py deleted file mode 100644 index 910ac530..00000000 --- a/pynitrokey/nethsm/client/paths/health_ready/get.py +++ /dev/null @@ -1,214 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 - -from pynitrokey.nethsm.client import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from pynitrokey.nethsm.client import schemas # noqa: F401 - -from . import path - - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, -) - - -@dataclass -class ApiResponseFor412(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_412 = api_client.OpenApiResponse( - response_cls=ApiResponseFor412, -) -_status_code_to_response = { - '200': _response_for_200, - '412': _response_for_412, -} - - -class BaseApi(api_client.Api): - @typing.overload - def _health_ready_get_oapg( - self, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _health_ready_get_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _health_ready_get_oapg( - self, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _health_ready_get_oapg( - self, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :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.value - # TODO add cookie handling - - response = self.api_client.call_api( - resource_path=used_path, - method='get'.upper(), - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class HealthReadyGet(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def health_ready_get( - self, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def health_ready_get( - self, - skip_deserialization: typing_extensions.Literal[True], - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def health_ready_get( - self, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def health_ready_get( - self, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._health_ready_get_oapg( - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForget(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def get( - self, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def get( - self, - skip_deserialization: typing_extensions.Literal[True], - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def get( - self, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def get( - self, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._health_ready_get_oapg( - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/pynitrokey/nethsm/client/paths/health_ready/get.pyi b/pynitrokey/nethsm/client/paths/health_ready/get.pyi deleted file mode 100644 index ca01fb6e..00000000 --- a/pynitrokey/nethsm/client/paths/health_ready/get.pyi +++ /dev/null @@ -1,208 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 - -from pynitrokey.nethsm.client import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from pynitrokey.nethsm.client import schemas # noqa: F401 - - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, -) - - -@dataclass -class ApiResponseFor412(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_412 = api_client.OpenApiResponse( - response_cls=ApiResponseFor412, -) - - -class BaseApi(api_client.Api): - @typing.overload - def _health_ready_get_oapg( - self, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _health_ready_get_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _health_ready_get_oapg( - self, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _health_ready_get_oapg( - self, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :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.value - # TODO add cookie handling - - response = self.api_client.call_api( - resource_path=used_path, - method='get'.upper(), - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class HealthReadyGet(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def health_ready_get( - self, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def health_ready_get( - self, - skip_deserialization: typing_extensions.Literal[True], - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def health_ready_get( - self, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def health_ready_get( - self, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._health_ready_get_oapg( - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForget(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def get( - self, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def get( - self, - skip_deserialization: typing_extensions.Literal[True], - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def get( - self, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def get( - self, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._health_ready_get_oapg( - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/pynitrokey/nethsm/client/paths/health_ready/get/__init__.py b/pynitrokey/nethsm/client/paths/health_ready/get/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/pynitrokey/nethsm/client/paths/health_ready/get/operation.py b/pynitrokey/nethsm/client/paths/health_ready/get/operation.py new file mode 100644 index 00000000..e4a32143 --- /dev/null +++ b/pynitrokey/nethsm/client/paths/health_ready/get/operation.py @@ -0,0 +1,131 @@ +# 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 new file mode 100644 index 00000000..e69de29b 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 new file mode 100644 index 00000000..fc4b07d0 --- /dev/null +++ b/pynitrokey/nethsm/client/paths/health_ready/get/responses/response_200/__init__.py @@ -0,0 +1,20 @@ +# coding: utf-8 + +""" + Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator +""" + +from pynitrokey.nethsm.client.shared_imports.response_imports import * # 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 new file mode 100644 index 00000000..088c436c --- /dev/null +++ b/pynitrokey/nethsm/client/paths/health_ready/get/responses/response_406/__init__.py @@ -0,0 +1,20 @@ +# coding: utf-8 + +""" + Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator +""" + +from pynitrokey.nethsm.client.shared_imports.response_imports import * # 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 new file mode 100644 index 00000000..50b6212f --- /dev/null +++ b/pynitrokey/nethsm/client/paths/health_ready/get/responses/response_412/__init__.py @@ -0,0 +1,20 @@ +# coding: utf-8 + +""" + Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator +""" + +from pynitrokey.nethsm.client.shared_imports.response_imports import * # 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 index d831645e..c3bab0d7 100644 --- a/pynitrokey/nethsm/client/paths/health_state/__init__.py +++ b/pynitrokey/nethsm/client/paths/health_state/__init__.py @@ -1,7 +1,5 @@ # 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.paths.health_state import Api +# from pynitrokey.nethsm.client.apis.paths.health_state import HealthState -from pynitrokey.nethsm.client.paths import PathValues - -path = PathValues.HEALTH_STATE \ No newline at end of file +path = "/health/state" \ No newline at end of file diff --git a/pynitrokey/nethsm/client/paths/health_state/get.py b/pynitrokey/nethsm/client/paths/health_state/get.py deleted file mode 100644 index b7080693..00000000 --- a/pynitrokey/nethsm/client/paths/health_state/get.py +++ /dev/null @@ -1,234 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from pynitrokey.nethsm.client import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from pynitrokey.nethsm.client import schemas # noqa: F401 - -from pynitrokey.nethsm.client.model.health_state_data import HealthStateData - -from . import path - -SchemaFor200ResponseBodyApplicationJson = HealthStateData - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: typing.Union[ - SchemaFor200ResponseBodyApplicationJson, - ] - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, - content={ - 'application/json': api_client.MediaType( - schema=SchemaFor200ResponseBodyApplicationJson), - }, -) -_status_code_to_response = { - '200': _response_for_200, -} -_all_accept_content_types = ( - 'application/json', -) - - -class BaseApi(api_client.Api): - @typing.overload - def _health_state_get_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _health_state_get_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _health_state_get_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _health_state_get_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :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.value - - _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) - - response = self.api_client.call_api( - resource_path=used_path, - method='get'.upper(), - headers=_headers, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class HealthStateGet(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def health_state_get( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def health_state_get( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def health_state_get( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def health_state_get( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._health_state_get_oapg( - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForget(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def get( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def get( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def get( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def get( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._health_state_get_oapg( - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/pynitrokey/nethsm/client/paths/health_state/get.pyi b/pynitrokey/nethsm/client/paths/health_state/get.pyi deleted file mode 100644 index b6ae5c61..00000000 --- a/pynitrokey/nethsm/client/paths/health_state/get.pyi +++ /dev/null @@ -1,229 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from pynitrokey.nethsm.client import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from pynitrokey.nethsm.client import schemas # noqa: F401 - -from pynitrokey.nethsm.client.model.health_state_data import HealthStateData - -SchemaFor200ResponseBodyApplicationJson = HealthStateData - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: typing.Union[ - SchemaFor200ResponseBodyApplicationJson, - ] - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, - content={ - 'application/json': api_client.MediaType( - schema=SchemaFor200ResponseBodyApplicationJson), - }, -) -_all_accept_content_types = ( - 'application/json', -) - - -class BaseApi(api_client.Api): - @typing.overload - def _health_state_get_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _health_state_get_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _health_state_get_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _health_state_get_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :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.value - - _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) - - response = self.api_client.call_api( - resource_path=used_path, - method='get'.upper(), - headers=_headers, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class HealthStateGet(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def health_state_get( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def health_state_get( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def health_state_get( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def health_state_get( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._health_state_get_oapg( - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForget(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def get( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def get( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def get( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def get( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._health_state_get_oapg( - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/pynitrokey/nethsm/client/paths/health_state/get/__init__.py b/pynitrokey/nethsm/client/paths/health_state/get/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/pynitrokey/nethsm/client/paths/health_state/get/operation.py b/pynitrokey/nethsm/client/paths/health_state/get/operation.py new file mode 100644 index 00000000..0323e662 --- /dev/null +++ b/pynitrokey/nethsm/client/paths/health_state/get/operation.py @@ -0,0 +1,135 @@ +# 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 new file mode 100644 index 00000000..e69de29b 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 new file mode 100644 index 00000000..02f53751 --- /dev/null +++ b/pynitrokey/nethsm/client/paths/health_state/get/responses/response_200/__init__.py @@ -0,0 +1,29 @@ +# coding: utf-8 + +""" + Generated 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 new file mode 100644 index 00000000..e69de29b 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 new file mode 100644 index 00000000..e69de29b 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 new file mode 100644 index 00000000..048a9d1a --- /dev/null +++ b/pynitrokey/nethsm/client/paths/health_state/get/responses/response_200/content/application_json/schema.py @@ -0,0 +1,13 @@ +# 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 new file mode 100644 index 00000000..088c436c --- /dev/null +++ b/pynitrokey/nethsm/client/paths/health_state/get/responses/response_406/__init__.py @@ -0,0 +1,20 @@ +# coding: utf-8 + +""" + Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator +""" + +from pynitrokey.nethsm.client.shared_imports.response_imports import * # 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 index e0c0459b..21e25480 100644 --- a/pynitrokey/nethsm/client/paths/info/__init__.py +++ b/pynitrokey/nethsm/client/paths/info/__init__.py @@ -1,7 +1,5 @@ # 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.paths.info import Api +# from pynitrokey.nethsm.client.apis.paths.info import Info -from pynitrokey.nethsm.client.paths import PathValues - -path = PathValues.INFO \ No newline at end of file +path = "/info" \ No newline at end of file diff --git a/pynitrokey/nethsm/client/paths/info/get.py b/pynitrokey/nethsm/client/paths/info/get.py deleted file mode 100644 index 3e838f1e..00000000 --- a/pynitrokey/nethsm/client/paths/info/get.py +++ /dev/null @@ -1,234 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from pynitrokey.nethsm.client import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from pynitrokey.nethsm.client import schemas # noqa: F401 - -from pynitrokey.nethsm.client.model.info_data import InfoData - -from . import path - -SchemaFor200ResponseBodyApplicationJson = InfoData - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: typing.Union[ - SchemaFor200ResponseBodyApplicationJson, - ] - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, - content={ - 'application/json': api_client.MediaType( - schema=SchemaFor200ResponseBodyApplicationJson), - }, -) -_status_code_to_response = { - '200': _response_for_200, -} -_all_accept_content_types = ( - 'application/json', -) - - -class BaseApi(api_client.Api): - @typing.overload - def _info_get_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _info_get_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _info_get_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _info_get_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :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.value - - _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) - - response = self.api_client.call_api( - resource_path=used_path, - method='get'.upper(), - headers=_headers, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class InfoGet(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def info_get( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def info_get( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def info_get( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def info_get( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._info_get_oapg( - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForget(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def get( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def get( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def get( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def get( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._info_get_oapg( - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/pynitrokey/nethsm/client/paths/info/get.pyi b/pynitrokey/nethsm/client/paths/info/get.pyi deleted file mode 100644 index 36ee2b8e..00000000 --- a/pynitrokey/nethsm/client/paths/info/get.pyi +++ /dev/null @@ -1,229 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from pynitrokey.nethsm.client import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from pynitrokey.nethsm.client import schemas # noqa: F401 - -from pynitrokey.nethsm.client.model.info_data import InfoData - -SchemaFor200ResponseBodyApplicationJson = InfoData - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: typing.Union[ - SchemaFor200ResponseBodyApplicationJson, - ] - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, - content={ - 'application/json': api_client.MediaType( - schema=SchemaFor200ResponseBodyApplicationJson), - }, -) -_all_accept_content_types = ( - 'application/json', -) - - -class BaseApi(api_client.Api): - @typing.overload - def _info_get_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _info_get_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _info_get_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _info_get_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :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.value - - _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) - - response = self.api_client.call_api( - resource_path=used_path, - method='get'.upper(), - headers=_headers, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class InfoGet(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def info_get( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def info_get( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def info_get( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def info_get( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._info_get_oapg( - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForget(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def get( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def get( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def get( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def get( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._info_get_oapg( - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/pynitrokey/nethsm/client/paths/info/get/__init__.py b/pynitrokey/nethsm/client/paths/info/get/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/pynitrokey/nethsm/client/paths/info/get/operation.py b/pynitrokey/nethsm/client/paths/info/get/operation.py new file mode 100644 index 00000000..96a9bf66 --- /dev/null +++ b/pynitrokey/nethsm/client/paths/info/get/operation.py @@ -0,0 +1,135 @@ +# 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 new file mode 100644 index 00000000..e69de29b 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 new file mode 100644 index 00000000..63d01f0b --- /dev/null +++ b/pynitrokey/nethsm/client/paths/info/get/responses/response_200/__init__.py @@ -0,0 +1,29 @@ +# coding: utf-8 + +""" + Generated 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 new file mode 100644 index 00000000..e69de29b 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 new file mode 100644 index 00000000..e69de29b 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 new file mode 100644 index 00000000..abd03b50 --- /dev/null +++ b/pynitrokey/nethsm/client/paths/info/get/responses/response_200/content/application_json/schema.py @@ -0,0 +1,13 @@ +# 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 new file mode 100644 index 00000000..088c436c --- /dev/null +++ b/pynitrokey/nethsm/client/paths/info/get/responses/response_406/__init__.py @@ -0,0 +1,20 @@ +# coding: utf-8 + +""" + Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator +""" + +from pynitrokey.nethsm.client.shared_imports.response_imports import * # 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 index a3908006..9df13430 100644 --- a/pynitrokey/nethsm/client/paths/keys/__init__.py +++ b/pynitrokey/nethsm/client/paths/keys/__init__.py @@ -1,7 +1,5 @@ # 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.paths.keys import Api +# from pynitrokey.nethsm.client.apis.paths.keys import Keys -from pynitrokey.nethsm.client.paths import PathValues - -path = PathValues.KEYS \ No newline at end of file +path = "/keys" \ No newline at end of file diff --git a/pynitrokey/nethsm/client/paths/keys/get.py b/pynitrokey/nethsm/client/paths/keys/get.py deleted file mode 100644 index 04aed66f..00000000 --- a/pynitrokey/nethsm/client/paths/keys/get.py +++ /dev/null @@ -1,331 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from pynitrokey.nethsm.client import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from pynitrokey.nethsm.client import schemas # noqa: F401 - -from pynitrokey.nethsm.client.model.key_list import KeyList - -from . import path - -# Query params -FilterSchema = schemas.StrSchema -RequestRequiredQueryParams = typing_extensions.TypedDict( - 'RequestRequiredQueryParams', - { - } -) -RequestOptionalQueryParams = typing_extensions.TypedDict( - 'RequestOptionalQueryParams', - { - 'filter': typing.Union[FilterSchema, str, ], - }, - total=False -) - - -class RequestQueryParams(RequestRequiredQueryParams, RequestOptionalQueryParams): - pass - - -request_query_filter = api_client.QueryParameter( - name="filter", - style=api_client.ParameterStyle.FORM, - schema=FilterSchema, - explode=True, -) -_auth = [ - 'basic', -] -SchemaFor200ResponseBodyApplicationJson = KeyList - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: typing.Union[ - SchemaFor200ResponseBodyApplicationJson, - ] - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, - content={ - 'application/json': api_client.MediaType( - schema=SchemaFor200ResponseBodyApplicationJson), - }, -) - - -@dataclass -class ApiResponseFor401(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_401 = api_client.OpenApiResponse( - response_cls=ApiResponseFor401, -) - - -@dataclass -class ApiResponseFor403(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_403 = api_client.OpenApiResponse( - response_cls=ApiResponseFor403, -) - - -@dataclass -class ApiResponseFor412(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_412 = api_client.OpenApiResponse( - response_cls=ApiResponseFor412, -) -_status_code_to_response = { - '200': _response_for_200, - '401': _response_for_401, - '403': _response_for_403, - '412': _response_for_412, -} -_all_accept_content_types = ( - 'application/json', -) - - -class BaseApi(api_client.Api): - @typing.overload - def _keys_get_oapg( - self, - query_params: RequestQueryParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _keys_get_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - query_params: RequestQueryParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _keys_get_oapg( - self, - query_params: RequestQueryParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _keys_get_oapg( - self, - query_params: RequestQueryParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :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 - """ - self._verify_typed_dict_inputs_oapg(RequestQueryParams, query_params) - used_path = path.value - - prefix_separator_iterator = None - for parameter in ( - request_query_filter, - ): - parameter_data = query_params.get(parameter.name, schemas.unset) - if parameter_data is schemas.unset: - continue - if prefix_separator_iterator is None: - prefix_separator_iterator = parameter.get_prefix_separator_iterator() - serialized_data = parameter.serialize(parameter_data, prefix_separator_iterator) - for serialized_value in serialized_data.values(): - used_path += serialized_value - - _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) - - response = self.api_client.call_api( - resource_path=used_path, - method='get'.upper(), - headers=_headers, - auth_settings=_auth, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class KeysGet(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def keys_get( - self, - query_params: RequestQueryParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def keys_get( - self, - skip_deserialization: typing_extensions.Literal[True], - query_params: RequestQueryParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def keys_get( - self, - query_params: RequestQueryParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def keys_get( - self, - query_params: RequestQueryParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._keys_get_oapg( - query_params=query_params, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForget(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def get( - self, - query_params: RequestQueryParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def get( - self, - skip_deserialization: typing_extensions.Literal[True], - query_params: RequestQueryParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def get( - self, - query_params: RequestQueryParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def get( - self, - query_params: RequestQueryParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._keys_get_oapg( - query_params=query_params, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/pynitrokey/nethsm/client/paths/keys/get.pyi b/pynitrokey/nethsm/client/paths/keys/get.pyi deleted file mode 100644 index 891a25be..00000000 --- a/pynitrokey/nethsm/client/paths/keys/get.pyi +++ /dev/null @@ -1,320 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from pynitrokey.nethsm.client import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from pynitrokey.nethsm.client import schemas # noqa: F401 - -from pynitrokey.nethsm.client.model.key_list import KeyList - -# Query params -FilterSchema = schemas.StrSchema -RequestRequiredQueryParams = typing_extensions.TypedDict( - 'RequestRequiredQueryParams', - { - } -) -RequestOptionalQueryParams = typing_extensions.TypedDict( - 'RequestOptionalQueryParams', - { - 'filter': typing.Union[FilterSchema, str, ], - }, - total=False -) - - -class RequestQueryParams(RequestRequiredQueryParams, RequestOptionalQueryParams): - pass - - -request_query_filter = api_client.QueryParameter( - name="filter", - style=api_client.ParameterStyle.FORM, - schema=FilterSchema, - explode=True, -) -SchemaFor200ResponseBodyApplicationJson = KeyList - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: typing.Union[ - SchemaFor200ResponseBodyApplicationJson, - ] - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, - content={ - 'application/json': api_client.MediaType( - schema=SchemaFor200ResponseBodyApplicationJson), - }, -) - - -@dataclass -class ApiResponseFor401(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_401 = api_client.OpenApiResponse( - response_cls=ApiResponseFor401, -) - - -@dataclass -class ApiResponseFor403(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_403 = api_client.OpenApiResponse( - response_cls=ApiResponseFor403, -) - - -@dataclass -class ApiResponseFor412(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_412 = api_client.OpenApiResponse( - response_cls=ApiResponseFor412, -) -_all_accept_content_types = ( - 'application/json', -) - - -class BaseApi(api_client.Api): - @typing.overload - def _keys_get_oapg( - self, - query_params: RequestQueryParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _keys_get_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - query_params: RequestQueryParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _keys_get_oapg( - self, - query_params: RequestQueryParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _keys_get_oapg( - self, - query_params: RequestQueryParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :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 - """ - self._verify_typed_dict_inputs_oapg(RequestQueryParams, query_params) - used_path = path.value - - prefix_separator_iterator = None - for parameter in ( - request_query_filter, - ): - parameter_data = query_params.get(parameter.name, schemas.unset) - if parameter_data is schemas.unset: - continue - if prefix_separator_iterator is None: - prefix_separator_iterator = parameter.get_prefix_separator_iterator() - serialized_data = parameter.serialize(parameter_data, prefix_separator_iterator) - for serialized_value in serialized_data.values(): - used_path += serialized_value - - _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) - - response = self.api_client.call_api( - resource_path=used_path, - method='get'.upper(), - headers=_headers, - auth_settings=_auth, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class KeysGet(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def keys_get( - self, - query_params: RequestQueryParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def keys_get( - self, - skip_deserialization: typing_extensions.Literal[True], - query_params: RequestQueryParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def keys_get( - self, - query_params: RequestQueryParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def keys_get( - self, - query_params: RequestQueryParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._keys_get_oapg( - query_params=query_params, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForget(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def get( - self, - query_params: RequestQueryParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def get( - self, - skip_deserialization: typing_extensions.Literal[True], - query_params: RequestQueryParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def get( - self, - query_params: RequestQueryParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def get( - self, - query_params: RequestQueryParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._keys_get_oapg( - query_params=query_params, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/pynitrokey/nethsm/client/paths/keys/get/__init__.py b/pynitrokey/nethsm/client/paths/keys/get/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/pynitrokey/nethsm/client/paths/keys/get/operation.py b/pynitrokey/nethsm/client/paths/keys/get/operation.py new file mode 100644 index 00000000..ad5ea4ed --- /dev/null +++ b/pynitrokey/nethsm/client/paths/keys/get/operation.py @@ -0,0 +1,192 @@ +# 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 new file mode 100644 index 00000000..e69de29b 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 new file mode 100644 index 00000000..e863149d --- /dev/null +++ b/pynitrokey/nethsm/client/paths/keys/get/parameters/parameter_0/__init__.py @@ -0,0 +1,16 @@ +# 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 new file mode 100644 index 00000000..951e9038 --- /dev/null +++ b/pynitrokey/nethsm/client/paths/keys/get/parameters/parameter_0/schema.py @@ -0,0 +1,13 @@ +# 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 new file mode 100644 index 00000000..0d209476 --- /dev/null +++ b/pynitrokey/nethsm/client/paths/keys/get/query_parameters.py @@ -0,0 +1,108 @@ +# 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 new file mode 100644 index 00000000..e69de29b 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 new file mode 100644 index 00000000..9c753110 --- /dev/null +++ b/pynitrokey/nethsm/client/paths/keys/get/responses/response_200/__init__.py @@ -0,0 +1,29 @@ +# coding: utf-8 + +""" + Generated 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 new file mode 100644 index 00000000..e69de29b 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 new file mode 100644 index 00000000..e69de29b 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 new file mode 100644 index 00000000..cc33ee29 --- /dev/null +++ b/pynitrokey/nethsm/client/paths/keys/get/responses/response_200/content/application_json/schema.py @@ -0,0 +1,13 @@ +# 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 new file mode 100644 index 00000000..cee35061 --- /dev/null +++ b/pynitrokey/nethsm/client/paths/keys/get/responses/response_401/__init__.py @@ -0,0 +1,20 @@ +# coding: utf-8 + +""" + Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator +""" + +from pynitrokey.nethsm.client.shared_imports.response_imports import * # 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 new file mode 100644 index 00000000..7bc0249d --- /dev/null +++ b/pynitrokey/nethsm/client/paths/keys/get/responses/response_403/__init__.py @@ -0,0 +1,20 @@ +# coding: utf-8 + +""" + Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator +""" + +from pynitrokey.nethsm.client.shared_imports.response_imports import * # 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 new file mode 100644 index 00000000..088c436c --- /dev/null +++ b/pynitrokey/nethsm/client/paths/keys/get/responses/response_406/__init__.py @@ -0,0 +1,20 @@ +# coding: utf-8 + +""" + Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator +""" + +from pynitrokey.nethsm.client.shared_imports.response_imports import * # 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 new file mode 100644 index 00000000..50b6212f --- /dev/null +++ b/pynitrokey/nethsm/client/paths/keys/get/responses/response_412/__init__.py @@ -0,0 +1,20 @@ +# coding: utf-8 + +""" + Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator +""" + +from pynitrokey.nethsm.client.shared_imports.response_imports import * # 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 new file mode 100644 index 00000000..e69de29b 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 new file mode 100644 index 00000000..f3b60942 --- /dev/null +++ b/pynitrokey/nethsm/client/paths/keys/get/security/security_requirement_object_0.py @@ -0,0 +1,11 @@ +# 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.py b/pynitrokey/nethsm/client/paths/keys/post.py deleted file mode 100644 index 94c12c74..00000000 --- a/pynitrokey/nethsm/client/paths/keys/post.py +++ /dev/null @@ -1,514 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from pynitrokey.nethsm.client import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from pynitrokey.nethsm.client import schemas # noqa: F401 - -from pynitrokey.nethsm.client.model.id import ID -from pynitrokey.nethsm.client.model.key_mechanism import KeyMechanism -from pynitrokey.nethsm.client.model.private_key import PrivateKey - -from . import path - -# Query params - - -class MechanismsSchema( - schemas.ListSchema -): - - - class MetaOapg: - - @staticmethod - def items() -> typing.Type['KeyMechanism']: - return KeyMechanism - - def __new__( - cls, - arg: typing.Union[typing.Tuple['KeyMechanism'], typing.List['KeyMechanism']], - _configuration: typing.Optional[schemas.Configuration] = None, - ) -> 'MechanismsSchema': - return super().__new__( - cls, - arg, - _configuration=_configuration, - ) - - def __getitem__(self, i: int) -> 'KeyMechanism': - return super().__getitem__(i) - - -class TagsSchema( - schemas.ListSchema -): - - - class MetaOapg: - - @staticmethod - def items() -> typing.Type['ID']: - return ID - - def __new__( - cls, - arg: typing.Union[typing.Tuple['ID'], typing.List['ID']], - _configuration: typing.Optional[schemas.Configuration] = None, - ) -> 'TagsSchema': - return super().__new__( - cls, - arg, - _configuration=_configuration, - ) - - def __getitem__(self, i: int) -> 'ID': - return super().__getitem__(i) -RequestRequiredQueryParams = typing_extensions.TypedDict( - 'RequestRequiredQueryParams', - { - } -) -RequestOptionalQueryParams = typing_extensions.TypedDict( - 'RequestOptionalQueryParams', - { - 'mechanisms': typing.Union[MechanismsSchema, list, tuple, ], - 'tags': typing.Union[TagsSchema, list, tuple, ], - }, - total=False -) - - -class RequestQueryParams(RequestRequiredQueryParams, RequestOptionalQueryParams): - pass - - -request_query_mechanisms = api_client.QueryParameter( - name="mechanisms", - style=api_client.ParameterStyle.FORM, - schema=MechanismsSchema, - explode=True, -) -request_query_tags = api_client.QueryParameter( - name="tags", - style=api_client.ParameterStyle.FORM, - schema=TagsSchema, - explode=True, -) -# body param -SchemaForRequestBodyApplicationXPemFile = schemas.StrSchema -SchemaForRequestBodyApplicationJson = PrivateKey - - -request_body_body = api_client.RequestBody( - content={ - 'application/x-pem-file': api_client.MediaType( - schema=SchemaForRequestBodyApplicationXPemFile), - 'application/json': api_client.MediaType( - schema=SchemaForRequestBodyApplicationJson), - }, - required=True, -) -_auth = [ - 'basic', -] - - -@dataclass -class ApiResponseFor201(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_201 = api_client.OpenApiResponse( - response_cls=ApiResponseFor201, -) - - -@dataclass -class ApiResponseFor400(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_400 = api_client.OpenApiResponse( - response_cls=ApiResponseFor400, -) - - -@dataclass -class ApiResponseFor401(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_401 = api_client.OpenApiResponse( - response_cls=ApiResponseFor401, -) - - -@dataclass -class ApiResponseFor403(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_403 = api_client.OpenApiResponse( - response_cls=ApiResponseFor403, -) - - -@dataclass -class ApiResponseFor412(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_412 = api_client.OpenApiResponse( - response_cls=ApiResponseFor412, -) -_status_code_to_response = { - '201': _response_for_201, - '400': _response_for_400, - '401': _response_for_401, - '403': _response_for_403, - '412': _response_for_412, -} - - -class BaseApi(api_client.Api): - @typing.overload - def _keys_post_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationXPemFile,str, ], - content_type: typing_extensions.Literal["application/x-pem-file"] = ..., - query_params: RequestQueryParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor201, - ]: ... - - @typing.overload - def _keys_post_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"], - query_params: RequestQueryParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor201, - ]: ... - - @typing.overload - def _keys_post_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationXPemFile,str, SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - query_params: RequestQueryParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor201, - ]: ... - - - @typing.overload - def _keys_post_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationXPemFile,str, SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - query_params: RequestQueryParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _keys_post_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationXPemFile,str, SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - query_params: RequestQueryParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor201, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _keys_post_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationXPemFile,str, SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/x-pem-file', - query_params: RequestQueryParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :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 - """ - self._verify_typed_dict_inputs_oapg(RequestQueryParams, query_params) - used_path = path.value - - prefix_separator_iterator = None - for parameter in ( - request_query_mechanisms, - request_query_tags, - ): - parameter_data = query_params.get(parameter.name, schemas.unset) - if parameter_data is schemas.unset: - continue - if prefix_separator_iterator is None: - prefix_separator_iterator = parameter.get_prefix_separator_iterator() - serialized_data = parameter.serialize(parameter_data, prefix_separator_iterator) - for serialized_value in serialized_data.values(): - used_path += serialized_value - - _headers = HTTPHeaderDict() - # TODO add cookie handling - - if body is schemas.unset: - raise exceptions.ApiValueError( - 'The required body parameter has an invalid value of: unset. Set a valid value instead') - _fields = None - _body = None - serialized_data = request_body_body.serialize(body, content_type) - _headers.add('Content-Type', content_type) - if 'fields' in serialized_data: - _fields = serialized_data['fields'] - elif 'body' in serialized_data: - _body = serialized_data['body'] - response = self.api_client.call_api( - resource_path=used_path, - method='post'.upper(), - headers=_headers, - fields=_fields, - body=_body, - auth_settings=_auth, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class KeysPost(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def keys_post( - self, - body: typing.Union[SchemaForRequestBodyApplicationXPemFile,str, ], - content_type: typing_extensions.Literal["application/x-pem-file"] = ..., - query_params: RequestQueryParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor201, - ]: ... - - @typing.overload - def keys_post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"], - query_params: RequestQueryParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor201, - ]: ... - - @typing.overload - def keys_post( - self, - body: typing.Union[SchemaForRequestBodyApplicationXPemFile,str, SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - query_params: RequestQueryParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor201, - ]: ... - - - @typing.overload - def keys_post( - self, - body: typing.Union[SchemaForRequestBodyApplicationXPemFile,str, SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - query_params: RequestQueryParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def keys_post( - self, - body: typing.Union[SchemaForRequestBodyApplicationXPemFile,str, SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - query_params: RequestQueryParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor201, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def keys_post( - self, - body: typing.Union[SchemaForRequestBodyApplicationXPemFile,str, SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/x-pem-file', - query_params: RequestQueryParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._keys_post_oapg( - body=body, - query_params=query_params, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForpost(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationXPemFile,str, ], - content_type: typing_extensions.Literal["application/x-pem-file"] = ..., - query_params: RequestQueryParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor201, - ]: ... - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"], - query_params: RequestQueryParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor201, - ]: ... - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationXPemFile,str, SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - query_params: RequestQueryParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor201, - ]: ... - - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationXPemFile,str, SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - query_params: RequestQueryParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationXPemFile,str, SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - query_params: RequestQueryParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor201, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationXPemFile,str, SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/x-pem-file', - query_params: RequestQueryParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._keys_post_oapg( - body=body, - query_params=query_params, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/pynitrokey/nethsm/client/paths/keys/post.pyi b/pynitrokey/nethsm/client/paths/keys/post.pyi deleted file mode 100644 index d2bfb7e2..00000000 --- a/pynitrokey/nethsm/client/paths/keys/post.pyi +++ /dev/null @@ -1,502 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from pynitrokey.nethsm.client import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from pynitrokey.nethsm.client import schemas # noqa: F401 - -from pynitrokey.nethsm.client.model.id import ID -from pynitrokey.nethsm.client.model.key_mechanism import KeyMechanism -from pynitrokey.nethsm.client.model.private_key import PrivateKey - -# Query params - - -class MechanismsSchema( - schemas.ListSchema -): - - - class MetaOapg: - - @staticmethod - def items() -> typing.Type['KeyMechanism']: - return KeyMechanism - - def __new__( - cls, - arg: typing.Union[typing.Tuple['KeyMechanism'], typing.List['KeyMechanism']], - _configuration: typing.Optional[schemas.Configuration] = None, - ) -> 'MechanismsSchema': - return super().__new__( - cls, - arg, - _configuration=_configuration, - ) - - def __getitem__(self, i: int) -> 'KeyMechanism': - return super().__getitem__(i) - - -class TagsSchema( - schemas.ListSchema -): - - - class MetaOapg: - - @staticmethod - def items() -> typing.Type['ID']: - return ID - - def __new__( - cls, - arg: typing.Union[typing.Tuple['ID'], typing.List['ID']], - _configuration: typing.Optional[schemas.Configuration] = None, - ) -> 'TagsSchema': - return super().__new__( - cls, - arg, - _configuration=_configuration, - ) - - def __getitem__(self, i: int) -> 'ID': - return super().__getitem__(i) -RequestRequiredQueryParams = typing_extensions.TypedDict( - 'RequestRequiredQueryParams', - { - } -) -RequestOptionalQueryParams = typing_extensions.TypedDict( - 'RequestOptionalQueryParams', - { - 'mechanisms': typing.Union[MechanismsSchema, list, tuple, ], - 'tags': typing.Union[TagsSchema, list, tuple, ], - }, - total=False -) - - -class RequestQueryParams(RequestRequiredQueryParams, RequestOptionalQueryParams): - pass - - -request_query_mechanisms = api_client.QueryParameter( - name="mechanisms", - style=api_client.ParameterStyle.FORM, - schema=MechanismsSchema, - explode=True, -) -request_query_tags = api_client.QueryParameter( - name="tags", - style=api_client.ParameterStyle.FORM, - schema=TagsSchema, - explode=True, -) -# body param -SchemaForRequestBodyApplicationXPemFile = schemas.StrSchema -SchemaForRequestBodyApplicationJson = PrivateKey - - -request_body_body = api_client.RequestBody( - content={ - 'application/x-pem-file': api_client.MediaType( - schema=SchemaForRequestBodyApplicationXPemFile), - 'application/json': api_client.MediaType( - schema=SchemaForRequestBodyApplicationJson), - }, - required=True, -) - - -@dataclass -class ApiResponseFor201(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_201 = api_client.OpenApiResponse( - response_cls=ApiResponseFor201, -) - - -@dataclass -class ApiResponseFor400(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_400 = api_client.OpenApiResponse( - response_cls=ApiResponseFor400, -) - - -@dataclass -class ApiResponseFor401(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_401 = api_client.OpenApiResponse( - response_cls=ApiResponseFor401, -) - - -@dataclass -class ApiResponseFor403(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_403 = api_client.OpenApiResponse( - response_cls=ApiResponseFor403, -) - - -@dataclass -class ApiResponseFor412(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_412 = api_client.OpenApiResponse( - response_cls=ApiResponseFor412, -) - - -class BaseApi(api_client.Api): - @typing.overload - def _keys_post_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationXPemFile,str, ], - content_type: typing_extensions.Literal["application/x-pem-file"] = ..., - query_params: RequestQueryParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor201, - ]: ... - - @typing.overload - def _keys_post_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"], - query_params: RequestQueryParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor201, - ]: ... - - @typing.overload - def _keys_post_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationXPemFile,str, SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - query_params: RequestQueryParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor201, - ]: ... - - - @typing.overload - def _keys_post_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationXPemFile,str, SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - query_params: RequestQueryParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _keys_post_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationXPemFile,str, SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - query_params: RequestQueryParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor201, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _keys_post_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationXPemFile,str, SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/x-pem-file', - query_params: RequestQueryParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :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 - """ - self._verify_typed_dict_inputs_oapg(RequestQueryParams, query_params) - used_path = path.value - - prefix_separator_iterator = None - for parameter in ( - request_query_mechanisms, - request_query_tags, - ): - parameter_data = query_params.get(parameter.name, schemas.unset) - if parameter_data is schemas.unset: - continue - if prefix_separator_iterator is None: - prefix_separator_iterator = parameter.get_prefix_separator_iterator() - serialized_data = parameter.serialize(parameter_data, prefix_separator_iterator) - for serialized_value in serialized_data.values(): - used_path += serialized_value - - _headers = HTTPHeaderDict() - # TODO add cookie handling - - if body is schemas.unset: - raise exceptions.ApiValueError( - 'The required body parameter has an invalid value of: unset. Set a valid value instead') - _fields = None - _body = None - serialized_data = request_body_body.serialize(body, content_type) - _headers.add('Content-Type', content_type) - if 'fields' in serialized_data: - _fields = serialized_data['fields'] - elif 'body' in serialized_data: - _body = serialized_data['body'] - response = self.api_client.call_api( - resource_path=used_path, - method='post'.upper(), - headers=_headers, - fields=_fields, - body=_body, - auth_settings=_auth, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class KeysPost(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def keys_post( - self, - body: typing.Union[SchemaForRequestBodyApplicationXPemFile,str, ], - content_type: typing_extensions.Literal["application/x-pem-file"] = ..., - query_params: RequestQueryParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor201, - ]: ... - - @typing.overload - def keys_post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"], - query_params: RequestQueryParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor201, - ]: ... - - @typing.overload - def keys_post( - self, - body: typing.Union[SchemaForRequestBodyApplicationXPemFile,str, SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - query_params: RequestQueryParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor201, - ]: ... - - - @typing.overload - def keys_post( - self, - body: typing.Union[SchemaForRequestBodyApplicationXPemFile,str, SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - query_params: RequestQueryParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def keys_post( - self, - body: typing.Union[SchemaForRequestBodyApplicationXPemFile,str, SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - query_params: RequestQueryParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor201, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def keys_post( - self, - body: typing.Union[SchemaForRequestBodyApplicationXPemFile,str, SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/x-pem-file', - query_params: RequestQueryParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._keys_post_oapg( - body=body, - query_params=query_params, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForpost(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationXPemFile,str, ], - content_type: typing_extensions.Literal["application/x-pem-file"] = ..., - query_params: RequestQueryParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor201, - ]: ... - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"], - query_params: RequestQueryParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor201, - ]: ... - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationXPemFile,str, SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - query_params: RequestQueryParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor201, - ]: ... - - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationXPemFile,str, SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - query_params: RequestQueryParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationXPemFile,str, SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - query_params: RequestQueryParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor201, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationXPemFile,str, SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/x-pem-file', - query_params: RequestQueryParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._keys_post_oapg( - body=body, - query_params=query_params, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/pynitrokey/nethsm/client/paths/keys/post/__init__.py b/pynitrokey/nethsm/client/paths/keys/post/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/pynitrokey/nethsm/client/paths/keys/post/operation.py b/pynitrokey/nethsm/client/paths/keys/post/operation.py new file mode 100644 index 00000000..66a0b2ad --- /dev/null +++ b/pynitrokey/nethsm/client/paths/keys/post/operation.py @@ -0,0 +1,263 @@ +# 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 new file mode 100644 index 00000000..e69de29b 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 new file mode 100644 index 00000000..ba13e66e --- /dev/null +++ b/pynitrokey/nethsm/client/paths/keys/post/parameters/parameter_0/__init__.py @@ -0,0 +1,16 @@ +# 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 new file mode 100644 index 00000000..90e13d89 --- /dev/null +++ b/pynitrokey/nethsm/client/paths/keys/post/parameters/parameter_0/schema.py @@ -0,0 +1,104 @@ +# 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 new file mode 100644 index 00000000..5280c5a3 --- /dev/null +++ b/pynitrokey/nethsm/client/paths/keys/post/parameters/parameter_1/__init__.py @@ -0,0 +1,16 @@ +# 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 new file mode 100644 index 00000000..215befe9 --- /dev/null +++ b/pynitrokey/nethsm/client/paths/keys/post/parameters/parameter_1/schema.py @@ -0,0 +1,64 @@ +# 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 new file mode 100644 index 00000000..78bb16c3 --- /dev/null +++ b/pynitrokey/nethsm/client/paths/keys/post/query_parameters.py @@ -0,0 +1,134 @@ +# 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 new file mode 100644 index 00000000..9fa09553 --- /dev/null +++ b/pynitrokey/nethsm/client/paths/keys/post/request_body/__init__.py @@ -0,0 +1,26 @@ +# 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 new file mode 100644 index 00000000..e69de29b 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 new file mode 100644 index 00000000..e69de29b 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 new file mode 100644 index 00000000..1e7efb0a --- /dev/null +++ b/pynitrokey/nethsm/client/paths/keys/post/request_body/content/application_json/schema.py @@ -0,0 +1,13 @@ +# 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 new file mode 100644 index 00000000..e69de29b 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 new file mode 100644 index 00000000..00854d77 --- /dev/null +++ b/pynitrokey/nethsm/client/paths/keys/post/request_body/content/application_x_pem_file/schema.py @@ -0,0 +1,13 @@ +# 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 new file mode 100644 index 00000000..e69de29b 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 new file mode 100644 index 00000000..18d9e496 --- /dev/null +++ b/pynitrokey/nethsm/client/paths/keys/post/responses/response_201/__init__.py @@ -0,0 +1,28 @@ +# coding: utf-8 + +""" + Generated 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 new file mode 100644 index 00000000..8d0c98c1 --- /dev/null +++ b/pynitrokey/nethsm/client/paths/keys/post/responses/response_201/header_parameters.py @@ -0,0 +1,108 @@ +# 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 new file mode 100644 index 00000000..e69de29b 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 new file mode 100644 index 00000000..46bc76aa --- /dev/null +++ b/pynitrokey/nethsm/client/paths/keys/post/responses/response_201/headers/header_location/__init__.py @@ -0,0 +1,14 @@ +# 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 new file mode 100644 index 00000000..951e9038 --- /dev/null +++ b/pynitrokey/nethsm/client/paths/keys/post/responses/response_201/headers/header_location/schema.py @@ -0,0 +1,13 @@ +# 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 new file mode 100644 index 00000000..0458793b --- /dev/null +++ b/pynitrokey/nethsm/client/paths/keys/post/responses/response_400/__init__.py @@ -0,0 +1,20 @@ +# coding: utf-8 + +""" + Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator +""" + +from pynitrokey.nethsm.client.shared_imports.response_imports import * # 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 new file mode 100644 index 00000000..cee35061 --- /dev/null +++ b/pynitrokey/nethsm/client/paths/keys/post/responses/response_401/__init__.py @@ -0,0 +1,20 @@ +# coding: utf-8 + +""" + Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator +""" + +from pynitrokey.nethsm.client.shared_imports.response_imports import * # 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 new file mode 100644 index 00000000..7bc0249d --- /dev/null +++ b/pynitrokey/nethsm/client/paths/keys/post/responses/response_403/__init__.py @@ -0,0 +1,20 @@ +# coding: utf-8 + +""" + Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator +""" + +from pynitrokey.nethsm.client.shared_imports.response_imports import * # 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 new file mode 100644 index 00000000..088c436c --- /dev/null +++ b/pynitrokey/nethsm/client/paths/keys/post/responses/response_406/__init__.py @@ -0,0 +1,20 @@ +# coding: utf-8 + +""" + Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator +""" + +from pynitrokey.nethsm.client.shared_imports.response_imports import * # 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 new file mode 100644 index 00000000..50b6212f --- /dev/null +++ b/pynitrokey/nethsm/client/paths/keys/post/responses/response_412/__init__.py @@ -0,0 +1,20 @@ +# coding: utf-8 + +""" + Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator +""" + +from pynitrokey.nethsm.client.shared_imports.response_imports import * # 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 new file mode 100644 index 00000000..e69de29b 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 new file mode 100644 index 00000000..f3b60942 --- /dev/null +++ b/pynitrokey/nethsm/client/paths/keys/post/security/security_requirement_object_0.py @@ -0,0 +1,11 @@ +# 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 index 78ecb1d8..b301713a 100644 --- a/pynitrokey/nethsm/client/paths/keys_generate/__init__.py +++ b/pynitrokey/nethsm/client/paths/keys_generate/__init__.py @@ -1,7 +1,5 @@ # 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.paths.keys_generate import Api +# from pynitrokey.nethsm.client.apis.paths.keys_generate import KeysGenerate -from pynitrokey.nethsm.client.paths import PathValues - -path = PathValues.KEYS_GENERATE \ No newline at end of file +path = "/keys/generate" \ No newline at end of file diff --git a/pynitrokey/nethsm/client/paths/keys_generate/post.py b/pynitrokey/nethsm/client/paths/keys_generate/post.py deleted file mode 100644 index fec74f8d..00000000 --- a/pynitrokey/nethsm/client/paths/keys_generate/post.py +++ /dev/null @@ -1,354 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from pynitrokey.nethsm.client import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from pynitrokey.nethsm.client import schemas # noqa: F401 - -from pynitrokey.nethsm.client.model.key_generate_request_data import KeyGenerateRequestData - -from . import path - -# body param -SchemaForRequestBodyApplicationJson = KeyGenerateRequestData - - -request_body_key_generate_request_data = api_client.RequestBody( - content={ - 'application/json': api_client.MediaType( - schema=SchemaForRequestBodyApplicationJson), - }, - required=True, -) -_auth = [ - 'basic', -] - - -@dataclass -class ApiResponseFor201(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_201 = api_client.OpenApiResponse( - response_cls=ApiResponseFor201, -) - - -@dataclass -class ApiResponseFor400(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_400 = api_client.OpenApiResponse( - response_cls=ApiResponseFor400, -) - - -@dataclass -class ApiResponseFor401(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_401 = api_client.OpenApiResponse( - response_cls=ApiResponseFor401, -) - - -@dataclass -class ApiResponseFor403(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_403 = api_client.OpenApiResponse( - response_cls=ApiResponseFor403, -) - - -@dataclass -class ApiResponseFor412(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_412 = api_client.OpenApiResponse( - response_cls=ApiResponseFor412, -) -_status_code_to_response = { - '201': _response_for_201, - '400': _response_for_400, - '401': _response_for_401, - '403': _response_for_403, - '412': _response_for_412, -} - - -class BaseApi(api_client.Api): - @typing.overload - def _keys_generate_post_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor201, - ]: ... - - @typing.overload - def _keys_generate_post_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor201, - ]: ... - - - @typing.overload - def _keys_generate_post_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _keys_generate_post_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor201, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _keys_generate_post_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :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.value - - _headers = HTTPHeaderDict() - # TODO add cookie handling - - if body is schemas.unset: - raise exceptions.ApiValueError( - 'The required body parameter has an invalid value of: unset. Set a valid value instead') - _fields = None - _body = None - serialized_data = request_body_key_generate_request_data.serialize(body, content_type) - _headers.add('Content-Type', content_type) - if 'fields' in serialized_data: - _fields = serialized_data['fields'] - elif 'body' in serialized_data: - _body = serialized_data['body'] - response = self.api_client.call_api( - resource_path=used_path, - method='post'.upper(), - headers=_headers, - fields=_fields, - body=_body, - auth_settings=_auth, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class KeysGeneratePost(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def keys_generate_post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor201, - ]: ... - - @typing.overload - def keys_generate_post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor201, - ]: ... - - - @typing.overload - def keys_generate_post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def keys_generate_post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor201, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def keys_generate_post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._keys_generate_post_oapg( - body=body, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForpost(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor201, - ]: ... - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor201, - ]: ... - - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor201, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._keys_generate_post_oapg( - body=body, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/pynitrokey/nethsm/client/paths/keys_generate/post.pyi b/pynitrokey/nethsm/client/paths/keys_generate/post.pyi deleted file mode 100644 index 771741d8..00000000 --- a/pynitrokey/nethsm/client/paths/keys_generate/post.pyi +++ /dev/null @@ -1,342 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from pynitrokey.nethsm.client import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from pynitrokey.nethsm.client import schemas # noqa: F401 - -from pynitrokey.nethsm.client.model.key_generate_request_data import KeyGenerateRequestData - -# body param -SchemaForRequestBodyApplicationJson = KeyGenerateRequestData - - -request_body_key_generate_request_data = api_client.RequestBody( - content={ - 'application/json': api_client.MediaType( - schema=SchemaForRequestBodyApplicationJson), - }, - required=True, -) - - -@dataclass -class ApiResponseFor201(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_201 = api_client.OpenApiResponse( - response_cls=ApiResponseFor201, -) - - -@dataclass -class ApiResponseFor400(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_400 = api_client.OpenApiResponse( - response_cls=ApiResponseFor400, -) - - -@dataclass -class ApiResponseFor401(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_401 = api_client.OpenApiResponse( - response_cls=ApiResponseFor401, -) - - -@dataclass -class ApiResponseFor403(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_403 = api_client.OpenApiResponse( - response_cls=ApiResponseFor403, -) - - -@dataclass -class ApiResponseFor412(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_412 = api_client.OpenApiResponse( - response_cls=ApiResponseFor412, -) - - -class BaseApi(api_client.Api): - @typing.overload - def _keys_generate_post_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor201, - ]: ... - - @typing.overload - def _keys_generate_post_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor201, - ]: ... - - - @typing.overload - def _keys_generate_post_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _keys_generate_post_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor201, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _keys_generate_post_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :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.value - - _headers = HTTPHeaderDict() - # TODO add cookie handling - - if body is schemas.unset: - raise exceptions.ApiValueError( - 'The required body parameter has an invalid value of: unset. Set a valid value instead') - _fields = None - _body = None - serialized_data = request_body_key_generate_request_data.serialize(body, content_type) - _headers.add('Content-Type', content_type) - if 'fields' in serialized_data: - _fields = serialized_data['fields'] - elif 'body' in serialized_data: - _body = serialized_data['body'] - response = self.api_client.call_api( - resource_path=used_path, - method='post'.upper(), - headers=_headers, - fields=_fields, - body=_body, - auth_settings=_auth, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class KeysGeneratePost(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def keys_generate_post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor201, - ]: ... - - @typing.overload - def keys_generate_post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor201, - ]: ... - - - @typing.overload - def keys_generate_post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def keys_generate_post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor201, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def keys_generate_post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._keys_generate_post_oapg( - body=body, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForpost(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor201, - ]: ... - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor201, - ]: ... - - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor201, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._keys_generate_post_oapg( - body=body, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/pynitrokey/nethsm/client/paths/keys_generate/post/__init__.py b/pynitrokey/nethsm/client/paths/keys_generate/post/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/pynitrokey/nethsm/client/paths/keys_generate/post/operation.py b/pynitrokey/nethsm/client/paths/keys_generate/post/operation.py new file mode 100644 index 00000000..8df778e4 --- /dev/null +++ b/pynitrokey/nethsm/client/paths/keys_generate/post/operation.py @@ -0,0 +1,188 @@ +# 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 new file mode 100644 index 00000000..ad29c4a8 --- /dev/null +++ b/pynitrokey/nethsm/client/paths/keys_generate/post/request_body/__init__.py @@ -0,0 +1,20 @@ +# 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 new file mode 100644 index 00000000..e69de29b 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 new file mode 100644 index 00000000..e69de29b 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 new file mode 100644 index 00000000..a7fcd449 --- /dev/null +++ b/pynitrokey/nethsm/client/paths/keys_generate/post/request_body/content/application_json/schema.py @@ -0,0 +1,13 @@ +# 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 new file mode 100644 index 00000000..e69de29b 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 new file mode 100644 index 00000000..18d9e496 --- /dev/null +++ b/pynitrokey/nethsm/client/paths/keys_generate/post/responses/response_201/__init__.py @@ -0,0 +1,28 @@ +# coding: utf-8 + +""" + Generated 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 new file mode 100644 index 00000000..aacfc2ab --- /dev/null +++ b/pynitrokey/nethsm/client/paths/keys_generate/post/responses/response_201/header_parameters.py @@ -0,0 +1,108 @@ +# 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 new file mode 100644 index 00000000..e69de29b 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 new file mode 100644 index 00000000..46bc76aa --- /dev/null +++ b/pynitrokey/nethsm/client/paths/keys_generate/post/responses/response_201/headers/header_location/__init__.py @@ -0,0 +1,14 @@ +# 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 new file mode 100644 index 00000000..951e9038 --- /dev/null +++ b/pynitrokey/nethsm/client/paths/keys_generate/post/responses/response_201/headers/header_location/schema.py @@ -0,0 +1,13 @@ +# 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 new file mode 100644 index 00000000..0458793b --- /dev/null +++ b/pynitrokey/nethsm/client/paths/keys_generate/post/responses/response_400/__init__.py @@ -0,0 +1,20 @@ +# coding: utf-8 + +""" + Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator +""" + +from pynitrokey.nethsm.client.shared_imports.response_imports import * # 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 new file mode 100644 index 00000000..cee35061 --- /dev/null +++ b/pynitrokey/nethsm/client/paths/keys_generate/post/responses/response_401/__init__.py @@ -0,0 +1,20 @@ +# coding: utf-8 + +""" + Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator +""" + +from pynitrokey.nethsm.client.shared_imports.response_imports import * # 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 new file mode 100644 index 00000000..7bc0249d --- /dev/null +++ b/pynitrokey/nethsm/client/paths/keys_generate/post/responses/response_403/__init__.py @@ -0,0 +1,20 @@ +# coding: utf-8 + +""" + Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator +""" + +from pynitrokey.nethsm.client.shared_imports.response_imports import * # 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 new file mode 100644 index 00000000..088c436c --- /dev/null +++ b/pynitrokey/nethsm/client/paths/keys_generate/post/responses/response_406/__init__.py @@ -0,0 +1,20 @@ +# coding: utf-8 + +""" + Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator +""" + +from pynitrokey.nethsm.client.shared_imports.response_imports import * # 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 new file mode 100644 index 00000000..50b6212f --- /dev/null +++ b/pynitrokey/nethsm/client/paths/keys_generate/post/responses/response_412/__init__.py @@ -0,0 +1,20 @@ +# coding: utf-8 + +""" + Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator +""" + +from pynitrokey.nethsm.client.shared_imports.response_imports import * # 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 new file mode 100644 index 00000000..e69de29b 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 new file mode 100644 index 00000000..f3b60942 --- /dev/null +++ b/pynitrokey/nethsm/client/paths/keys_generate/post/security/security_requirement_object_0.py @@ -0,0 +1,11 @@ +# 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 index db0bb81f..cda9fffd 100644 --- a/pynitrokey/nethsm/client/paths/keys_key_id/__init__.py +++ b/pynitrokey/nethsm/client/paths/keys_key_id/__init__.py @@ -1,7 +1,5 @@ # 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.paths.keys_key_id import Api +# from pynitrokey.nethsm.client.apis.paths.keys_key_id import KeysKeyID -from pynitrokey.nethsm.client.paths import PathValues - -path = PathValues.KEYS_KEY_ID \ No newline at end of file +path = "/keys/{KeyID}" \ No newline at end of file diff --git a/pynitrokey/nethsm/client/paths/keys_key_id/delete.py b/pynitrokey/nethsm/client/paths/keys_key_id/delete.py deleted file mode 100644 index e067b1d5..00000000 --- a/pynitrokey/nethsm/client/paths/keys_key_id/delete.py +++ /dev/null @@ -1,311 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 - -from pynitrokey.nethsm.client import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from pynitrokey.nethsm.client import schemas # noqa: F401 - -from . import path - -# Path params -KeyIDSchema = schemas.StrSchema -RequestRequiredPathParams = typing_extensions.TypedDict( - 'RequestRequiredPathParams', - { - 'KeyID': typing.Union[KeyIDSchema, str, ], - } -) -RequestOptionalPathParams = typing_extensions.TypedDict( - 'RequestOptionalPathParams', - { - }, - total=False -) - - -class RequestPathParams(RequestRequiredPathParams, RequestOptionalPathParams): - pass - - -request_path_key_id = api_client.PathParameter( - name="KeyID", - style=api_client.ParameterStyle.SIMPLE, - schema=KeyIDSchema, - required=True, -) -_auth = [ - 'basic', -] - - -@dataclass -class ApiResponseFor204(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_204 = api_client.OpenApiResponse( - response_cls=ApiResponseFor204, -) - - -@dataclass -class ApiResponseFor401(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_401 = api_client.OpenApiResponse( - response_cls=ApiResponseFor401, -) - - -@dataclass -class ApiResponseFor403(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_403 = api_client.OpenApiResponse( - response_cls=ApiResponseFor403, -) - - -@dataclass -class ApiResponseFor404(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_404 = api_client.OpenApiResponse( - response_cls=ApiResponseFor404, -) - - -@dataclass -class ApiResponseFor412(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_412 = api_client.OpenApiResponse( - response_cls=ApiResponseFor412, -) -_status_code_to_response = { - '204': _response_for_204, - '401': _response_for_401, - '403': _response_for_403, - '404': _response_for_404, - '412': _response_for_412, -} - - -class BaseApi(api_client.Api): - @typing.overload - def _keys_key_id_delete_oapg( - self, - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor204, - ]: ... - - @typing.overload - def _keys_key_id_delete_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _keys_key_id_delete_oapg( - self, - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor204, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _keys_key_id_delete_oapg( - self, - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :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 - """ - self._verify_typed_dict_inputs_oapg(RequestPathParams, path_params) - used_path = path.value - - _path_params = {} - for parameter in ( - request_path_key_id, - ): - parameter_data = path_params.get(parameter.name, schemas.unset) - if parameter_data is schemas.unset: - continue - serialized_data = parameter.serialize(parameter_data) - _path_params.update(serialized_data) - - for k, v in _path_params.items(): - used_path = used_path.replace('{%s}' % k, v) - # TODO add cookie handling - - response = self.api_client.call_api( - resource_path=used_path, - method='delete'.upper(), - auth_settings=_auth, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class KeysKeyIdDelete(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def keys_key_id_delete( - self, - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor204, - ]: ... - - @typing.overload - def keys_key_id_delete( - self, - skip_deserialization: typing_extensions.Literal[True], - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def keys_key_id_delete( - self, - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor204, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def keys_key_id_delete( - self, - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._keys_key_id_delete_oapg( - path_params=path_params, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiFordelete(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def delete( - self, - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor204, - ]: ... - - @typing.overload - def delete( - self, - skip_deserialization: typing_extensions.Literal[True], - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def delete( - self, - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor204, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def delete( - self, - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._keys_key_id_delete_oapg( - path_params=path_params, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/pynitrokey/nethsm/client/paths/keys_key_id/delete.pyi b/pynitrokey/nethsm/client/paths/keys_key_id/delete.pyi deleted file mode 100644 index 542b3a2b..00000000 --- a/pynitrokey/nethsm/client/paths/keys_key_id/delete.pyi +++ /dev/null @@ -1,299 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 - -from pynitrokey.nethsm.client import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from pynitrokey.nethsm.client import schemas # noqa: F401 - -# Path params -KeyIDSchema = schemas.StrSchema -RequestRequiredPathParams = typing_extensions.TypedDict( - 'RequestRequiredPathParams', - { - 'KeyID': typing.Union[KeyIDSchema, str, ], - } -) -RequestOptionalPathParams = typing_extensions.TypedDict( - 'RequestOptionalPathParams', - { - }, - total=False -) - - -class RequestPathParams(RequestRequiredPathParams, RequestOptionalPathParams): - pass - - -request_path_key_id = api_client.PathParameter( - name="KeyID", - style=api_client.ParameterStyle.SIMPLE, - schema=KeyIDSchema, - required=True, -) - - -@dataclass -class ApiResponseFor204(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_204 = api_client.OpenApiResponse( - response_cls=ApiResponseFor204, -) - - -@dataclass -class ApiResponseFor401(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_401 = api_client.OpenApiResponse( - response_cls=ApiResponseFor401, -) - - -@dataclass -class ApiResponseFor403(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_403 = api_client.OpenApiResponse( - response_cls=ApiResponseFor403, -) - - -@dataclass -class ApiResponseFor404(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_404 = api_client.OpenApiResponse( - response_cls=ApiResponseFor404, -) - - -@dataclass -class ApiResponseFor412(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_412 = api_client.OpenApiResponse( - response_cls=ApiResponseFor412, -) - - -class BaseApi(api_client.Api): - @typing.overload - def _keys_key_id_delete_oapg( - self, - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor204, - ]: ... - - @typing.overload - def _keys_key_id_delete_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _keys_key_id_delete_oapg( - self, - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor204, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _keys_key_id_delete_oapg( - self, - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :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 - """ - self._verify_typed_dict_inputs_oapg(RequestPathParams, path_params) - used_path = path.value - - _path_params = {} - for parameter in ( - request_path_key_id, - ): - parameter_data = path_params.get(parameter.name, schemas.unset) - if parameter_data is schemas.unset: - continue - serialized_data = parameter.serialize(parameter_data) - _path_params.update(serialized_data) - - for k, v in _path_params.items(): - used_path = used_path.replace('{%s}' % k, v) - # TODO add cookie handling - - response = self.api_client.call_api( - resource_path=used_path, - method='delete'.upper(), - auth_settings=_auth, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class KeysKeyIdDelete(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def keys_key_id_delete( - self, - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor204, - ]: ... - - @typing.overload - def keys_key_id_delete( - self, - skip_deserialization: typing_extensions.Literal[True], - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def keys_key_id_delete( - self, - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor204, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def keys_key_id_delete( - self, - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._keys_key_id_delete_oapg( - path_params=path_params, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiFordelete(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def delete( - self, - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor204, - ]: ... - - @typing.overload - def delete( - self, - skip_deserialization: typing_extensions.Literal[True], - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def delete( - self, - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor204, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def delete( - self, - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._keys_key_id_delete_oapg( - path_params=path_params, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/pynitrokey/nethsm/client/paths/keys_key_id/delete/__init__.py b/pynitrokey/nethsm/client/paths/keys_key_id/delete/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/pynitrokey/nethsm/client/paths/keys_key_id/delete/operation.py b/pynitrokey/nethsm/client/paths/keys_key_id/delete/operation.py new file mode 100644 index 00000000..44b913a7 --- /dev/null +++ b/pynitrokey/nethsm/client/paths/keys_key_id/delete/operation.py @@ -0,0 +1,183 @@ +# 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 new file mode 100644 index 00000000..e69de29b 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 new file mode 100644 index 00000000..29e0385b --- /dev/null +++ b/pynitrokey/nethsm/client/paths/keys_key_id/delete/parameters/parameter_0/__init__.py @@ -0,0 +1,16 @@ +# 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 new file mode 100644 index 00000000..951e9038 --- /dev/null +++ b/pynitrokey/nethsm/client/paths/keys_key_id/delete/parameters/parameter_0/schema.py @@ -0,0 +1,13 @@ +# 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 new file mode 100644 index 00000000..68e33102 --- /dev/null +++ b/pynitrokey/nethsm/client/paths/keys_key_id/delete/path_parameters.py @@ -0,0 +1,100 @@ +# 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 new file mode 100644 index 00000000..e69de29b 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 new file mode 100644 index 00000000..8e822e77 --- /dev/null +++ b/pynitrokey/nethsm/client/paths/keys_key_id/delete/responses/response_204/__init__.py @@ -0,0 +1,20 @@ +# coding: utf-8 + +""" + Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator +""" + +from pynitrokey.nethsm.client.shared_imports.response_imports import * # 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 new file mode 100644 index 00000000..cee35061 --- /dev/null +++ b/pynitrokey/nethsm/client/paths/keys_key_id/delete/responses/response_401/__init__.py @@ -0,0 +1,20 @@ +# coding: utf-8 + +""" + Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator +""" + +from pynitrokey.nethsm.client.shared_imports.response_imports import * # 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 new file mode 100644 index 00000000..7bc0249d --- /dev/null +++ b/pynitrokey/nethsm/client/paths/keys_key_id/delete/responses/response_403/__init__.py @@ -0,0 +1,20 @@ +# coding: utf-8 + +""" + Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator +""" + +from pynitrokey.nethsm.client.shared_imports.response_imports import * # 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 new file mode 100644 index 00000000..e43c74d8 --- /dev/null +++ b/pynitrokey/nethsm/client/paths/keys_key_id/delete/responses/response_404/__init__.py @@ -0,0 +1,20 @@ +# coding: utf-8 + +""" + Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator +""" + +from pynitrokey.nethsm.client.shared_imports.response_imports import * # 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 new file mode 100644 index 00000000..088c436c --- /dev/null +++ b/pynitrokey/nethsm/client/paths/keys_key_id/delete/responses/response_406/__init__.py @@ -0,0 +1,20 @@ +# coding: utf-8 + +""" + Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator +""" + +from pynitrokey.nethsm.client.shared_imports.response_imports import * # 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 new file mode 100644 index 00000000..50b6212f --- /dev/null +++ b/pynitrokey/nethsm/client/paths/keys_key_id/delete/responses/response_412/__init__.py @@ -0,0 +1,20 @@ +# coding: utf-8 + +""" + Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator +""" + +from pynitrokey.nethsm.client.shared_imports.response_imports import * # 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 new file mode 100644 index 00000000..e69de29b 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 new file mode 100644 index 00000000..f3b60942 --- /dev/null +++ b/pynitrokey/nethsm/client/paths/keys_key_id/delete/security/security_requirement_object_0.py @@ -0,0 +1,11 @@ +# 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.py b/pynitrokey/nethsm/client/paths/keys_key_id/get.py deleted file mode 100644 index a4b8404f..00000000 --- a/pynitrokey/nethsm/client/paths/keys_key_id/get.py +++ /dev/null @@ -1,344 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from pynitrokey.nethsm.client import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from pynitrokey.nethsm.client import schemas # noqa: F401 - -from pynitrokey.nethsm.client.model.public_key import PublicKey - -from . import path - -# Path params -KeyIDSchema = schemas.StrSchema -RequestRequiredPathParams = typing_extensions.TypedDict( - 'RequestRequiredPathParams', - { - 'KeyID': typing.Union[KeyIDSchema, str, ], - } -) -RequestOptionalPathParams = typing_extensions.TypedDict( - 'RequestOptionalPathParams', - { - }, - total=False -) - - -class RequestPathParams(RequestRequiredPathParams, RequestOptionalPathParams): - pass - - -request_path_key_id = api_client.PathParameter( - name="KeyID", - style=api_client.ParameterStyle.SIMPLE, - schema=KeyIDSchema, - required=True, -) -_auth = [ - 'basic', -] -SchemaFor200ResponseBodyApplicationJson = PublicKey - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: typing.Union[ - SchemaFor200ResponseBodyApplicationJson, - ] - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, - content={ - 'application/json': api_client.MediaType( - schema=SchemaFor200ResponseBodyApplicationJson), - }, -) - - -@dataclass -class ApiResponseFor401(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_401 = api_client.OpenApiResponse( - response_cls=ApiResponseFor401, -) - - -@dataclass -class ApiResponseFor403(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_403 = api_client.OpenApiResponse( - response_cls=ApiResponseFor403, -) - - -@dataclass -class ApiResponseFor404(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_404 = api_client.OpenApiResponse( - response_cls=ApiResponseFor404, -) - - -@dataclass -class ApiResponseFor412(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_412 = api_client.OpenApiResponse( - response_cls=ApiResponseFor412, -) -_status_code_to_response = { - '200': _response_for_200, - '401': _response_for_401, - '403': _response_for_403, - '404': _response_for_404, - '412': _response_for_412, -} -_all_accept_content_types = ( - 'application/json', -) - - -class BaseApi(api_client.Api): - @typing.overload - def _keys_key_id_get_oapg( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _keys_key_id_get_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _keys_key_id_get_oapg( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _keys_key_id_get_oapg( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :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 - """ - self._verify_typed_dict_inputs_oapg(RequestPathParams, path_params) - used_path = path.value - - _path_params = {} - for parameter in ( - request_path_key_id, - ): - parameter_data = path_params.get(parameter.name, schemas.unset) - if parameter_data is schemas.unset: - continue - serialized_data = parameter.serialize(parameter_data) - _path_params.update(serialized_data) - - for k, v in _path_params.items(): - used_path = used_path.replace('{%s}' % k, v) - - _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) - - response = self.api_client.call_api( - resource_path=used_path, - method='get'.upper(), - headers=_headers, - auth_settings=_auth, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class KeysKeyIdGet(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def keys_key_id_get( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def keys_key_id_get( - self, - skip_deserialization: typing_extensions.Literal[True], - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def keys_key_id_get( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def keys_key_id_get( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._keys_key_id_get_oapg( - path_params=path_params, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForget(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def get( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def get( - self, - skip_deserialization: typing_extensions.Literal[True], - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def get( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def get( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._keys_key_id_get_oapg( - path_params=path_params, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/pynitrokey/nethsm/client/paths/keys_key_id/get.pyi b/pynitrokey/nethsm/client/paths/keys_key_id/get.pyi deleted file mode 100644 index 010beaa6..00000000 --- a/pynitrokey/nethsm/client/paths/keys_key_id/get.pyi +++ /dev/null @@ -1,332 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from pynitrokey.nethsm.client import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from pynitrokey.nethsm.client import schemas # noqa: F401 - -from pynitrokey.nethsm.client.model.public_key import PublicKey - -# Path params -KeyIDSchema = schemas.StrSchema -RequestRequiredPathParams = typing_extensions.TypedDict( - 'RequestRequiredPathParams', - { - 'KeyID': typing.Union[KeyIDSchema, str, ], - } -) -RequestOptionalPathParams = typing_extensions.TypedDict( - 'RequestOptionalPathParams', - { - }, - total=False -) - - -class RequestPathParams(RequestRequiredPathParams, RequestOptionalPathParams): - pass - - -request_path_key_id = api_client.PathParameter( - name="KeyID", - style=api_client.ParameterStyle.SIMPLE, - schema=KeyIDSchema, - required=True, -) -SchemaFor200ResponseBodyApplicationJson = PublicKey - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: typing.Union[ - SchemaFor200ResponseBodyApplicationJson, - ] - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, - content={ - 'application/json': api_client.MediaType( - schema=SchemaFor200ResponseBodyApplicationJson), - }, -) - - -@dataclass -class ApiResponseFor401(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_401 = api_client.OpenApiResponse( - response_cls=ApiResponseFor401, -) - - -@dataclass -class ApiResponseFor403(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_403 = api_client.OpenApiResponse( - response_cls=ApiResponseFor403, -) - - -@dataclass -class ApiResponseFor404(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_404 = api_client.OpenApiResponse( - response_cls=ApiResponseFor404, -) - - -@dataclass -class ApiResponseFor412(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_412 = api_client.OpenApiResponse( - response_cls=ApiResponseFor412, -) -_all_accept_content_types = ( - 'application/json', -) - - -class BaseApi(api_client.Api): - @typing.overload - def _keys_key_id_get_oapg( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _keys_key_id_get_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _keys_key_id_get_oapg( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _keys_key_id_get_oapg( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :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 - """ - self._verify_typed_dict_inputs_oapg(RequestPathParams, path_params) - used_path = path.value - - _path_params = {} - for parameter in ( - request_path_key_id, - ): - parameter_data = path_params.get(parameter.name, schemas.unset) - if parameter_data is schemas.unset: - continue - serialized_data = parameter.serialize(parameter_data) - _path_params.update(serialized_data) - - for k, v in _path_params.items(): - used_path = used_path.replace('{%s}' % k, v) - - _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) - - response = self.api_client.call_api( - resource_path=used_path, - method='get'.upper(), - headers=_headers, - auth_settings=_auth, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class KeysKeyIdGet(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def keys_key_id_get( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def keys_key_id_get( - self, - skip_deserialization: typing_extensions.Literal[True], - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def keys_key_id_get( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def keys_key_id_get( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._keys_key_id_get_oapg( - path_params=path_params, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForget(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def get( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def get( - self, - skip_deserialization: typing_extensions.Literal[True], - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def get( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def get( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._keys_key_id_get_oapg( - path_params=path_params, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/pynitrokey/nethsm/client/paths/keys_key_id/get/__init__.py b/pynitrokey/nethsm/client/paths/keys_key_id/get/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/pynitrokey/nethsm/client/paths/keys_key_id/get/operation.py b/pynitrokey/nethsm/client/paths/keys_key_id/get/operation.py new file mode 100644 index 00000000..92e8203c --- /dev/null +++ b/pynitrokey/nethsm/client/paths/keys_key_id/get/operation.py @@ -0,0 +1,197 @@ +# 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 new file mode 100644 index 00000000..e69de29b 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 new file mode 100644 index 00000000..29e0385b --- /dev/null +++ b/pynitrokey/nethsm/client/paths/keys_key_id/get/parameters/parameter_0/__init__.py @@ -0,0 +1,16 @@ +# 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 new file mode 100644 index 00000000..951e9038 --- /dev/null +++ b/pynitrokey/nethsm/client/paths/keys_key_id/get/parameters/parameter_0/schema.py @@ -0,0 +1,13 @@ +# 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 new file mode 100644 index 00000000..70a2591e --- /dev/null +++ b/pynitrokey/nethsm/client/paths/keys_key_id/get/path_parameters.py @@ -0,0 +1,100 @@ +# 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 new file mode 100644 index 00000000..e69de29b 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 new file mode 100644 index 00000000..35f1ea17 --- /dev/null +++ b/pynitrokey/nethsm/client/paths/keys_key_id/get/responses/response_200/__init__.py @@ -0,0 +1,29 @@ +# coding: utf-8 + +""" + Generated 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 new file mode 100644 index 00000000..e69de29b 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 new file mode 100644 index 00000000..e69de29b 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 new file mode 100644 index 00000000..189217cd --- /dev/null +++ b/pynitrokey/nethsm/client/paths/keys_key_id/get/responses/response_200/content/application_json/schema.py @@ -0,0 +1,13 @@ +# 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 new file mode 100644 index 00000000..0458793b --- /dev/null +++ b/pynitrokey/nethsm/client/paths/keys_key_id/get/responses/response_400/__init__.py @@ -0,0 +1,20 @@ +# coding: utf-8 + +""" + Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator +""" + +from pynitrokey.nethsm.client.shared_imports.response_imports import * # 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 new file mode 100644 index 00000000..cee35061 --- /dev/null +++ b/pynitrokey/nethsm/client/paths/keys_key_id/get/responses/response_401/__init__.py @@ -0,0 +1,20 @@ +# coding: utf-8 + +""" + Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator +""" + +from pynitrokey.nethsm.client.shared_imports.response_imports import * # 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 new file mode 100644 index 00000000..7bc0249d --- /dev/null +++ b/pynitrokey/nethsm/client/paths/keys_key_id/get/responses/response_403/__init__.py @@ -0,0 +1,20 @@ +# coding: utf-8 + +""" + Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator +""" + +from pynitrokey.nethsm.client.shared_imports.response_imports import * # 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 new file mode 100644 index 00000000..e43c74d8 --- /dev/null +++ b/pynitrokey/nethsm/client/paths/keys_key_id/get/responses/response_404/__init__.py @@ -0,0 +1,20 @@ +# coding: utf-8 + +""" + Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator +""" + +from pynitrokey.nethsm.client.shared_imports.response_imports import * # 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 new file mode 100644 index 00000000..088c436c --- /dev/null +++ b/pynitrokey/nethsm/client/paths/keys_key_id/get/responses/response_406/__init__.py @@ -0,0 +1,20 @@ +# coding: utf-8 + +""" + Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator +""" + +from pynitrokey.nethsm.client.shared_imports.response_imports import * # 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 new file mode 100644 index 00000000..50b6212f --- /dev/null +++ b/pynitrokey/nethsm/client/paths/keys_key_id/get/responses/response_412/__init__.py @@ -0,0 +1,20 @@ +# coding: utf-8 + +""" + Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator +""" + +from pynitrokey.nethsm.client.shared_imports.response_imports import * # 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 new file mode 100644 index 00000000..e69de29b 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 new file mode 100644 index 00000000..f3b60942 --- /dev/null +++ b/pynitrokey/nethsm/client/paths/keys_key_id/get/security/security_requirement_object_0.py @@ -0,0 +1,11 @@ +# 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.py b/pynitrokey/nethsm/client/paths/keys_key_id/put.py deleted file mode 100644 index d846d2c0..00000000 --- a/pynitrokey/nethsm/client/paths/keys_key_id/put.py +++ /dev/null @@ -1,587 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from pynitrokey.nethsm.client import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from pynitrokey.nethsm.client import schemas # noqa: F401 - -from pynitrokey.nethsm.client.model.id import ID -from pynitrokey.nethsm.client.model.key_mechanism import KeyMechanism -from pynitrokey.nethsm.client.model.private_key import PrivateKey - -from . import path - -# Query params - - -class MechanismsSchema( - schemas.ListSchema -): - - - class MetaOapg: - - @staticmethod - def items() -> typing.Type['KeyMechanism']: - return KeyMechanism - - def __new__( - cls, - arg: typing.Union[typing.Tuple['KeyMechanism'], typing.List['KeyMechanism']], - _configuration: typing.Optional[schemas.Configuration] = None, - ) -> 'MechanismsSchema': - return super().__new__( - cls, - arg, - _configuration=_configuration, - ) - - def __getitem__(self, i: int) -> 'KeyMechanism': - return super().__getitem__(i) - - -class TagsSchema( - schemas.ListSchema -): - - - class MetaOapg: - - @staticmethod - def items() -> typing.Type['ID']: - return ID - - def __new__( - cls, - arg: typing.Union[typing.Tuple['ID'], typing.List['ID']], - _configuration: typing.Optional[schemas.Configuration] = None, - ) -> 'TagsSchema': - return super().__new__( - cls, - arg, - _configuration=_configuration, - ) - - def __getitem__(self, i: int) -> 'ID': - return super().__getitem__(i) -RequestRequiredQueryParams = typing_extensions.TypedDict( - 'RequestRequiredQueryParams', - { - } -) -RequestOptionalQueryParams = typing_extensions.TypedDict( - 'RequestOptionalQueryParams', - { - 'mechanisms': typing.Union[MechanismsSchema, list, tuple, ], - 'tags': typing.Union[TagsSchema, list, tuple, ], - }, - total=False -) - - -class RequestQueryParams(RequestRequiredQueryParams, RequestOptionalQueryParams): - pass - - -request_query_mechanisms = api_client.QueryParameter( - name="mechanisms", - style=api_client.ParameterStyle.FORM, - schema=MechanismsSchema, - explode=True, -) -request_query_tags = api_client.QueryParameter( - name="tags", - style=api_client.ParameterStyle.FORM, - schema=TagsSchema, - explode=True, -) -# Path params -KeyIDSchema = schemas.StrSchema -RequestRequiredPathParams = typing_extensions.TypedDict( - 'RequestRequiredPathParams', - { - 'KeyID': typing.Union[KeyIDSchema, str, ], - } -) -RequestOptionalPathParams = typing_extensions.TypedDict( - 'RequestOptionalPathParams', - { - }, - total=False -) - - -class RequestPathParams(RequestRequiredPathParams, RequestOptionalPathParams): - pass - - -request_path_key_id = api_client.PathParameter( - name="KeyID", - style=api_client.ParameterStyle.SIMPLE, - schema=KeyIDSchema, - required=True, -) -# body param -SchemaForRequestBodyApplicationXPemFile = schemas.StrSchema -SchemaForRequestBodyApplicationJson = PrivateKey - - -request_body_body = api_client.RequestBody( - content={ - 'application/x-pem-file': api_client.MediaType( - schema=SchemaForRequestBodyApplicationXPemFile), - 'application/json': api_client.MediaType( - schema=SchemaForRequestBodyApplicationJson), - }, - required=True, -) -_auth = [ - 'basic', -] - - -@dataclass -class ApiResponseFor204(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_204 = api_client.OpenApiResponse( - response_cls=ApiResponseFor204, -) - - -@dataclass -class ApiResponseFor400(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_400 = api_client.OpenApiResponse( - response_cls=ApiResponseFor400, -) - - -@dataclass -class ApiResponseFor401(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_401 = api_client.OpenApiResponse( - response_cls=ApiResponseFor401, -) - - -@dataclass -class ApiResponseFor403(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_403 = api_client.OpenApiResponse( - response_cls=ApiResponseFor403, -) - - -@dataclass -class ApiResponseFor409(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_409 = api_client.OpenApiResponse( - response_cls=ApiResponseFor409, -) - - -@dataclass -class ApiResponseFor412(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_412 = api_client.OpenApiResponse( - response_cls=ApiResponseFor412, -) -_status_code_to_response = { - '204': _response_for_204, - '400': _response_for_400, - '401': _response_for_401, - '403': _response_for_403, - '409': _response_for_409, - '412': _response_for_412, -} - - -class BaseApi(api_client.Api): - @typing.overload - def _keys_key_id_put_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationXPemFile,str, ], - content_type: typing_extensions.Literal["application/x-pem-file"] = ..., - query_params: RequestQueryParams = frozendict.frozendict(), - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor204, - ]: ... - - @typing.overload - def _keys_key_id_put_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"], - query_params: RequestQueryParams = frozendict.frozendict(), - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor204, - ]: ... - - @typing.overload - def _keys_key_id_put_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationXPemFile,str, SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - query_params: RequestQueryParams = frozendict.frozendict(), - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor204, - ]: ... - - - @typing.overload - def _keys_key_id_put_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationXPemFile,str, SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - query_params: RequestQueryParams = frozendict.frozendict(), - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _keys_key_id_put_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationXPemFile,str, SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - query_params: RequestQueryParams = frozendict.frozendict(), - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor204, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _keys_key_id_put_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationXPemFile,str, SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/x-pem-file', - query_params: RequestQueryParams = frozendict.frozendict(), - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :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 - """ - self._verify_typed_dict_inputs_oapg(RequestQueryParams, query_params) - self._verify_typed_dict_inputs_oapg(RequestPathParams, path_params) - used_path = path.value - - _path_params = {} - for parameter in ( - request_path_key_id, - ): - parameter_data = path_params.get(parameter.name, schemas.unset) - if parameter_data is schemas.unset: - continue - serialized_data = parameter.serialize(parameter_data) - _path_params.update(serialized_data) - - for k, v in _path_params.items(): - used_path = used_path.replace('{%s}' % k, v) - - prefix_separator_iterator = None - for parameter in ( - request_query_mechanisms, - request_query_tags, - ): - parameter_data = query_params.get(parameter.name, schemas.unset) - if parameter_data is schemas.unset: - continue - if prefix_separator_iterator is None: - prefix_separator_iterator = parameter.get_prefix_separator_iterator() - serialized_data = parameter.serialize(parameter_data, prefix_separator_iterator) - for serialized_value in serialized_data.values(): - used_path += serialized_value - - _headers = HTTPHeaderDict() - # TODO add cookie handling - - if body is schemas.unset: - raise exceptions.ApiValueError( - 'The required body parameter has an invalid value of: unset. Set a valid value instead') - _fields = None - _body = None - serialized_data = request_body_body.serialize(body, content_type) - _headers.add('Content-Type', content_type) - if 'fields' in serialized_data: - _fields = serialized_data['fields'] - elif 'body' in serialized_data: - _body = serialized_data['body'] - response = self.api_client.call_api( - resource_path=used_path, - method='put'.upper(), - headers=_headers, - fields=_fields, - body=_body, - auth_settings=_auth, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class KeysKeyIdPut(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def keys_key_id_put( - self, - body: typing.Union[SchemaForRequestBodyApplicationXPemFile,str, ], - content_type: typing_extensions.Literal["application/x-pem-file"] = ..., - query_params: RequestQueryParams = frozendict.frozendict(), - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor204, - ]: ... - - @typing.overload - def keys_key_id_put( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"], - query_params: RequestQueryParams = frozendict.frozendict(), - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor204, - ]: ... - - @typing.overload - def keys_key_id_put( - self, - body: typing.Union[SchemaForRequestBodyApplicationXPemFile,str, SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - query_params: RequestQueryParams = frozendict.frozendict(), - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor204, - ]: ... - - - @typing.overload - def keys_key_id_put( - self, - body: typing.Union[SchemaForRequestBodyApplicationXPemFile,str, SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - query_params: RequestQueryParams = frozendict.frozendict(), - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def keys_key_id_put( - self, - body: typing.Union[SchemaForRequestBodyApplicationXPemFile,str, SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - query_params: RequestQueryParams = frozendict.frozendict(), - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor204, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def keys_key_id_put( - self, - body: typing.Union[SchemaForRequestBodyApplicationXPemFile,str, SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/x-pem-file', - query_params: RequestQueryParams = frozendict.frozendict(), - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._keys_key_id_put_oapg( - body=body, - query_params=query_params, - path_params=path_params, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForput(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def put( - self, - body: typing.Union[SchemaForRequestBodyApplicationXPemFile,str, ], - content_type: typing_extensions.Literal["application/x-pem-file"] = ..., - query_params: RequestQueryParams = frozendict.frozendict(), - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor204, - ]: ... - - @typing.overload - def put( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"], - query_params: RequestQueryParams = frozendict.frozendict(), - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor204, - ]: ... - - @typing.overload - def put( - self, - body: typing.Union[SchemaForRequestBodyApplicationXPemFile,str, SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - query_params: RequestQueryParams = frozendict.frozendict(), - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor204, - ]: ... - - - @typing.overload - def put( - self, - body: typing.Union[SchemaForRequestBodyApplicationXPemFile,str, SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - query_params: RequestQueryParams = frozendict.frozendict(), - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def put( - self, - body: typing.Union[SchemaForRequestBodyApplicationXPemFile,str, SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - query_params: RequestQueryParams = frozendict.frozendict(), - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor204, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def put( - self, - body: typing.Union[SchemaForRequestBodyApplicationXPemFile,str, SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/x-pem-file', - query_params: RequestQueryParams = frozendict.frozendict(), - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._keys_key_id_put_oapg( - body=body, - query_params=query_params, - path_params=path_params, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/pynitrokey/nethsm/client/paths/keys_key_id/put.pyi b/pynitrokey/nethsm/client/paths/keys_key_id/put.pyi deleted file mode 100644 index bc5b0cd4..00000000 --- a/pynitrokey/nethsm/client/paths/keys_key_id/put.pyi +++ /dev/null @@ -1,574 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from pynitrokey.nethsm.client import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from pynitrokey.nethsm.client import schemas # noqa: F401 - -from pynitrokey.nethsm.client.model.id import ID -from pynitrokey.nethsm.client.model.key_mechanism import KeyMechanism -from pynitrokey.nethsm.client.model.private_key import PrivateKey - -# Query params - - -class MechanismsSchema( - schemas.ListSchema -): - - - class MetaOapg: - - @staticmethod - def items() -> typing.Type['KeyMechanism']: - return KeyMechanism - - def __new__( - cls, - arg: typing.Union[typing.Tuple['KeyMechanism'], typing.List['KeyMechanism']], - _configuration: typing.Optional[schemas.Configuration] = None, - ) -> 'MechanismsSchema': - return super().__new__( - cls, - arg, - _configuration=_configuration, - ) - - def __getitem__(self, i: int) -> 'KeyMechanism': - return super().__getitem__(i) - - -class TagsSchema( - schemas.ListSchema -): - - - class MetaOapg: - - @staticmethod - def items() -> typing.Type['ID']: - return ID - - def __new__( - cls, - arg: typing.Union[typing.Tuple['ID'], typing.List['ID']], - _configuration: typing.Optional[schemas.Configuration] = None, - ) -> 'TagsSchema': - return super().__new__( - cls, - arg, - _configuration=_configuration, - ) - - def __getitem__(self, i: int) -> 'ID': - return super().__getitem__(i) -RequestRequiredQueryParams = typing_extensions.TypedDict( - 'RequestRequiredQueryParams', - { - } -) -RequestOptionalQueryParams = typing_extensions.TypedDict( - 'RequestOptionalQueryParams', - { - 'mechanisms': typing.Union[MechanismsSchema, list, tuple, ], - 'tags': typing.Union[TagsSchema, list, tuple, ], - }, - total=False -) - - -class RequestQueryParams(RequestRequiredQueryParams, RequestOptionalQueryParams): - pass - - -request_query_mechanisms = api_client.QueryParameter( - name="mechanisms", - style=api_client.ParameterStyle.FORM, - schema=MechanismsSchema, - explode=True, -) -request_query_tags = api_client.QueryParameter( - name="tags", - style=api_client.ParameterStyle.FORM, - schema=TagsSchema, - explode=True, -) -# Path params -KeyIDSchema = schemas.StrSchema -RequestRequiredPathParams = typing_extensions.TypedDict( - 'RequestRequiredPathParams', - { - 'KeyID': typing.Union[KeyIDSchema, str, ], - } -) -RequestOptionalPathParams = typing_extensions.TypedDict( - 'RequestOptionalPathParams', - { - }, - total=False -) - - -class RequestPathParams(RequestRequiredPathParams, RequestOptionalPathParams): - pass - - -request_path_key_id = api_client.PathParameter( - name="KeyID", - style=api_client.ParameterStyle.SIMPLE, - schema=KeyIDSchema, - required=True, -) -# body param -SchemaForRequestBodyApplicationXPemFile = schemas.StrSchema -SchemaForRequestBodyApplicationJson = PrivateKey - - -request_body_body = api_client.RequestBody( - content={ - 'application/x-pem-file': api_client.MediaType( - schema=SchemaForRequestBodyApplicationXPemFile), - 'application/json': api_client.MediaType( - schema=SchemaForRequestBodyApplicationJson), - }, - required=True, -) - - -@dataclass -class ApiResponseFor204(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_204 = api_client.OpenApiResponse( - response_cls=ApiResponseFor204, -) - - -@dataclass -class ApiResponseFor400(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_400 = api_client.OpenApiResponse( - response_cls=ApiResponseFor400, -) - - -@dataclass -class ApiResponseFor401(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_401 = api_client.OpenApiResponse( - response_cls=ApiResponseFor401, -) - - -@dataclass -class ApiResponseFor403(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_403 = api_client.OpenApiResponse( - response_cls=ApiResponseFor403, -) - - -@dataclass -class ApiResponseFor409(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_409 = api_client.OpenApiResponse( - response_cls=ApiResponseFor409, -) - - -@dataclass -class ApiResponseFor412(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_412 = api_client.OpenApiResponse( - response_cls=ApiResponseFor412, -) - - -class BaseApi(api_client.Api): - @typing.overload - def _keys_key_id_put_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationXPemFile,str, ], - content_type: typing_extensions.Literal["application/x-pem-file"] = ..., - query_params: RequestQueryParams = frozendict.frozendict(), - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor204, - ]: ... - - @typing.overload - def _keys_key_id_put_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"], - query_params: RequestQueryParams = frozendict.frozendict(), - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor204, - ]: ... - - @typing.overload - def _keys_key_id_put_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationXPemFile,str, SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - query_params: RequestQueryParams = frozendict.frozendict(), - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor204, - ]: ... - - - @typing.overload - def _keys_key_id_put_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationXPemFile,str, SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - query_params: RequestQueryParams = frozendict.frozendict(), - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _keys_key_id_put_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationXPemFile,str, SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - query_params: RequestQueryParams = frozendict.frozendict(), - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor204, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _keys_key_id_put_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationXPemFile,str, SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/x-pem-file', - query_params: RequestQueryParams = frozendict.frozendict(), - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :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 - """ - self._verify_typed_dict_inputs_oapg(RequestQueryParams, query_params) - self._verify_typed_dict_inputs_oapg(RequestPathParams, path_params) - used_path = path.value - - _path_params = {} - for parameter in ( - request_path_key_id, - ): - parameter_data = path_params.get(parameter.name, schemas.unset) - if parameter_data is schemas.unset: - continue - serialized_data = parameter.serialize(parameter_data) - _path_params.update(serialized_data) - - for k, v in _path_params.items(): - used_path = used_path.replace('{%s}' % k, v) - - prefix_separator_iterator = None - for parameter in ( - request_query_mechanisms, - request_query_tags, - ): - parameter_data = query_params.get(parameter.name, schemas.unset) - if parameter_data is schemas.unset: - continue - if prefix_separator_iterator is None: - prefix_separator_iterator = parameter.get_prefix_separator_iterator() - serialized_data = parameter.serialize(parameter_data, prefix_separator_iterator) - for serialized_value in serialized_data.values(): - used_path += serialized_value - - _headers = HTTPHeaderDict() - # TODO add cookie handling - - if body is schemas.unset: - raise exceptions.ApiValueError( - 'The required body parameter has an invalid value of: unset. Set a valid value instead') - _fields = None - _body = None - serialized_data = request_body_body.serialize(body, content_type) - _headers.add('Content-Type', content_type) - if 'fields' in serialized_data: - _fields = serialized_data['fields'] - elif 'body' in serialized_data: - _body = serialized_data['body'] - response = self.api_client.call_api( - resource_path=used_path, - method='put'.upper(), - headers=_headers, - fields=_fields, - body=_body, - auth_settings=_auth, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class KeysKeyIdPut(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def keys_key_id_put( - self, - body: typing.Union[SchemaForRequestBodyApplicationXPemFile,str, ], - content_type: typing_extensions.Literal["application/x-pem-file"] = ..., - query_params: RequestQueryParams = frozendict.frozendict(), - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor204, - ]: ... - - @typing.overload - def keys_key_id_put( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"], - query_params: RequestQueryParams = frozendict.frozendict(), - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor204, - ]: ... - - @typing.overload - def keys_key_id_put( - self, - body: typing.Union[SchemaForRequestBodyApplicationXPemFile,str, SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - query_params: RequestQueryParams = frozendict.frozendict(), - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor204, - ]: ... - - - @typing.overload - def keys_key_id_put( - self, - body: typing.Union[SchemaForRequestBodyApplicationXPemFile,str, SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - query_params: RequestQueryParams = frozendict.frozendict(), - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def keys_key_id_put( - self, - body: typing.Union[SchemaForRequestBodyApplicationXPemFile,str, SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - query_params: RequestQueryParams = frozendict.frozendict(), - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor204, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def keys_key_id_put( - self, - body: typing.Union[SchemaForRequestBodyApplicationXPemFile,str, SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/x-pem-file', - query_params: RequestQueryParams = frozendict.frozendict(), - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._keys_key_id_put_oapg( - body=body, - query_params=query_params, - path_params=path_params, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForput(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def put( - self, - body: typing.Union[SchemaForRequestBodyApplicationXPemFile,str, ], - content_type: typing_extensions.Literal["application/x-pem-file"] = ..., - query_params: RequestQueryParams = frozendict.frozendict(), - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor204, - ]: ... - - @typing.overload - def put( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"], - query_params: RequestQueryParams = frozendict.frozendict(), - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor204, - ]: ... - - @typing.overload - def put( - self, - body: typing.Union[SchemaForRequestBodyApplicationXPemFile,str, SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - query_params: RequestQueryParams = frozendict.frozendict(), - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor204, - ]: ... - - - @typing.overload - def put( - self, - body: typing.Union[SchemaForRequestBodyApplicationXPemFile,str, SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - query_params: RequestQueryParams = frozendict.frozendict(), - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def put( - self, - body: typing.Union[SchemaForRequestBodyApplicationXPemFile,str, SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - query_params: RequestQueryParams = frozendict.frozendict(), - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor204, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def put( - self, - body: typing.Union[SchemaForRequestBodyApplicationXPemFile,str, SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/x-pem-file', - query_params: RequestQueryParams = frozendict.frozendict(), - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._keys_key_id_put_oapg( - body=body, - query_params=query_params, - path_params=path_params, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/pynitrokey/nethsm/client/paths/keys_key_id/put/__init__.py b/pynitrokey/nethsm/client/paths/keys_key_id/put/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/pynitrokey/nethsm/client/paths/keys_key_id/put/operation.py b/pynitrokey/nethsm/client/paths/keys_key_id/put/operation.py new file mode 100644 index 00000000..f25e2643 --- /dev/null +++ b/pynitrokey/nethsm/client/paths/keys_key_id/put/operation.py @@ -0,0 +1,296 @@ +# 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 new file mode 100644 index 00000000..e69de29b 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 new file mode 100644 index 00000000..ba13e66e --- /dev/null +++ b/pynitrokey/nethsm/client/paths/keys_key_id/put/parameters/parameter_0/__init__.py @@ -0,0 +1,16 @@ +# 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 new file mode 100644 index 00000000..90e13d89 --- /dev/null +++ b/pynitrokey/nethsm/client/paths/keys_key_id/put/parameters/parameter_0/schema.py @@ -0,0 +1,104 @@ +# 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 new file mode 100644 index 00000000..5280c5a3 --- /dev/null +++ b/pynitrokey/nethsm/client/paths/keys_key_id/put/parameters/parameter_1/__init__.py @@ -0,0 +1,16 @@ +# 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 new file mode 100644 index 00000000..215befe9 --- /dev/null +++ b/pynitrokey/nethsm/client/paths/keys_key_id/put/parameters/parameter_1/schema.py @@ -0,0 +1,64 @@ +# 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 new file mode 100644 index 00000000..7f1ce921 --- /dev/null +++ b/pynitrokey/nethsm/client/paths/keys_key_id/put/parameters/parameter_2/__init__.py @@ -0,0 +1,16 @@ +# 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 new file mode 100644 index 00000000..951e9038 --- /dev/null +++ b/pynitrokey/nethsm/client/paths/keys_key_id/put/parameters/parameter_2/schema.py @@ -0,0 +1,13 @@ +# 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 new file mode 100644 index 00000000..a42304f5 --- /dev/null +++ b/pynitrokey/nethsm/client/paths/keys_key_id/put/path_parameters.py @@ -0,0 +1,100 @@ +# 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 new file mode 100644 index 00000000..87529526 --- /dev/null +++ b/pynitrokey/nethsm/client/paths/keys_key_id/put/query_parameters.py @@ -0,0 +1,134 @@ +# 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 new file mode 100644 index 00000000..9fa09553 --- /dev/null +++ b/pynitrokey/nethsm/client/paths/keys_key_id/put/request_body/__init__.py @@ -0,0 +1,26 @@ +# 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 new file mode 100644 index 00000000..e69de29b 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 new file mode 100644 index 00000000..e69de29b 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 new file mode 100644 index 00000000..1e7efb0a --- /dev/null +++ b/pynitrokey/nethsm/client/paths/keys_key_id/put/request_body/content/application_json/schema.py @@ -0,0 +1,13 @@ +# 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 new file mode 100644 index 00000000..e69de29b 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 new file mode 100644 index 00000000..00854d77 --- /dev/null +++ b/pynitrokey/nethsm/client/paths/keys_key_id/put/request_body/content/application_x_pem_file/schema.py @@ -0,0 +1,13 @@ +# 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 new file mode 100644 index 00000000..e69de29b 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 new file mode 100644 index 00000000..8e822e77 --- /dev/null +++ b/pynitrokey/nethsm/client/paths/keys_key_id/put/responses/response_204/__init__.py @@ -0,0 +1,20 @@ +# coding: utf-8 + +""" + Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator +""" + +from pynitrokey.nethsm.client.shared_imports.response_imports import * # 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 new file mode 100644 index 00000000..0458793b --- /dev/null +++ b/pynitrokey/nethsm/client/paths/keys_key_id/put/responses/response_400/__init__.py @@ -0,0 +1,20 @@ +# coding: utf-8 + +""" + Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator +""" + +from pynitrokey.nethsm.client.shared_imports.response_imports import * # 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 new file mode 100644 index 00000000..cee35061 --- /dev/null +++ b/pynitrokey/nethsm/client/paths/keys_key_id/put/responses/response_401/__init__.py @@ -0,0 +1,20 @@ +# coding: utf-8 + +""" + Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator +""" + +from pynitrokey.nethsm.client.shared_imports.response_imports import * # 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 new file mode 100644 index 00000000..7bc0249d --- /dev/null +++ b/pynitrokey/nethsm/client/paths/keys_key_id/put/responses/response_403/__init__.py @@ -0,0 +1,20 @@ +# coding: utf-8 + +""" + Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator +""" + +from pynitrokey.nethsm.client.shared_imports.response_imports import * # 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 new file mode 100644 index 00000000..088c436c --- /dev/null +++ b/pynitrokey/nethsm/client/paths/keys_key_id/put/responses/response_406/__init__.py @@ -0,0 +1,20 @@ +# coding: utf-8 + +""" + Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator +""" + +from pynitrokey.nethsm.client.shared_imports.response_imports import * # 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 new file mode 100644 index 00000000..ce260df9 --- /dev/null +++ b/pynitrokey/nethsm/client/paths/keys_key_id/put/responses/response_409/__init__.py @@ -0,0 +1,20 @@ +# coding: utf-8 + +""" + Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator +""" + +from pynitrokey.nethsm.client.shared_imports.response_imports import * # 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 new file mode 100644 index 00000000..50b6212f --- /dev/null +++ b/pynitrokey/nethsm/client/paths/keys_key_id/put/responses/response_412/__init__.py @@ -0,0 +1,20 @@ +# coding: utf-8 + +""" + Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator +""" + +from pynitrokey.nethsm.client.shared_imports.response_imports import * # 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 new file mode 100644 index 00000000..e69de29b 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 new file mode 100644 index 00000000..f3b60942 --- /dev/null +++ b/pynitrokey/nethsm/client/paths/keys_key_id/put/security/security_requirement_object_0.py @@ -0,0 +1,11 @@ +# 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 index f6f3eb4b..143c7cb2 100644 --- a/pynitrokey/nethsm/client/paths/keys_key_id_cert/__init__.py +++ b/pynitrokey/nethsm/client/paths/keys_key_id_cert/__init__.py @@ -1,7 +1,5 @@ # 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.paths.keys_key_id_cert import Api +# from pynitrokey.nethsm.client.apis.paths.keys_key_id_cert import KeysKeyIDCert -from pynitrokey.nethsm.client.paths import PathValues - -path = PathValues.KEYS_KEY_ID_CERT \ No newline at end of file +path = "/keys/{KeyID}/cert" \ No newline at end of file diff --git a/pynitrokey/nethsm/client/paths/keys_key_id_cert/delete.py b/pynitrokey/nethsm/client/paths/keys_key_id_cert/delete.py deleted file mode 100644 index 26631175..00000000 --- a/pynitrokey/nethsm/client/paths/keys_key_id_cert/delete.py +++ /dev/null @@ -1,311 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 - -from pynitrokey.nethsm.client import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from pynitrokey.nethsm.client import schemas # noqa: F401 - -from . import path - -# Path params -KeyIDSchema = schemas.StrSchema -RequestRequiredPathParams = typing_extensions.TypedDict( - 'RequestRequiredPathParams', - { - 'KeyID': typing.Union[KeyIDSchema, str, ], - } -) -RequestOptionalPathParams = typing_extensions.TypedDict( - 'RequestOptionalPathParams', - { - }, - total=False -) - - -class RequestPathParams(RequestRequiredPathParams, RequestOptionalPathParams): - pass - - -request_path_key_id = api_client.PathParameter( - name="KeyID", - style=api_client.ParameterStyle.SIMPLE, - schema=KeyIDSchema, - required=True, -) -_auth = [ - 'basic', -] - - -@dataclass -class ApiResponseFor204(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_204 = api_client.OpenApiResponse( - response_cls=ApiResponseFor204, -) - - -@dataclass -class ApiResponseFor401(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_401 = api_client.OpenApiResponse( - response_cls=ApiResponseFor401, -) - - -@dataclass -class ApiResponseFor403(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_403 = api_client.OpenApiResponse( - response_cls=ApiResponseFor403, -) - - -@dataclass -class ApiResponseFor404(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_404 = api_client.OpenApiResponse( - response_cls=ApiResponseFor404, -) - - -@dataclass -class ApiResponseFor412(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_412 = api_client.OpenApiResponse( - response_cls=ApiResponseFor412, -) -_status_code_to_response = { - '204': _response_for_204, - '401': _response_for_401, - '403': _response_for_403, - '404': _response_for_404, - '412': _response_for_412, -} - - -class BaseApi(api_client.Api): - @typing.overload - def _keys_key_id_cert_delete_oapg( - self, - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor204, - ]: ... - - @typing.overload - def _keys_key_id_cert_delete_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _keys_key_id_cert_delete_oapg( - self, - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor204, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _keys_key_id_cert_delete_oapg( - self, - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :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 - """ - self._verify_typed_dict_inputs_oapg(RequestPathParams, path_params) - used_path = path.value - - _path_params = {} - for parameter in ( - request_path_key_id, - ): - parameter_data = path_params.get(parameter.name, schemas.unset) - if parameter_data is schemas.unset: - continue - serialized_data = parameter.serialize(parameter_data) - _path_params.update(serialized_data) - - for k, v in _path_params.items(): - used_path = used_path.replace('{%s}' % k, v) - # TODO add cookie handling - - response = self.api_client.call_api( - resource_path=used_path, - method='delete'.upper(), - auth_settings=_auth, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class KeysKeyIdCertDelete(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def keys_key_id_cert_delete( - self, - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor204, - ]: ... - - @typing.overload - def keys_key_id_cert_delete( - self, - skip_deserialization: typing_extensions.Literal[True], - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def keys_key_id_cert_delete( - self, - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor204, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def keys_key_id_cert_delete( - self, - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._keys_key_id_cert_delete_oapg( - path_params=path_params, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiFordelete(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def delete( - self, - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor204, - ]: ... - - @typing.overload - def delete( - self, - skip_deserialization: typing_extensions.Literal[True], - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def delete( - self, - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor204, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def delete( - self, - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._keys_key_id_cert_delete_oapg( - path_params=path_params, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/pynitrokey/nethsm/client/paths/keys_key_id_cert/delete.pyi b/pynitrokey/nethsm/client/paths/keys_key_id_cert/delete.pyi deleted file mode 100644 index c2a9f332..00000000 --- a/pynitrokey/nethsm/client/paths/keys_key_id_cert/delete.pyi +++ /dev/null @@ -1,299 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 - -from pynitrokey.nethsm.client import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from pynitrokey.nethsm.client import schemas # noqa: F401 - -# Path params -KeyIDSchema = schemas.StrSchema -RequestRequiredPathParams = typing_extensions.TypedDict( - 'RequestRequiredPathParams', - { - 'KeyID': typing.Union[KeyIDSchema, str, ], - } -) -RequestOptionalPathParams = typing_extensions.TypedDict( - 'RequestOptionalPathParams', - { - }, - total=False -) - - -class RequestPathParams(RequestRequiredPathParams, RequestOptionalPathParams): - pass - - -request_path_key_id = api_client.PathParameter( - name="KeyID", - style=api_client.ParameterStyle.SIMPLE, - schema=KeyIDSchema, - required=True, -) - - -@dataclass -class ApiResponseFor204(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_204 = api_client.OpenApiResponse( - response_cls=ApiResponseFor204, -) - - -@dataclass -class ApiResponseFor401(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_401 = api_client.OpenApiResponse( - response_cls=ApiResponseFor401, -) - - -@dataclass -class ApiResponseFor403(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_403 = api_client.OpenApiResponse( - response_cls=ApiResponseFor403, -) - - -@dataclass -class ApiResponseFor404(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_404 = api_client.OpenApiResponse( - response_cls=ApiResponseFor404, -) - - -@dataclass -class ApiResponseFor412(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_412 = api_client.OpenApiResponse( - response_cls=ApiResponseFor412, -) - - -class BaseApi(api_client.Api): - @typing.overload - def _keys_key_id_cert_delete_oapg( - self, - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor204, - ]: ... - - @typing.overload - def _keys_key_id_cert_delete_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _keys_key_id_cert_delete_oapg( - self, - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor204, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _keys_key_id_cert_delete_oapg( - self, - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :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 - """ - self._verify_typed_dict_inputs_oapg(RequestPathParams, path_params) - used_path = path.value - - _path_params = {} - for parameter in ( - request_path_key_id, - ): - parameter_data = path_params.get(parameter.name, schemas.unset) - if parameter_data is schemas.unset: - continue - serialized_data = parameter.serialize(parameter_data) - _path_params.update(serialized_data) - - for k, v in _path_params.items(): - used_path = used_path.replace('{%s}' % k, v) - # TODO add cookie handling - - response = self.api_client.call_api( - resource_path=used_path, - method='delete'.upper(), - auth_settings=_auth, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class KeysKeyIdCertDelete(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def keys_key_id_cert_delete( - self, - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor204, - ]: ... - - @typing.overload - def keys_key_id_cert_delete( - self, - skip_deserialization: typing_extensions.Literal[True], - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def keys_key_id_cert_delete( - self, - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor204, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def keys_key_id_cert_delete( - self, - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._keys_key_id_cert_delete_oapg( - path_params=path_params, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiFordelete(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def delete( - self, - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor204, - ]: ... - - @typing.overload - def delete( - self, - skip_deserialization: typing_extensions.Literal[True], - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def delete( - self, - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor204, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def delete( - self, - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._keys_key_id_cert_delete_oapg( - path_params=path_params, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - 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 new file mode 100644 index 00000000..e69de29b 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 new file mode 100644 index 00000000..c34e6ad3 --- /dev/null +++ b/pynitrokey/nethsm/client/paths/keys_key_id_cert/delete/operation.py @@ -0,0 +1,188 @@ +# 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 new file mode 100644 index 00000000..e69de29b 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 new file mode 100644 index 00000000..29e0385b --- /dev/null +++ b/pynitrokey/nethsm/client/paths/keys_key_id_cert/delete/parameters/parameter_0/__init__.py @@ -0,0 +1,16 @@ +# 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 new file mode 100644 index 00000000..951e9038 --- /dev/null +++ b/pynitrokey/nethsm/client/paths/keys_key_id_cert/delete/parameters/parameter_0/schema.py @@ -0,0 +1,13 @@ +# 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 new file mode 100644 index 00000000..cd120950 --- /dev/null +++ b/pynitrokey/nethsm/client/paths/keys_key_id_cert/delete/path_parameters.py @@ -0,0 +1,100 @@ +# 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 new file mode 100644 index 00000000..e69de29b 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 new file mode 100644 index 00000000..8e822e77 --- /dev/null +++ b/pynitrokey/nethsm/client/paths/keys_key_id_cert/delete/responses/response_204/__init__.py @@ -0,0 +1,20 @@ +# coding: utf-8 + +""" + Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator +""" + +from pynitrokey.nethsm.client.shared_imports.response_imports import * # 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 new file mode 100644 index 00000000..cee35061 --- /dev/null +++ b/pynitrokey/nethsm/client/paths/keys_key_id_cert/delete/responses/response_401/__init__.py @@ -0,0 +1,20 @@ +# coding: utf-8 + +""" + Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator +""" + +from pynitrokey.nethsm.client.shared_imports.response_imports import * # 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 new file mode 100644 index 00000000..7bc0249d --- /dev/null +++ b/pynitrokey/nethsm/client/paths/keys_key_id_cert/delete/responses/response_403/__init__.py @@ -0,0 +1,20 @@ +# coding: utf-8 + +""" + Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator +""" + +from pynitrokey.nethsm.client.shared_imports.response_imports import * # 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 new file mode 100644 index 00000000..e43c74d8 --- /dev/null +++ b/pynitrokey/nethsm/client/paths/keys_key_id_cert/delete/responses/response_404/__init__.py @@ -0,0 +1,20 @@ +# coding: utf-8 + +""" + Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator +""" + +from pynitrokey.nethsm.client.shared_imports.response_imports import * # 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 new file mode 100644 index 00000000..088c436c --- /dev/null +++ b/pynitrokey/nethsm/client/paths/keys_key_id_cert/delete/responses/response_406/__init__.py @@ -0,0 +1,20 @@ +# coding: utf-8 + +""" + Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator +""" + +from pynitrokey.nethsm.client.shared_imports.response_imports import * # 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 new file mode 100644 index 00000000..ce260df9 --- /dev/null +++ b/pynitrokey/nethsm/client/paths/keys_key_id_cert/delete/responses/response_409/__init__.py @@ -0,0 +1,20 @@ +# coding: utf-8 + +""" + Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator +""" + +from pynitrokey.nethsm.client.shared_imports.response_imports import * # 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 new file mode 100644 index 00000000..50b6212f --- /dev/null +++ b/pynitrokey/nethsm/client/paths/keys_key_id_cert/delete/responses/response_412/__init__.py @@ -0,0 +1,20 @@ +# coding: utf-8 + +""" + Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator +""" + +from pynitrokey.nethsm.client.shared_imports.response_imports import * # 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 new file mode 100644 index 00000000..e69de29b 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 new file mode 100644 index 00000000..f3b60942 --- /dev/null +++ b/pynitrokey/nethsm/client/paths/keys_key_id_cert/delete/security/security_requirement_object_0.py @@ -0,0 +1,11 @@ +# 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.py b/pynitrokey/nethsm/client/paths/keys_key_id_cert/get.py deleted file mode 100644 index 60474dff..00000000 --- a/pynitrokey/nethsm/client/paths/keys_key_id_cert/get.py +++ /dev/null @@ -1,342 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from pynitrokey.nethsm.client import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from pynitrokey.nethsm.client import schemas # noqa: F401 - -from . import path - -# Path params -KeyIDSchema = schemas.StrSchema -RequestRequiredPathParams = typing_extensions.TypedDict( - 'RequestRequiredPathParams', - { - 'KeyID': typing.Union[KeyIDSchema, str, ], - } -) -RequestOptionalPathParams = typing_extensions.TypedDict( - 'RequestOptionalPathParams', - { - }, - total=False -) - - -class RequestPathParams(RequestRequiredPathParams, RequestOptionalPathParams): - pass - - -request_path_key_id = api_client.PathParameter( - name="KeyID", - style=api_client.ParameterStyle.SIMPLE, - schema=KeyIDSchema, - required=True, -) -_auth = [ - 'basic', -] -SchemaFor200ResponseBodyApplicationPgpKeys = schemas.StrSchema - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: typing.Union[ - SchemaFor200ResponseBodyApplicationPgpKeys, - ] - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, - content={ - 'application/pgp-keys': api_client.MediaType( - schema=SchemaFor200ResponseBodyApplicationPgpKeys), - }, -) - - -@dataclass -class ApiResponseFor401(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_401 = api_client.OpenApiResponse( - response_cls=ApiResponseFor401, -) - - -@dataclass -class ApiResponseFor403(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_403 = api_client.OpenApiResponse( - response_cls=ApiResponseFor403, -) - - -@dataclass -class ApiResponseFor404(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_404 = api_client.OpenApiResponse( - response_cls=ApiResponseFor404, -) - - -@dataclass -class ApiResponseFor412(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_412 = api_client.OpenApiResponse( - response_cls=ApiResponseFor412, -) -_status_code_to_response = { - '200': _response_for_200, - '401': _response_for_401, - '403': _response_for_403, - '404': _response_for_404, - '412': _response_for_412, -} -_all_accept_content_types = ( - 'application/pgp-keys', -) - - -class BaseApi(api_client.Api): - @typing.overload - def _keys_key_id_cert_get_oapg( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _keys_key_id_cert_get_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _keys_key_id_cert_get_oapg( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _keys_key_id_cert_get_oapg( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :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 - """ - self._verify_typed_dict_inputs_oapg(RequestPathParams, path_params) - used_path = path.value - - _path_params = {} - for parameter in ( - request_path_key_id, - ): - parameter_data = path_params.get(parameter.name, schemas.unset) - if parameter_data is schemas.unset: - continue - serialized_data = parameter.serialize(parameter_data) - _path_params.update(serialized_data) - - for k, v in _path_params.items(): - used_path = used_path.replace('{%s}' % k, v) - - _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) - - response = self.api_client.call_api( - resource_path=used_path, - method='get'.upper(), - headers=_headers, - auth_settings=_auth, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class KeysKeyIdCertGet(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def keys_key_id_cert_get( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def keys_key_id_cert_get( - self, - skip_deserialization: typing_extensions.Literal[True], - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def keys_key_id_cert_get( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def keys_key_id_cert_get( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._keys_key_id_cert_get_oapg( - path_params=path_params, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForget(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def get( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def get( - self, - skip_deserialization: typing_extensions.Literal[True], - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def get( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def get( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._keys_key_id_cert_get_oapg( - path_params=path_params, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/pynitrokey/nethsm/client/paths/keys_key_id_cert/get.pyi b/pynitrokey/nethsm/client/paths/keys_key_id_cert/get.pyi deleted file mode 100644 index 9d28c249..00000000 --- a/pynitrokey/nethsm/client/paths/keys_key_id_cert/get.pyi +++ /dev/null @@ -1,330 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from pynitrokey.nethsm.client import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from pynitrokey.nethsm.client import schemas # noqa: F401 - -# Path params -KeyIDSchema = schemas.StrSchema -RequestRequiredPathParams = typing_extensions.TypedDict( - 'RequestRequiredPathParams', - { - 'KeyID': typing.Union[KeyIDSchema, str, ], - } -) -RequestOptionalPathParams = typing_extensions.TypedDict( - 'RequestOptionalPathParams', - { - }, - total=False -) - - -class RequestPathParams(RequestRequiredPathParams, RequestOptionalPathParams): - pass - - -request_path_key_id = api_client.PathParameter( - name="KeyID", - style=api_client.ParameterStyle.SIMPLE, - schema=KeyIDSchema, - required=True, -) -SchemaFor200ResponseBodyApplicationPgpKeys = schemas.StrSchema - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: typing.Union[ - SchemaFor200ResponseBodyApplicationPgpKeys, - ] - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, - content={ - 'application/pgp-keys': api_client.MediaType( - schema=SchemaFor200ResponseBodyApplicationPgpKeys), - }, -) - - -@dataclass -class ApiResponseFor401(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_401 = api_client.OpenApiResponse( - response_cls=ApiResponseFor401, -) - - -@dataclass -class ApiResponseFor403(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_403 = api_client.OpenApiResponse( - response_cls=ApiResponseFor403, -) - - -@dataclass -class ApiResponseFor404(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_404 = api_client.OpenApiResponse( - response_cls=ApiResponseFor404, -) - - -@dataclass -class ApiResponseFor412(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_412 = api_client.OpenApiResponse( - response_cls=ApiResponseFor412, -) -_all_accept_content_types = ( - 'application/pgp-keys', -) - - -class BaseApi(api_client.Api): - @typing.overload - def _keys_key_id_cert_get_oapg( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _keys_key_id_cert_get_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _keys_key_id_cert_get_oapg( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _keys_key_id_cert_get_oapg( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :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 - """ - self._verify_typed_dict_inputs_oapg(RequestPathParams, path_params) - used_path = path.value - - _path_params = {} - for parameter in ( - request_path_key_id, - ): - parameter_data = path_params.get(parameter.name, schemas.unset) - if parameter_data is schemas.unset: - continue - serialized_data = parameter.serialize(parameter_data) - _path_params.update(serialized_data) - - for k, v in _path_params.items(): - used_path = used_path.replace('{%s}' % k, v) - - _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) - - response = self.api_client.call_api( - resource_path=used_path, - method='get'.upper(), - headers=_headers, - auth_settings=_auth, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class KeysKeyIdCertGet(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def keys_key_id_cert_get( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def keys_key_id_cert_get( - self, - skip_deserialization: typing_extensions.Literal[True], - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def keys_key_id_cert_get( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def keys_key_id_cert_get( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._keys_key_id_cert_get_oapg( - path_params=path_params, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForget(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def get( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def get( - self, - skip_deserialization: typing_extensions.Literal[True], - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def get( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def get( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._keys_key_id_cert_get_oapg( - path_params=path_params, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - 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 new file mode 100644 index 00000000..e69de29b 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 new file mode 100644 index 00000000..551f8af6 --- /dev/null +++ b/pynitrokey/nethsm/client/paths/keys_key_id_cert/get/operation.py @@ -0,0 +1,199 @@ +# 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 new file mode 100644 index 00000000..e69de29b 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 new file mode 100644 index 00000000..29e0385b --- /dev/null +++ b/pynitrokey/nethsm/client/paths/keys_key_id_cert/get/parameters/parameter_0/__init__.py @@ -0,0 +1,16 @@ +# 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 new file mode 100644 index 00000000..951e9038 --- /dev/null +++ b/pynitrokey/nethsm/client/paths/keys_key_id_cert/get/parameters/parameter_0/schema.py @@ -0,0 +1,13 @@ +# 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 new file mode 100644 index 00000000..e8922e8a --- /dev/null +++ b/pynitrokey/nethsm/client/paths/keys_key_id_cert/get/path_parameters.py @@ -0,0 +1,100 @@ +# 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 new file mode 100644 index 00000000..e69de29b 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 new file mode 100644 index 00000000..7575f81e --- /dev/null +++ b/pynitrokey/nethsm/client/paths/keys_key_id_cert/get/responses/response_200/__init__.py @@ -0,0 +1,45 @@ +# coding: utf-8 + +""" + Generated 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 new file mode 100644 index 00000000..e69de29b 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 new file mode 100644 index 00000000..e69de29b 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 new file mode 100644 index 00000000..66f736fb --- /dev/null +++ b/pynitrokey/nethsm/client/paths/keys_key_id_cert/get/responses/response_200/content/application_pgp_keys/schema.py @@ -0,0 +1,13 @@ +# 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 new file mode 100644 index 00000000..e69de29b 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 new file mode 100644 index 00000000..1457aaf5 --- /dev/null +++ b/pynitrokey/nethsm/client/paths/keys_key_id_cert/get/responses/response_200/content/application_x_pem_file/schema.py @@ -0,0 +1,13 @@ +# 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 new file mode 100644 index 00000000..e69de29b 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 new file mode 100644 index 00000000..951e9038 --- /dev/null +++ b/pynitrokey/nethsm/client/paths/keys_key_id_cert/get/responses/response_200/content/application_xx509_ca_cert/schema.py @@ -0,0 +1,13 @@ +# 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 new file mode 100644 index 00000000..0458793b --- /dev/null +++ b/pynitrokey/nethsm/client/paths/keys_key_id_cert/get/responses/response_400/__init__.py @@ -0,0 +1,20 @@ +# coding: utf-8 + +""" + Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator +""" + +from pynitrokey.nethsm.client.shared_imports.response_imports import * # 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 new file mode 100644 index 00000000..cee35061 --- /dev/null +++ b/pynitrokey/nethsm/client/paths/keys_key_id_cert/get/responses/response_401/__init__.py @@ -0,0 +1,20 @@ +# coding: utf-8 + +""" + Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator +""" + +from pynitrokey.nethsm.client.shared_imports.response_imports import * # 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 new file mode 100644 index 00000000..7bc0249d --- /dev/null +++ b/pynitrokey/nethsm/client/paths/keys_key_id_cert/get/responses/response_403/__init__.py @@ -0,0 +1,20 @@ +# coding: utf-8 + +""" + Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator +""" + +from pynitrokey.nethsm.client.shared_imports.response_imports import * # 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 new file mode 100644 index 00000000..e43c74d8 --- /dev/null +++ b/pynitrokey/nethsm/client/paths/keys_key_id_cert/get/responses/response_404/__init__.py @@ -0,0 +1,20 @@ +# coding: utf-8 + +""" + Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator +""" + +from pynitrokey.nethsm.client.shared_imports.response_imports import * # 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 new file mode 100644 index 00000000..088c436c --- /dev/null +++ b/pynitrokey/nethsm/client/paths/keys_key_id_cert/get/responses/response_406/__init__.py @@ -0,0 +1,20 @@ +# coding: utf-8 + +""" + Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator +""" + +from pynitrokey.nethsm.client.shared_imports.response_imports import * # 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 new file mode 100644 index 00000000..50b6212f --- /dev/null +++ b/pynitrokey/nethsm/client/paths/keys_key_id_cert/get/responses/response_412/__init__.py @@ -0,0 +1,20 @@ +# coding: utf-8 + +""" + Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator +""" + +from pynitrokey.nethsm.client.shared_imports.response_imports import * # 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 new file mode 100644 index 00000000..e69de29b 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 new file mode 100644 index 00000000..f3b60942 --- /dev/null +++ b/pynitrokey/nethsm/client/paths/keys_key_id_cert/get/security/security_requirement_object_0.py @@ -0,0 +1,11 @@ +# 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.py b/pynitrokey/nethsm/client/paths/keys_key_id_cert/put.py deleted file mode 100644 index 45d3474b..00000000 --- a/pynitrokey/nethsm/client/paths/keys_key_id_cert/put.py +++ /dev/null @@ -1,493 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from pynitrokey.nethsm.client import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from pynitrokey.nethsm.client import schemas # noqa: F401 - -from . import path - -# Path params -KeyIDSchema = schemas.StrSchema -RequestRequiredPathParams = typing_extensions.TypedDict( - 'RequestRequiredPathParams', - { - 'KeyID': typing.Union[KeyIDSchema, str, ], - } -) -RequestOptionalPathParams = typing_extensions.TypedDict( - 'RequestOptionalPathParams', - { - }, - total=False -) - - -class RequestPathParams(RequestRequiredPathParams, RequestOptionalPathParams): - pass - - -request_path_key_id = api_client.PathParameter( - name="KeyID", - style=api_client.ParameterStyle.SIMPLE, - schema=KeyIDSchema, - required=True, -) -# body param -SchemaForRequestBodyApplicationXPemFile = schemas.StrSchema -SchemaForRequestBodyApplicationXX509CaCert = schemas.StrSchema -SchemaForRequestBodyApplicationPgpKeys = schemas.StrSchema - - -request_body_body = api_client.RequestBody( - content={ - 'application/x-pem-file': api_client.MediaType( - schema=SchemaForRequestBodyApplicationXPemFile), - 'application/x-x509-ca-cert': api_client.MediaType( - schema=SchemaForRequestBodyApplicationXX509CaCert), - 'application/pgp-keys': api_client.MediaType( - schema=SchemaForRequestBodyApplicationPgpKeys), - }, - required=True, -) -_auth = [ - 'basic', -] - - -@dataclass -class ApiResponseFor201(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_201 = api_client.OpenApiResponse( - response_cls=ApiResponseFor201, -) - - -@dataclass -class ApiResponseFor401(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_401 = api_client.OpenApiResponse( - response_cls=ApiResponseFor401, -) - - -@dataclass -class ApiResponseFor403(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_403 = api_client.OpenApiResponse( - response_cls=ApiResponseFor403, -) - - -@dataclass -class ApiResponseFor409(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_409 = api_client.OpenApiResponse( - response_cls=ApiResponseFor409, -) - - -@dataclass -class ApiResponseFor412(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_412 = api_client.OpenApiResponse( - response_cls=ApiResponseFor412, -) -_status_code_to_response = { - '201': _response_for_201, - '401': _response_for_401, - '403': _response_for_403, - '409': _response_for_409, - '412': _response_for_412, -} - - -class BaseApi(api_client.Api): - @typing.overload - def _keys_key_id_cert_put_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationXPemFile,str, ], - content_type: typing_extensions.Literal["application/x-pem-file"] = ..., - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor201, - ]: ... - - @typing.overload - def _keys_key_id_cert_put_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationXX509CaCert,str, ], - content_type: typing_extensions.Literal["application/x-x509-ca-cert"], - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor201, - ]: ... - - @typing.overload - def _keys_key_id_cert_put_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationPgpKeys,str, ], - content_type: typing_extensions.Literal["application/pgp-keys"], - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor201, - ]: ... - - @typing.overload - def _keys_key_id_cert_put_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationXPemFile,str, SchemaForRequestBodyApplicationXX509CaCert,str, SchemaForRequestBodyApplicationPgpKeys,str, ], - content_type: str = ..., - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor201, - ]: ... - - - @typing.overload - def _keys_key_id_cert_put_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationXPemFile,str, SchemaForRequestBodyApplicationXX509CaCert,str, SchemaForRequestBodyApplicationPgpKeys,str, ], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _keys_key_id_cert_put_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationXPemFile,str, SchemaForRequestBodyApplicationXX509CaCert,str, SchemaForRequestBodyApplicationPgpKeys,str, ], - content_type: str = ..., - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor201, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _keys_key_id_cert_put_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationXPemFile,str, SchemaForRequestBodyApplicationXX509CaCert,str, SchemaForRequestBodyApplicationPgpKeys,str, ], - content_type: str = 'application/x-pem-file', - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :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 - """ - self._verify_typed_dict_inputs_oapg(RequestPathParams, path_params) - used_path = path.value - - _path_params = {} - for parameter in ( - request_path_key_id, - ): - parameter_data = path_params.get(parameter.name, schemas.unset) - if parameter_data is schemas.unset: - continue - serialized_data = parameter.serialize(parameter_data) - _path_params.update(serialized_data) - - for k, v in _path_params.items(): - used_path = used_path.replace('{%s}' % k, v) - - _headers = HTTPHeaderDict() - # TODO add cookie handling - - if body is schemas.unset: - raise exceptions.ApiValueError( - 'The required body parameter has an invalid value of: unset. Set a valid value instead') - _fields = None - _body = None - serialized_data = request_body_body.serialize(body, content_type) - _headers.add('Content-Type', content_type) - if 'fields' in serialized_data: - _fields = serialized_data['fields'] - elif 'body' in serialized_data: - _body = serialized_data['body'] - response = self.api_client.call_api( - resource_path=used_path, - method='put'.upper(), - headers=_headers, - fields=_fields, - body=_body, - auth_settings=_auth, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class KeysKeyIdCertPut(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def keys_key_id_cert_put( - self, - body: typing.Union[SchemaForRequestBodyApplicationXPemFile,str, ], - content_type: typing_extensions.Literal["application/x-pem-file"] = ..., - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor201, - ]: ... - - @typing.overload - def keys_key_id_cert_put( - self, - body: typing.Union[SchemaForRequestBodyApplicationXX509CaCert,str, ], - content_type: typing_extensions.Literal["application/x-x509-ca-cert"], - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor201, - ]: ... - - @typing.overload - def keys_key_id_cert_put( - self, - body: typing.Union[SchemaForRequestBodyApplicationPgpKeys,str, ], - content_type: typing_extensions.Literal["application/pgp-keys"], - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor201, - ]: ... - - @typing.overload - def keys_key_id_cert_put( - self, - body: typing.Union[SchemaForRequestBodyApplicationXPemFile,str, SchemaForRequestBodyApplicationXX509CaCert,str, SchemaForRequestBodyApplicationPgpKeys,str, ], - content_type: str = ..., - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor201, - ]: ... - - - @typing.overload - def keys_key_id_cert_put( - self, - body: typing.Union[SchemaForRequestBodyApplicationXPemFile,str, SchemaForRequestBodyApplicationXX509CaCert,str, SchemaForRequestBodyApplicationPgpKeys,str, ], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def keys_key_id_cert_put( - self, - body: typing.Union[SchemaForRequestBodyApplicationXPemFile,str, SchemaForRequestBodyApplicationXX509CaCert,str, SchemaForRequestBodyApplicationPgpKeys,str, ], - content_type: str = ..., - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor201, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def keys_key_id_cert_put( - self, - body: typing.Union[SchemaForRequestBodyApplicationXPemFile,str, SchemaForRequestBodyApplicationXX509CaCert,str, SchemaForRequestBodyApplicationPgpKeys,str, ], - content_type: str = 'application/x-pem-file', - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._keys_key_id_cert_put_oapg( - body=body, - path_params=path_params, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForput(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def put( - self, - body: typing.Union[SchemaForRequestBodyApplicationXPemFile,str, ], - content_type: typing_extensions.Literal["application/x-pem-file"] = ..., - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor201, - ]: ... - - @typing.overload - def put( - self, - body: typing.Union[SchemaForRequestBodyApplicationXX509CaCert,str, ], - content_type: typing_extensions.Literal["application/x-x509-ca-cert"], - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor201, - ]: ... - - @typing.overload - def put( - self, - body: typing.Union[SchemaForRequestBodyApplicationPgpKeys,str, ], - content_type: typing_extensions.Literal["application/pgp-keys"], - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor201, - ]: ... - - @typing.overload - def put( - self, - body: typing.Union[SchemaForRequestBodyApplicationXPemFile,str, SchemaForRequestBodyApplicationXX509CaCert,str, SchemaForRequestBodyApplicationPgpKeys,str, ], - content_type: str = ..., - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor201, - ]: ... - - - @typing.overload - def put( - self, - body: typing.Union[SchemaForRequestBodyApplicationXPemFile,str, SchemaForRequestBodyApplicationXX509CaCert,str, SchemaForRequestBodyApplicationPgpKeys,str, ], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def put( - self, - body: typing.Union[SchemaForRequestBodyApplicationXPemFile,str, SchemaForRequestBodyApplicationXX509CaCert,str, SchemaForRequestBodyApplicationPgpKeys,str, ], - content_type: str = ..., - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor201, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def put( - self, - body: typing.Union[SchemaForRequestBodyApplicationXPemFile,str, SchemaForRequestBodyApplicationXX509CaCert,str, SchemaForRequestBodyApplicationPgpKeys,str, ], - content_type: str = 'application/x-pem-file', - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._keys_key_id_cert_put_oapg( - body=body, - path_params=path_params, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/pynitrokey/nethsm/client/paths/keys_key_id_cert/put.pyi b/pynitrokey/nethsm/client/paths/keys_key_id_cert/put.pyi deleted file mode 100644 index 3418c73f..00000000 --- a/pynitrokey/nethsm/client/paths/keys_key_id_cert/put.pyi +++ /dev/null @@ -1,481 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from pynitrokey.nethsm.client import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from pynitrokey.nethsm.client import schemas # noqa: F401 - -# Path params -KeyIDSchema = schemas.StrSchema -RequestRequiredPathParams = typing_extensions.TypedDict( - 'RequestRequiredPathParams', - { - 'KeyID': typing.Union[KeyIDSchema, str, ], - } -) -RequestOptionalPathParams = typing_extensions.TypedDict( - 'RequestOptionalPathParams', - { - }, - total=False -) - - -class RequestPathParams(RequestRequiredPathParams, RequestOptionalPathParams): - pass - - -request_path_key_id = api_client.PathParameter( - name="KeyID", - style=api_client.ParameterStyle.SIMPLE, - schema=KeyIDSchema, - required=True, -) -# body param -SchemaForRequestBodyApplicationXPemFile = schemas.StrSchema -SchemaForRequestBodyApplicationXX509CaCert = schemas.StrSchema -SchemaForRequestBodyApplicationPgpKeys = schemas.StrSchema - - -request_body_body = api_client.RequestBody( - content={ - 'application/x-pem-file': api_client.MediaType( - schema=SchemaForRequestBodyApplicationXPemFile), - 'application/x-x509-ca-cert': api_client.MediaType( - schema=SchemaForRequestBodyApplicationXX509CaCert), - 'application/pgp-keys': api_client.MediaType( - schema=SchemaForRequestBodyApplicationPgpKeys), - }, - required=True, -) - - -@dataclass -class ApiResponseFor201(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_201 = api_client.OpenApiResponse( - response_cls=ApiResponseFor201, -) - - -@dataclass -class ApiResponseFor401(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_401 = api_client.OpenApiResponse( - response_cls=ApiResponseFor401, -) - - -@dataclass -class ApiResponseFor403(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_403 = api_client.OpenApiResponse( - response_cls=ApiResponseFor403, -) - - -@dataclass -class ApiResponseFor409(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_409 = api_client.OpenApiResponse( - response_cls=ApiResponseFor409, -) - - -@dataclass -class ApiResponseFor412(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_412 = api_client.OpenApiResponse( - response_cls=ApiResponseFor412, -) - - -class BaseApi(api_client.Api): - @typing.overload - def _keys_key_id_cert_put_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationXPemFile,str, ], - content_type: typing_extensions.Literal["application/x-pem-file"] = ..., - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor201, - ]: ... - - @typing.overload - def _keys_key_id_cert_put_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationXX509CaCert,str, ], - content_type: typing_extensions.Literal["application/x-x509-ca-cert"], - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor201, - ]: ... - - @typing.overload - def _keys_key_id_cert_put_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationPgpKeys,str, ], - content_type: typing_extensions.Literal["application/pgp-keys"], - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor201, - ]: ... - - @typing.overload - def _keys_key_id_cert_put_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationXPemFile,str, SchemaForRequestBodyApplicationXX509CaCert,str, SchemaForRequestBodyApplicationPgpKeys,str, ], - content_type: str = ..., - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor201, - ]: ... - - - @typing.overload - def _keys_key_id_cert_put_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationXPemFile,str, SchemaForRequestBodyApplicationXX509CaCert,str, SchemaForRequestBodyApplicationPgpKeys,str, ], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _keys_key_id_cert_put_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationXPemFile,str, SchemaForRequestBodyApplicationXX509CaCert,str, SchemaForRequestBodyApplicationPgpKeys,str, ], - content_type: str = ..., - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor201, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _keys_key_id_cert_put_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationXPemFile,str, SchemaForRequestBodyApplicationXX509CaCert,str, SchemaForRequestBodyApplicationPgpKeys,str, ], - content_type: str = 'application/x-pem-file', - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :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 - """ - self._verify_typed_dict_inputs_oapg(RequestPathParams, path_params) - used_path = path.value - - _path_params = {} - for parameter in ( - request_path_key_id, - ): - parameter_data = path_params.get(parameter.name, schemas.unset) - if parameter_data is schemas.unset: - continue - serialized_data = parameter.serialize(parameter_data) - _path_params.update(serialized_data) - - for k, v in _path_params.items(): - used_path = used_path.replace('{%s}' % k, v) - - _headers = HTTPHeaderDict() - # TODO add cookie handling - - if body is schemas.unset: - raise exceptions.ApiValueError( - 'The required body parameter has an invalid value of: unset. Set a valid value instead') - _fields = None - _body = None - serialized_data = request_body_body.serialize(body, content_type) - _headers.add('Content-Type', content_type) - if 'fields' in serialized_data: - _fields = serialized_data['fields'] - elif 'body' in serialized_data: - _body = serialized_data['body'] - response = self.api_client.call_api( - resource_path=used_path, - method='put'.upper(), - headers=_headers, - fields=_fields, - body=_body, - auth_settings=_auth, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class KeysKeyIdCertPut(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def keys_key_id_cert_put( - self, - body: typing.Union[SchemaForRequestBodyApplicationXPemFile,str, ], - content_type: typing_extensions.Literal["application/x-pem-file"] = ..., - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor201, - ]: ... - - @typing.overload - def keys_key_id_cert_put( - self, - body: typing.Union[SchemaForRequestBodyApplicationXX509CaCert,str, ], - content_type: typing_extensions.Literal["application/x-x509-ca-cert"], - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor201, - ]: ... - - @typing.overload - def keys_key_id_cert_put( - self, - body: typing.Union[SchemaForRequestBodyApplicationPgpKeys,str, ], - content_type: typing_extensions.Literal["application/pgp-keys"], - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor201, - ]: ... - - @typing.overload - def keys_key_id_cert_put( - self, - body: typing.Union[SchemaForRequestBodyApplicationXPemFile,str, SchemaForRequestBodyApplicationXX509CaCert,str, SchemaForRequestBodyApplicationPgpKeys,str, ], - content_type: str = ..., - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor201, - ]: ... - - - @typing.overload - def keys_key_id_cert_put( - self, - body: typing.Union[SchemaForRequestBodyApplicationXPemFile,str, SchemaForRequestBodyApplicationXX509CaCert,str, SchemaForRequestBodyApplicationPgpKeys,str, ], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def keys_key_id_cert_put( - self, - body: typing.Union[SchemaForRequestBodyApplicationXPemFile,str, SchemaForRequestBodyApplicationXX509CaCert,str, SchemaForRequestBodyApplicationPgpKeys,str, ], - content_type: str = ..., - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor201, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def keys_key_id_cert_put( - self, - body: typing.Union[SchemaForRequestBodyApplicationXPemFile,str, SchemaForRequestBodyApplicationXX509CaCert,str, SchemaForRequestBodyApplicationPgpKeys,str, ], - content_type: str = 'application/x-pem-file', - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._keys_key_id_cert_put_oapg( - body=body, - path_params=path_params, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForput(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def put( - self, - body: typing.Union[SchemaForRequestBodyApplicationXPemFile,str, ], - content_type: typing_extensions.Literal["application/x-pem-file"] = ..., - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor201, - ]: ... - - @typing.overload - def put( - self, - body: typing.Union[SchemaForRequestBodyApplicationXX509CaCert,str, ], - content_type: typing_extensions.Literal["application/x-x509-ca-cert"], - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor201, - ]: ... - - @typing.overload - def put( - self, - body: typing.Union[SchemaForRequestBodyApplicationPgpKeys,str, ], - content_type: typing_extensions.Literal["application/pgp-keys"], - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor201, - ]: ... - - @typing.overload - def put( - self, - body: typing.Union[SchemaForRequestBodyApplicationXPemFile,str, SchemaForRequestBodyApplicationXX509CaCert,str, SchemaForRequestBodyApplicationPgpKeys,str, ], - content_type: str = ..., - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor201, - ]: ... - - - @typing.overload - def put( - self, - body: typing.Union[SchemaForRequestBodyApplicationXPemFile,str, SchemaForRequestBodyApplicationXX509CaCert,str, SchemaForRequestBodyApplicationPgpKeys,str, ], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def put( - self, - body: typing.Union[SchemaForRequestBodyApplicationXPemFile,str, SchemaForRequestBodyApplicationXX509CaCert,str, SchemaForRequestBodyApplicationPgpKeys,str, ], - content_type: str = ..., - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor201, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def put( - self, - body: typing.Union[SchemaForRequestBodyApplicationXPemFile,str, SchemaForRequestBodyApplicationXX509CaCert,str, SchemaForRequestBodyApplicationPgpKeys,str, ], - content_type: str = 'application/x-pem-file', - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._keys_key_id_cert_put_oapg( - body=body, - path_params=path_params, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - 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 new file mode 100644 index 00000000..e69de29b 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 new file mode 100644 index 00000000..095c081a --- /dev/null +++ b/pynitrokey/nethsm/client/paths/keys_key_id_cert/put/operation.py @@ -0,0 +1,280 @@ +# 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 new file mode 100644 index 00000000..e69de29b 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 new file mode 100644 index 00000000..29e0385b --- /dev/null +++ b/pynitrokey/nethsm/client/paths/keys_key_id_cert/put/parameters/parameter_0/__init__.py @@ -0,0 +1,16 @@ +# 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 new file mode 100644 index 00000000..951e9038 --- /dev/null +++ b/pynitrokey/nethsm/client/paths/keys_key_id_cert/put/parameters/parameter_0/schema.py @@ -0,0 +1,13 @@ +# 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 new file mode 100644 index 00000000..7f83832b --- /dev/null +++ b/pynitrokey/nethsm/client/paths/keys_key_id_cert/put/path_parameters.py @@ -0,0 +1,100 @@ +# 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 new file mode 100644 index 00000000..a64bbd85 --- /dev/null +++ b/pynitrokey/nethsm/client/paths/keys_key_id_cert/put/request_body/__init__.py @@ -0,0 +1,32 @@ +# 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 new file mode 100644 index 00000000..e69de29b 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 new file mode 100644 index 00000000..e69de29b 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 new file mode 100644 index 00000000..66f736fb --- /dev/null +++ b/pynitrokey/nethsm/client/paths/keys_key_id_cert/put/request_body/content/application_pgp_keys/schema.py @@ -0,0 +1,13 @@ +# 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 new file mode 100644 index 00000000..e69de29b 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 new file mode 100644 index 00000000..1457aaf5 --- /dev/null +++ b/pynitrokey/nethsm/client/paths/keys_key_id_cert/put/request_body/content/application_x_pem_file/schema.py @@ -0,0 +1,13 @@ +# 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 new file mode 100644 index 00000000..e69de29b 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 new file mode 100644 index 00000000..951e9038 --- /dev/null +++ b/pynitrokey/nethsm/client/paths/keys_key_id_cert/put/request_body/content/application_xx509_ca_cert/schema.py @@ -0,0 +1,13 @@ +# 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 new file mode 100644 index 00000000..e69de29b 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 new file mode 100644 index 00000000..dca4edc5 --- /dev/null +++ b/pynitrokey/nethsm/client/paths/keys_key_id_cert/put/responses/response_201/__init__.py @@ -0,0 +1,20 @@ +# coding: utf-8 + +""" + Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator +""" + +from pynitrokey.nethsm.client.shared_imports.response_imports import * # 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 new file mode 100644 index 00000000..cee35061 --- /dev/null +++ b/pynitrokey/nethsm/client/paths/keys_key_id_cert/put/responses/response_401/__init__.py @@ -0,0 +1,20 @@ +# coding: utf-8 + +""" + Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator +""" + +from pynitrokey.nethsm.client.shared_imports.response_imports import * # 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 new file mode 100644 index 00000000..7bc0249d --- /dev/null +++ b/pynitrokey/nethsm/client/paths/keys_key_id_cert/put/responses/response_403/__init__.py @@ -0,0 +1,20 @@ +# coding: utf-8 + +""" + Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator +""" + +from pynitrokey.nethsm.client.shared_imports.response_imports import * # 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 new file mode 100644 index 00000000..088c436c --- /dev/null +++ b/pynitrokey/nethsm/client/paths/keys_key_id_cert/put/responses/response_406/__init__.py @@ -0,0 +1,20 @@ +# coding: utf-8 + +""" + Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator +""" + +from pynitrokey.nethsm.client.shared_imports.response_imports import * # 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 new file mode 100644 index 00000000..ce260df9 --- /dev/null +++ b/pynitrokey/nethsm/client/paths/keys_key_id_cert/put/responses/response_409/__init__.py @@ -0,0 +1,20 @@ +# coding: utf-8 + +""" + Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator +""" + +from pynitrokey.nethsm.client.shared_imports.response_imports import * # 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 new file mode 100644 index 00000000..50b6212f --- /dev/null +++ b/pynitrokey/nethsm/client/paths/keys_key_id_cert/put/responses/response_412/__init__.py @@ -0,0 +1,20 @@ +# coding: utf-8 + +""" + Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator +""" + +from pynitrokey.nethsm.client.shared_imports.response_imports import * # 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 new file mode 100644 index 00000000..e69de29b 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 new file mode 100644 index 00000000..f3b60942 --- /dev/null +++ b/pynitrokey/nethsm/client/paths/keys_key_id_cert/put/security/security_requirement_object_0.py @@ -0,0 +1,11 @@ +# 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 index c818ded6..4b053b4c 100644 --- a/pynitrokey/nethsm/client/paths/keys_key_id_csr_pem/__init__.py +++ b/pynitrokey/nethsm/client/paths/keys_key_id_csr_pem/__init__.py @@ -1,7 +1,5 @@ # 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.paths.keys_key_id_csr_pem import Api +# from pynitrokey.nethsm.client.apis.paths.keys_key_id_csr_pem import KeysKeyIDCsrPem -from pynitrokey.nethsm.client.paths import PathValues - -path = PathValues.KEYS_KEY_ID_CSR_PEM \ No newline at end of file +path = "/keys/{KeyID}/csr.pem" \ No newline at end of file diff --git a/pynitrokey/nethsm/client/paths/keys_key_id_csr_pem/post.py b/pynitrokey/nethsm/client/paths/keys_key_id_csr_pem/post.py deleted file mode 100644 index a4ea7156..00000000 --- a/pynitrokey/nethsm/client/paths/keys_key_id_csr_pem/post.py +++ /dev/null @@ -1,441 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from pynitrokey.nethsm.client import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from pynitrokey.nethsm.client import schemas # noqa: F401 - -from pynitrokey.nethsm.client.model.distinguished_name import DistinguishedName - -from . import path - -# Path params -KeyIDSchema = schemas.StrSchema -RequestRequiredPathParams = typing_extensions.TypedDict( - 'RequestRequiredPathParams', - { - 'KeyID': typing.Union[KeyIDSchema, str, ], - } -) -RequestOptionalPathParams = typing_extensions.TypedDict( - 'RequestOptionalPathParams', - { - }, - total=False -) - - -class RequestPathParams(RequestRequiredPathParams, RequestOptionalPathParams): - pass - - -request_path_key_id = api_client.PathParameter( - name="KeyID", - style=api_client.ParameterStyle.SIMPLE, - schema=KeyIDSchema, - required=True, -) -# body param -SchemaForRequestBodyApplicationJson = DistinguishedName - - -request_body_distinguished_name = api_client.RequestBody( - content={ - 'application/json': api_client.MediaType( - schema=SchemaForRequestBodyApplicationJson), - }, - required=True, -) -_auth = [ - 'basic', -] -SchemaFor200ResponseBodyApplicationXPemFile = schemas.StrSchema - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: typing.Union[ - SchemaFor200ResponseBodyApplicationXPemFile, - ] - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, - content={ - 'application/x-pem-file': api_client.MediaType( - schema=SchemaFor200ResponseBodyApplicationXPemFile), - }, -) - - -@dataclass -class ApiResponseFor401(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_401 = api_client.OpenApiResponse( - response_cls=ApiResponseFor401, -) - - -@dataclass -class ApiResponseFor403(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_403 = api_client.OpenApiResponse( - response_cls=ApiResponseFor403, -) - - -@dataclass -class ApiResponseFor404(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_404 = api_client.OpenApiResponse( - response_cls=ApiResponseFor404, -) - - -@dataclass -class ApiResponseFor412(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_412 = api_client.OpenApiResponse( - response_cls=ApiResponseFor412, -) -_status_code_to_response = { - '200': _response_for_200, - '401': _response_for_401, - '403': _response_for_403, - '404': _response_for_404, - '412': _response_for_412, -} -_all_accept_content_types = ( - 'application/x-pem-file', -) - - -class BaseApi(api_client.Api): - @typing.overload - def _keys_key_id_csr_pem_post_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _keys_key_id_csr_pem_post_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def _keys_key_id_csr_pem_post_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _keys_key_id_csr_pem_post_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _keys_key_id_csr_pem_post_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :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 - """ - self._verify_typed_dict_inputs_oapg(RequestPathParams, path_params) - used_path = path.value - - _path_params = {} - for parameter in ( - request_path_key_id, - ): - parameter_data = path_params.get(parameter.name, schemas.unset) - if parameter_data is schemas.unset: - continue - serialized_data = parameter.serialize(parameter_data) - _path_params.update(serialized_data) - - for k, v in _path_params.items(): - used_path = used_path.replace('{%s}' % k, v) - - _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) - - if body is schemas.unset: - raise exceptions.ApiValueError( - 'The required body parameter has an invalid value of: unset. Set a valid value instead') - _fields = None - _body = None - serialized_data = request_body_distinguished_name.serialize(body, content_type) - _headers.add('Content-Type', content_type) - if 'fields' in serialized_data: - _fields = serialized_data['fields'] - elif 'body' in serialized_data: - _body = serialized_data['body'] - response = self.api_client.call_api( - resource_path=used_path, - method='post'.upper(), - headers=_headers, - fields=_fields, - body=_body, - auth_settings=_auth, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class KeysKeyIdCsrPemPost(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def keys_key_id_csr_pem_post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def keys_key_id_csr_pem_post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def keys_key_id_csr_pem_post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def keys_key_id_csr_pem_post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def keys_key_id_csr_pem_post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._keys_key_id_csr_pem_post_oapg( - body=body, - path_params=path_params, - content_type=content_type, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForpost(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._keys_key_id_csr_pem_post_oapg( - body=body, - path_params=path_params, - content_type=content_type, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/pynitrokey/nethsm/client/paths/keys_key_id_csr_pem/post.pyi b/pynitrokey/nethsm/client/paths/keys_key_id_csr_pem/post.pyi deleted file mode 100644 index d653aefa..00000000 --- a/pynitrokey/nethsm/client/paths/keys_key_id_csr_pem/post.pyi +++ /dev/null @@ -1,429 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from pynitrokey.nethsm.client import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from pynitrokey.nethsm.client import schemas # noqa: F401 - -from pynitrokey.nethsm.client.model.distinguished_name import DistinguishedName - -# Path params -KeyIDSchema = schemas.StrSchema -RequestRequiredPathParams = typing_extensions.TypedDict( - 'RequestRequiredPathParams', - { - 'KeyID': typing.Union[KeyIDSchema, str, ], - } -) -RequestOptionalPathParams = typing_extensions.TypedDict( - 'RequestOptionalPathParams', - { - }, - total=False -) - - -class RequestPathParams(RequestRequiredPathParams, RequestOptionalPathParams): - pass - - -request_path_key_id = api_client.PathParameter( - name="KeyID", - style=api_client.ParameterStyle.SIMPLE, - schema=KeyIDSchema, - required=True, -) -# body param -SchemaForRequestBodyApplicationJson = DistinguishedName - - -request_body_distinguished_name = api_client.RequestBody( - content={ - 'application/json': api_client.MediaType( - schema=SchemaForRequestBodyApplicationJson), - }, - required=True, -) -SchemaFor200ResponseBodyApplicationXPemFile = schemas.StrSchema - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: typing.Union[ - SchemaFor200ResponseBodyApplicationXPemFile, - ] - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, - content={ - 'application/x-pem-file': api_client.MediaType( - schema=SchemaFor200ResponseBodyApplicationXPemFile), - }, -) - - -@dataclass -class ApiResponseFor401(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_401 = api_client.OpenApiResponse( - response_cls=ApiResponseFor401, -) - - -@dataclass -class ApiResponseFor403(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_403 = api_client.OpenApiResponse( - response_cls=ApiResponseFor403, -) - - -@dataclass -class ApiResponseFor404(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_404 = api_client.OpenApiResponse( - response_cls=ApiResponseFor404, -) - - -@dataclass -class ApiResponseFor412(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_412 = api_client.OpenApiResponse( - response_cls=ApiResponseFor412, -) -_all_accept_content_types = ( - 'application/x-pem-file', -) - - -class BaseApi(api_client.Api): - @typing.overload - def _keys_key_id_csr_pem_post_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _keys_key_id_csr_pem_post_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def _keys_key_id_csr_pem_post_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _keys_key_id_csr_pem_post_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _keys_key_id_csr_pem_post_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :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 - """ - self._verify_typed_dict_inputs_oapg(RequestPathParams, path_params) - used_path = path.value - - _path_params = {} - for parameter in ( - request_path_key_id, - ): - parameter_data = path_params.get(parameter.name, schemas.unset) - if parameter_data is schemas.unset: - continue - serialized_data = parameter.serialize(parameter_data) - _path_params.update(serialized_data) - - for k, v in _path_params.items(): - used_path = used_path.replace('{%s}' % k, v) - - _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) - - if body is schemas.unset: - raise exceptions.ApiValueError( - 'The required body parameter has an invalid value of: unset. Set a valid value instead') - _fields = None - _body = None - serialized_data = request_body_distinguished_name.serialize(body, content_type) - _headers.add('Content-Type', content_type) - if 'fields' in serialized_data: - _fields = serialized_data['fields'] - elif 'body' in serialized_data: - _body = serialized_data['body'] - response = self.api_client.call_api( - resource_path=used_path, - method='post'.upper(), - headers=_headers, - fields=_fields, - body=_body, - auth_settings=_auth, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class KeysKeyIdCsrPemPost(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def keys_key_id_csr_pem_post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def keys_key_id_csr_pem_post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def keys_key_id_csr_pem_post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def keys_key_id_csr_pem_post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def keys_key_id_csr_pem_post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._keys_key_id_csr_pem_post_oapg( - body=body, - path_params=path_params, - content_type=content_type, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForpost(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._keys_key_id_csr_pem_post_oapg( - body=body, - path_params=path_params, - content_type=content_type, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - 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 new file mode 100644 index 00000000..e69de29b 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 new file mode 100644 index 00000000..03bbbbcb --- /dev/null +++ b/pynitrokey/nethsm/client/paths/keys_key_id_csr_pem/post/operation.py @@ -0,0 +1,223 @@ +# 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 new file mode 100644 index 00000000..e69de29b 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 new file mode 100644 index 00000000..29e0385b --- /dev/null +++ b/pynitrokey/nethsm/client/paths/keys_key_id_csr_pem/post/parameters/parameter_0/__init__.py @@ -0,0 +1,16 @@ +# 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 new file mode 100644 index 00000000..951e9038 --- /dev/null +++ b/pynitrokey/nethsm/client/paths/keys_key_id_csr_pem/post/parameters/parameter_0/schema.py @@ -0,0 +1,13 @@ +# 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 new file mode 100644 index 00000000..3f0c47bf --- /dev/null +++ b/pynitrokey/nethsm/client/paths/keys_key_id_csr_pem/post/path_parameters.py @@ -0,0 +1,100 @@ +# 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 new file mode 100644 index 00000000..ad29c4a8 --- /dev/null +++ b/pynitrokey/nethsm/client/paths/keys_key_id_csr_pem/post/request_body/__init__.py @@ -0,0 +1,20 @@ +# 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 new file mode 100644 index 00000000..e69de29b 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 new file mode 100644 index 00000000..e69de29b 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 new file mode 100644 index 00000000..500078b6 --- /dev/null +++ b/pynitrokey/nethsm/client/paths/keys_key_id_csr_pem/post/request_body/content/application_json/schema.py @@ -0,0 +1,13 @@ +# 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 new file mode 100644 index 00000000..e69de29b 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 new file mode 100644 index 00000000..9354e71e --- /dev/null +++ b/pynitrokey/nethsm/client/paths/keys_key_id_csr_pem/post/responses/response_200/__init__.py @@ -0,0 +1,29 @@ +# coding: utf-8 + +""" + Generated 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 new file mode 100644 index 00000000..e69de29b 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 new file mode 100644 index 00000000..e69de29b 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 new file mode 100644 index 00000000..dadf2ae9 --- /dev/null +++ b/pynitrokey/nethsm/client/paths/keys_key_id_csr_pem/post/responses/response_200/content/application_x_pem_file/schema.py @@ -0,0 +1,13 @@ +# 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 new file mode 100644 index 00000000..0458793b --- /dev/null +++ b/pynitrokey/nethsm/client/paths/keys_key_id_csr_pem/post/responses/response_400/__init__.py @@ -0,0 +1,20 @@ +# coding: utf-8 + +""" + Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator +""" + +from pynitrokey.nethsm.client.shared_imports.response_imports import * # 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 new file mode 100644 index 00000000..cee35061 --- /dev/null +++ b/pynitrokey/nethsm/client/paths/keys_key_id_csr_pem/post/responses/response_401/__init__.py @@ -0,0 +1,20 @@ +# coding: utf-8 + +""" + Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator +""" + +from pynitrokey.nethsm.client.shared_imports.response_imports import * # 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 new file mode 100644 index 00000000..7bc0249d --- /dev/null +++ b/pynitrokey/nethsm/client/paths/keys_key_id_csr_pem/post/responses/response_403/__init__.py @@ -0,0 +1,20 @@ +# coding: utf-8 + +""" + Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator +""" + +from pynitrokey.nethsm.client.shared_imports.response_imports import * # 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 new file mode 100644 index 00000000..e43c74d8 --- /dev/null +++ b/pynitrokey/nethsm/client/paths/keys_key_id_csr_pem/post/responses/response_404/__init__.py @@ -0,0 +1,20 @@ +# coding: utf-8 + +""" + Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator +""" + +from pynitrokey.nethsm.client.shared_imports.response_imports import * # 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 new file mode 100644 index 00000000..088c436c --- /dev/null +++ b/pynitrokey/nethsm/client/paths/keys_key_id_csr_pem/post/responses/response_406/__init__.py @@ -0,0 +1,20 @@ +# coding: utf-8 + +""" + Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator +""" + +from pynitrokey.nethsm.client.shared_imports.response_imports import * # 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 new file mode 100644 index 00000000..50b6212f --- /dev/null +++ b/pynitrokey/nethsm/client/paths/keys_key_id_csr_pem/post/responses/response_412/__init__.py @@ -0,0 +1,20 @@ +# coding: utf-8 + +""" + Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator +""" + +from pynitrokey.nethsm.client.shared_imports.response_imports import * # 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 new file mode 100644 index 00000000..e69de29b 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 new file mode 100644 index 00000000..f3b60942 --- /dev/null +++ b/pynitrokey/nethsm/client/paths/keys_key_id_csr_pem/post/security/security_requirement_object_0.py @@ -0,0 +1,11 @@ +# 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 index efb09c40..f55549ac 100644 --- a/pynitrokey/nethsm/client/paths/keys_key_id_decrypt/__init__.py +++ b/pynitrokey/nethsm/client/paths/keys_key_id_decrypt/__init__.py @@ -1,7 +1,5 @@ # 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.paths.keys_key_id_decrypt import Api +# from pynitrokey.nethsm.client.apis.paths.keys_key_id_decrypt import KeysKeyIDDecrypt -from pynitrokey.nethsm.client.paths import PathValues - -path = PathValues.KEYS_KEY_ID_DECRYPT \ No newline at end of file +path = "/keys/{KeyID}/decrypt" \ No newline at end of file diff --git a/pynitrokey/nethsm/client/paths/keys_key_id_decrypt/post.py b/pynitrokey/nethsm/client/paths/keys_key_id_decrypt/post.py deleted file mode 100644 index 36a18996..00000000 --- a/pynitrokey/nethsm/client/paths/keys_key_id_decrypt/post.py +++ /dev/null @@ -1,455 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from pynitrokey.nethsm.client import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from pynitrokey.nethsm.client import schemas # noqa: F401 - -from pynitrokey.nethsm.client.model.decrypt_data import DecryptData -from pynitrokey.nethsm.client.model.decrypt_request_data import DecryptRequestData - -from . import path - -# Path params -KeyIDSchema = schemas.StrSchema -RequestRequiredPathParams = typing_extensions.TypedDict( - 'RequestRequiredPathParams', - { - 'KeyID': typing.Union[KeyIDSchema, str, ], - } -) -RequestOptionalPathParams = typing_extensions.TypedDict( - 'RequestOptionalPathParams', - { - }, - total=False -) - - -class RequestPathParams(RequestRequiredPathParams, RequestOptionalPathParams): - pass - - -request_path_key_id = api_client.PathParameter( - name="KeyID", - style=api_client.ParameterStyle.SIMPLE, - schema=KeyIDSchema, - required=True, -) -# body param -SchemaForRequestBodyApplicationJson = DecryptRequestData - - -request_body_decrypt_request_data = api_client.RequestBody( - content={ - 'application/json': api_client.MediaType( - schema=SchemaForRequestBodyApplicationJson), - }, - required=True, -) -_auth = [ - 'basic', -] -SchemaFor200ResponseBodyApplicationJson = DecryptData - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: typing.Union[ - SchemaFor200ResponseBodyApplicationJson, - ] - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, - content={ - 'application/json': api_client.MediaType( - schema=SchemaFor200ResponseBodyApplicationJson), - }, -) - - -@dataclass -class ApiResponseFor400(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_400 = api_client.OpenApiResponse( - response_cls=ApiResponseFor400, -) - - -@dataclass -class ApiResponseFor401(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_401 = api_client.OpenApiResponse( - response_cls=ApiResponseFor401, -) - - -@dataclass -class ApiResponseFor403(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_403 = api_client.OpenApiResponse( - response_cls=ApiResponseFor403, -) - - -@dataclass -class ApiResponseFor404(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_404 = api_client.OpenApiResponse( - response_cls=ApiResponseFor404, -) - - -@dataclass -class ApiResponseFor412(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_412 = api_client.OpenApiResponse( - response_cls=ApiResponseFor412, -) -_status_code_to_response = { - '200': _response_for_200, - '400': _response_for_400, - '401': _response_for_401, - '403': _response_for_403, - '404': _response_for_404, - '412': _response_for_412, -} -_all_accept_content_types = ( - 'application/json', -) - - -class BaseApi(api_client.Api): - @typing.overload - def _keys_key_id_decrypt_post_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _keys_key_id_decrypt_post_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def _keys_key_id_decrypt_post_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _keys_key_id_decrypt_post_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _keys_key_id_decrypt_post_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :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 - """ - self._verify_typed_dict_inputs_oapg(RequestPathParams, path_params) - used_path = path.value - - _path_params = {} - for parameter in ( - request_path_key_id, - ): - parameter_data = path_params.get(parameter.name, schemas.unset) - if parameter_data is schemas.unset: - continue - serialized_data = parameter.serialize(parameter_data) - _path_params.update(serialized_data) - - for k, v in _path_params.items(): - used_path = used_path.replace('{%s}' % k, v) - - _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) - - if body is schemas.unset: - raise exceptions.ApiValueError( - 'The required body parameter has an invalid value of: unset. Set a valid value instead') - _fields = None - _body = None - serialized_data = request_body_decrypt_request_data.serialize(body, content_type) - _headers.add('Content-Type', content_type) - if 'fields' in serialized_data: - _fields = serialized_data['fields'] - elif 'body' in serialized_data: - _body = serialized_data['body'] - response = self.api_client.call_api( - resource_path=used_path, - method='post'.upper(), - headers=_headers, - fields=_fields, - body=_body, - auth_settings=_auth, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class KeysKeyIdDecryptPost(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def keys_key_id_decrypt_post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def keys_key_id_decrypt_post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def keys_key_id_decrypt_post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def keys_key_id_decrypt_post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def keys_key_id_decrypt_post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._keys_key_id_decrypt_post_oapg( - body=body, - path_params=path_params, - content_type=content_type, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForpost(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._keys_key_id_decrypt_post_oapg( - body=body, - path_params=path_params, - content_type=content_type, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/pynitrokey/nethsm/client/paths/keys_key_id_decrypt/post.pyi b/pynitrokey/nethsm/client/paths/keys_key_id_decrypt/post.pyi deleted file mode 100644 index 32b53939..00000000 --- a/pynitrokey/nethsm/client/paths/keys_key_id_decrypt/post.pyi +++ /dev/null @@ -1,442 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from pynitrokey.nethsm.client import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from pynitrokey.nethsm.client import schemas # noqa: F401 - -from pynitrokey.nethsm.client.model.decrypt_data import DecryptData -from pynitrokey.nethsm.client.model.decrypt_request_data import DecryptRequestData - -# Path params -KeyIDSchema = schemas.StrSchema -RequestRequiredPathParams = typing_extensions.TypedDict( - 'RequestRequiredPathParams', - { - 'KeyID': typing.Union[KeyIDSchema, str, ], - } -) -RequestOptionalPathParams = typing_extensions.TypedDict( - 'RequestOptionalPathParams', - { - }, - total=False -) - - -class RequestPathParams(RequestRequiredPathParams, RequestOptionalPathParams): - pass - - -request_path_key_id = api_client.PathParameter( - name="KeyID", - style=api_client.ParameterStyle.SIMPLE, - schema=KeyIDSchema, - required=True, -) -# body param -SchemaForRequestBodyApplicationJson = DecryptRequestData - - -request_body_decrypt_request_data = api_client.RequestBody( - content={ - 'application/json': api_client.MediaType( - schema=SchemaForRequestBodyApplicationJson), - }, - required=True, -) -SchemaFor200ResponseBodyApplicationJson = DecryptData - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: typing.Union[ - SchemaFor200ResponseBodyApplicationJson, - ] - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, - content={ - 'application/json': api_client.MediaType( - schema=SchemaFor200ResponseBodyApplicationJson), - }, -) - - -@dataclass -class ApiResponseFor400(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_400 = api_client.OpenApiResponse( - response_cls=ApiResponseFor400, -) - - -@dataclass -class ApiResponseFor401(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_401 = api_client.OpenApiResponse( - response_cls=ApiResponseFor401, -) - - -@dataclass -class ApiResponseFor403(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_403 = api_client.OpenApiResponse( - response_cls=ApiResponseFor403, -) - - -@dataclass -class ApiResponseFor404(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_404 = api_client.OpenApiResponse( - response_cls=ApiResponseFor404, -) - - -@dataclass -class ApiResponseFor412(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_412 = api_client.OpenApiResponse( - response_cls=ApiResponseFor412, -) -_all_accept_content_types = ( - 'application/json', -) - - -class BaseApi(api_client.Api): - @typing.overload - def _keys_key_id_decrypt_post_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _keys_key_id_decrypt_post_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def _keys_key_id_decrypt_post_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _keys_key_id_decrypt_post_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _keys_key_id_decrypt_post_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :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 - """ - self._verify_typed_dict_inputs_oapg(RequestPathParams, path_params) - used_path = path.value - - _path_params = {} - for parameter in ( - request_path_key_id, - ): - parameter_data = path_params.get(parameter.name, schemas.unset) - if parameter_data is schemas.unset: - continue - serialized_data = parameter.serialize(parameter_data) - _path_params.update(serialized_data) - - for k, v in _path_params.items(): - used_path = used_path.replace('{%s}' % k, v) - - _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) - - if body is schemas.unset: - raise exceptions.ApiValueError( - 'The required body parameter has an invalid value of: unset. Set a valid value instead') - _fields = None - _body = None - serialized_data = request_body_decrypt_request_data.serialize(body, content_type) - _headers.add('Content-Type', content_type) - if 'fields' in serialized_data: - _fields = serialized_data['fields'] - elif 'body' in serialized_data: - _body = serialized_data['body'] - response = self.api_client.call_api( - resource_path=used_path, - method='post'.upper(), - headers=_headers, - fields=_fields, - body=_body, - auth_settings=_auth, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class KeysKeyIdDecryptPost(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def keys_key_id_decrypt_post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def keys_key_id_decrypt_post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def keys_key_id_decrypt_post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def keys_key_id_decrypt_post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def keys_key_id_decrypt_post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._keys_key_id_decrypt_post_oapg( - body=body, - path_params=path_params, - content_type=content_type, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForpost(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._keys_key_id_decrypt_post_oapg( - body=body, - path_params=path_params, - content_type=content_type, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - 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 new file mode 100644 index 00000000..e69de29b 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 new file mode 100644 index 00000000..dcad38a6 --- /dev/null +++ b/pynitrokey/nethsm/client/paths/keys_key_id_decrypt/post/operation.py @@ -0,0 +1,223 @@ +# 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 new file mode 100644 index 00000000..e69de29b 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 new file mode 100644 index 00000000..29e0385b --- /dev/null +++ b/pynitrokey/nethsm/client/paths/keys_key_id_decrypt/post/parameters/parameter_0/__init__.py @@ -0,0 +1,16 @@ +# 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 new file mode 100644 index 00000000..951e9038 --- /dev/null +++ b/pynitrokey/nethsm/client/paths/keys_key_id_decrypt/post/parameters/parameter_0/schema.py @@ -0,0 +1,13 @@ +# 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 new file mode 100644 index 00000000..d864052c --- /dev/null +++ b/pynitrokey/nethsm/client/paths/keys_key_id_decrypt/post/path_parameters.py @@ -0,0 +1,100 @@ +# 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 new file mode 100644 index 00000000..ad29c4a8 --- /dev/null +++ b/pynitrokey/nethsm/client/paths/keys_key_id_decrypt/post/request_body/__init__.py @@ -0,0 +1,20 @@ +# 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 new file mode 100644 index 00000000..e69de29b 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 new file mode 100644 index 00000000..e69de29b 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 new file mode 100644 index 00000000..8fc31244 --- /dev/null +++ b/pynitrokey/nethsm/client/paths/keys_key_id_decrypt/post/request_body/content/application_json/schema.py @@ -0,0 +1,13 @@ +# 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 new file mode 100644 index 00000000..e69de29b 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 new file mode 100644 index 00000000..08652f9e --- /dev/null +++ b/pynitrokey/nethsm/client/paths/keys_key_id_decrypt/post/responses/response_200/__init__.py @@ -0,0 +1,29 @@ +# coding: utf-8 + +""" + Generated 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 new file mode 100644 index 00000000..e69de29b 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 new file mode 100644 index 00000000..e69de29b 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 new file mode 100644 index 00000000..f57a6fec --- /dev/null +++ b/pynitrokey/nethsm/client/paths/keys_key_id_decrypt/post/responses/response_200/content/application_json/schema.py @@ -0,0 +1,13 @@ +# 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 new file mode 100644 index 00000000..0458793b --- /dev/null +++ b/pynitrokey/nethsm/client/paths/keys_key_id_decrypt/post/responses/response_400/__init__.py @@ -0,0 +1,20 @@ +# coding: utf-8 + +""" + Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator +""" + +from pynitrokey.nethsm.client.shared_imports.response_imports import * # 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 new file mode 100644 index 00000000..cee35061 --- /dev/null +++ b/pynitrokey/nethsm/client/paths/keys_key_id_decrypt/post/responses/response_401/__init__.py @@ -0,0 +1,20 @@ +# coding: utf-8 + +""" + Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator +""" + +from pynitrokey.nethsm.client.shared_imports.response_imports import * # 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 new file mode 100644 index 00000000..7bc0249d --- /dev/null +++ b/pynitrokey/nethsm/client/paths/keys_key_id_decrypt/post/responses/response_403/__init__.py @@ -0,0 +1,20 @@ +# coding: utf-8 + +""" + Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator +""" + +from pynitrokey.nethsm.client.shared_imports.response_imports import * # 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 new file mode 100644 index 00000000..e43c74d8 --- /dev/null +++ b/pynitrokey/nethsm/client/paths/keys_key_id_decrypt/post/responses/response_404/__init__.py @@ -0,0 +1,20 @@ +# coding: utf-8 + +""" + Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator +""" + +from pynitrokey.nethsm.client.shared_imports.response_imports import * # 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 new file mode 100644 index 00000000..088c436c --- /dev/null +++ b/pynitrokey/nethsm/client/paths/keys_key_id_decrypt/post/responses/response_406/__init__.py @@ -0,0 +1,20 @@ +# coding: utf-8 + +""" + Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator +""" + +from pynitrokey.nethsm.client.shared_imports.response_imports import * # 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 new file mode 100644 index 00000000..50b6212f --- /dev/null +++ b/pynitrokey/nethsm/client/paths/keys_key_id_decrypt/post/responses/response_412/__init__.py @@ -0,0 +1,20 @@ +# coding: utf-8 + +""" + Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator +""" + +from pynitrokey.nethsm.client.shared_imports.response_imports import * # 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 new file mode 100644 index 00000000..e69de29b 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 new file mode 100644 index 00000000..f3b60942 --- /dev/null +++ b/pynitrokey/nethsm/client/paths/keys_key_id_decrypt/post/security/security_requirement_object_0.py @@ -0,0 +1,11 @@ +# 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 index fe34d662..ffcde5b3 100644 --- a/pynitrokey/nethsm/client/paths/keys_key_id_encrypt/__init__.py +++ b/pynitrokey/nethsm/client/paths/keys_key_id_encrypt/__init__.py @@ -1,7 +1,5 @@ # 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.paths.keys_key_id_encrypt import Api +# from pynitrokey.nethsm.client.apis.paths.keys_key_id_encrypt import KeysKeyIDEncrypt -from pynitrokey.nethsm.client.paths import PathValues - -path = PathValues.KEYS_KEY_ID_ENCRYPT \ No newline at end of file +path = "/keys/{KeyID}/encrypt" \ No newline at end of file diff --git a/pynitrokey/nethsm/client/paths/keys_key_id_encrypt/post.py b/pynitrokey/nethsm/client/paths/keys_key_id_encrypt/post.py deleted file mode 100644 index 38fb99e9..00000000 --- a/pynitrokey/nethsm/client/paths/keys_key_id_encrypt/post.py +++ /dev/null @@ -1,455 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from pynitrokey.nethsm.client import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from pynitrokey.nethsm.client import schemas # noqa: F401 - -from pynitrokey.nethsm.client.model.encrypt_request_data import EncryptRequestData -from pynitrokey.nethsm.client.model.encrypt_data import EncryptData - -from . import path - -# Path params -KeyIDSchema = schemas.StrSchema -RequestRequiredPathParams = typing_extensions.TypedDict( - 'RequestRequiredPathParams', - { - 'KeyID': typing.Union[KeyIDSchema, str, ], - } -) -RequestOptionalPathParams = typing_extensions.TypedDict( - 'RequestOptionalPathParams', - { - }, - total=False -) - - -class RequestPathParams(RequestRequiredPathParams, RequestOptionalPathParams): - pass - - -request_path_key_id = api_client.PathParameter( - name="KeyID", - style=api_client.ParameterStyle.SIMPLE, - schema=KeyIDSchema, - required=True, -) -# body param -SchemaForRequestBodyApplicationJson = EncryptRequestData - - -request_body_encrypt_request_data = api_client.RequestBody( - content={ - 'application/json': api_client.MediaType( - schema=SchemaForRequestBodyApplicationJson), - }, - required=True, -) -_auth = [ - 'basic', -] -SchemaFor200ResponseBodyApplicationJson = EncryptData - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: typing.Union[ - SchemaFor200ResponseBodyApplicationJson, - ] - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, - content={ - 'application/json': api_client.MediaType( - schema=SchemaFor200ResponseBodyApplicationJson), - }, -) - - -@dataclass -class ApiResponseFor400(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_400 = api_client.OpenApiResponse( - response_cls=ApiResponseFor400, -) - - -@dataclass -class ApiResponseFor401(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_401 = api_client.OpenApiResponse( - response_cls=ApiResponseFor401, -) - - -@dataclass -class ApiResponseFor403(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_403 = api_client.OpenApiResponse( - response_cls=ApiResponseFor403, -) - - -@dataclass -class ApiResponseFor404(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_404 = api_client.OpenApiResponse( - response_cls=ApiResponseFor404, -) - - -@dataclass -class ApiResponseFor412(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_412 = api_client.OpenApiResponse( - response_cls=ApiResponseFor412, -) -_status_code_to_response = { - '200': _response_for_200, - '400': _response_for_400, - '401': _response_for_401, - '403': _response_for_403, - '404': _response_for_404, - '412': _response_for_412, -} -_all_accept_content_types = ( - 'application/json', -) - - -class BaseApi(api_client.Api): - @typing.overload - def _keys_key_id_encrypt_post_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _keys_key_id_encrypt_post_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def _keys_key_id_encrypt_post_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _keys_key_id_encrypt_post_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _keys_key_id_encrypt_post_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :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 - """ - self._verify_typed_dict_inputs_oapg(RequestPathParams, path_params) - used_path = path.value - - _path_params = {} - for parameter in ( - request_path_key_id, - ): - parameter_data = path_params.get(parameter.name, schemas.unset) - if parameter_data is schemas.unset: - continue - serialized_data = parameter.serialize(parameter_data) - _path_params.update(serialized_data) - - for k, v in _path_params.items(): - used_path = used_path.replace('{%s}' % k, v) - - _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) - - if body is schemas.unset: - raise exceptions.ApiValueError( - 'The required body parameter has an invalid value of: unset. Set a valid value instead') - _fields = None - _body = None - serialized_data = request_body_encrypt_request_data.serialize(body, content_type) - _headers.add('Content-Type', content_type) - if 'fields' in serialized_data: - _fields = serialized_data['fields'] - elif 'body' in serialized_data: - _body = serialized_data['body'] - response = self.api_client.call_api( - resource_path=used_path, - method='post'.upper(), - headers=_headers, - fields=_fields, - body=_body, - auth_settings=_auth, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class KeysKeyIdEncryptPost(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def keys_key_id_encrypt_post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def keys_key_id_encrypt_post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def keys_key_id_encrypt_post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def keys_key_id_encrypt_post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def keys_key_id_encrypt_post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._keys_key_id_encrypt_post_oapg( - body=body, - path_params=path_params, - content_type=content_type, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForpost(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._keys_key_id_encrypt_post_oapg( - body=body, - path_params=path_params, - content_type=content_type, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/pynitrokey/nethsm/client/paths/keys_key_id_encrypt/post.pyi b/pynitrokey/nethsm/client/paths/keys_key_id_encrypt/post.pyi deleted file mode 100644 index a65a4b86..00000000 --- a/pynitrokey/nethsm/client/paths/keys_key_id_encrypt/post.pyi +++ /dev/null @@ -1,442 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from pynitrokey.nethsm.client import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from pynitrokey.nethsm.client import schemas # noqa: F401 - -from pynitrokey.nethsm.client.model.encrypt_request_data import EncryptRequestData -from pynitrokey.nethsm.client.model.encrypt_data import EncryptData - -# Path params -KeyIDSchema = schemas.StrSchema -RequestRequiredPathParams = typing_extensions.TypedDict( - 'RequestRequiredPathParams', - { - 'KeyID': typing.Union[KeyIDSchema, str, ], - } -) -RequestOptionalPathParams = typing_extensions.TypedDict( - 'RequestOptionalPathParams', - { - }, - total=False -) - - -class RequestPathParams(RequestRequiredPathParams, RequestOptionalPathParams): - pass - - -request_path_key_id = api_client.PathParameter( - name="KeyID", - style=api_client.ParameterStyle.SIMPLE, - schema=KeyIDSchema, - required=True, -) -# body param -SchemaForRequestBodyApplicationJson = EncryptRequestData - - -request_body_encrypt_request_data = api_client.RequestBody( - content={ - 'application/json': api_client.MediaType( - schema=SchemaForRequestBodyApplicationJson), - }, - required=True, -) -SchemaFor200ResponseBodyApplicationJson = EncryptData - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: typing.Union[ - SchemaFor200ResponseBodyApplicationJson, - ] - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, - content={ - 'application/json': api_client.MediaType( - schema=SchemaFor200ResponseBodyApplicationJson), - }, -) - - -@dataclass -class ApiResponseFor400(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_400 = api_client.OpenApiResponse( - response_cls=ApiResponseFor400, -) - - -@dataclass -class ApiResponseFor401(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_401 = api_client.OpenApiResponse( - response_cls=ApiResponseFor401, -) - - -@dataclass -class ApiResponseFor403(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_403 = api_client.OpenApiResponse( - response_cls=ApiResponseFor403, -) - - -@dataclass -class ApiResponseFor404(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_404 = api_client.OpenApiResponse( - response_cls=ApiResponseFor404, -) - - -@dataclass -class ApiResponseFor412(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_412 = api_client.OpenApiResponse( - response_cls=ApiResponseFor412, -) -_all_accept_content_types = ( - 'application/json', -) - - -class BaseApi(api_client.Api): - @typing.overload - def _keys_key_id_encrypt_post_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _keys_key_id_encrypt_post_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def _keys_key_id_encrypt_post_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _keys_key_id_encrypt_post_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _keys_key_id_encrypt_post_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :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 - """ - self._verify_typed_dict_inputs_oapg(RequestPathParams, path_params) - used_path = path.value - - _path_params = {} - for parameter in ( - request_path_key_id, - ): - parameter_data = path_params.get(parameter.name, schemas.unset) - if parameter_data is schemas.unset: - continue - serialized_data = parameter.serialize(parameter_data) - _path_params.update(serialized_data) - - for k, v in _path_params.items(): - used_path = used_path.replace('{%s}' % k, v) - - _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) - - if body is schemas.unset: - raise exceptions.ApiValueError( - 'The required body parameter has an invalid value of: unset. Set a valid value instead') - _fields = None - _body = None - serialized_data = request_body_encrypt_request_data.serialize(body, content_type) - _headers.add('Content-Type', content_type) - if 'fields' in serialized_data: - _fields = serialized_data['fields'] - elif 'body' in serialized_data: - _body = serialized_data['body'] - response = self.api_client.call_api( - resource_path=used_path, - method='post'.upper(), - headers=_headers, - fields=_fields, - body=_body, - auth_settings=_auth, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class KeysKeyIdEncryptPost(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def keys_key_id_encrypt_post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def keys_key_id_encrypt_post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def keys_key_id_encrypt_post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def keys_key_id_encrypt_post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def keys_key_id_encrypt_post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._keys_key_id_encrypt_post_oapg( - body=body, - path_params=path_params, - content_type=content_type, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForpost(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._keys_key_id_encrypt_post_oapg( - body=body, - path_params=path_params, - content_type=content_type, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - 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 new file mode 100644 index 00000000..e69de29b 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 new file mode 100644 index 00000000..650e434a --- /dev/null +++ b/pynitrokey/nethsm/client/paths/keys_key_id_encrypt/post/operation.py @@ -0,0 +1,223 @@ +# 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 new file mode 100644 index 00000000..e69de29b 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 new file mode 100644 index 00000000..29e0385b --- /dev/null +++ b/pynitrokey/nethsm/client/paths/keys_key_id_encrypt/post/parameters/parameter_0/__init__.py @@ -0,0 +1,16 @@ +# 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 new file mode 100644 index 00000000..951e9038 --- /dev/null +++ b/pynitrokey/nethsm/client/paths/keys_key_id_encrypt/post/parameters/parameter_0/schema.py @@ -0,0 +1,13 @@ +# 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 new file mode 100644 index 00000000..2e93a97b --- /dev/null +++ b/pynitrokey/nethsm/client/paths/keys_key_id_encrypt/post/path_parameters.py @@ -0,0 +1,100 @@ +# 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 new file mode 100644 index 00000000..ad29c4a8 --- /dev/null +++ b/pynitrokey/nethsm/client/paths/keys_key_id_encrypt/post/request_body/__init__.py @@ -0,0 +1,20 @@ +# 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 new file mode 100644 index 00000000..e69de29b 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 new file mode 100644 index 00000000..e69de29b 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 new file mode 100644 index 00000000..4d496175 --- /dev/null +++ b/pynitrokey/nethsm/client/paths/keys_key_id_encrypt/post/request_body/content/application_json/schema.py @@ -0,0 +1,13 @@ +# 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 new file mode 100644 index 00000000..e69de29b 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 new file mode 100644 index 00000000..f7309ebd --- /dev/null +++ b/pynitrokey/nethsm/client/paths/keys_key_id_encrypt/post/responses/response_200/__init__.py @@ -0,0 +1,29 @@ +# coding: utf-8 + +""" + Generated 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 new file mode 100644 index 00000000..e69de29b 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 new file mode 100644 index 00000000..e69de29b 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 new file mode 100644 index 00000000..a2d5fc49 --- /dev/null +++ b/pynitrokey/nethsm/client/paths/keys_key_id_encrypt/post/responses/response_200/content/application_json/schema.py @@ -0,0 +1,13 @@ +# 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 new file mode 100644 index 00000000..0458793b --- /dev/null +++ b/pynitrokey/nethsm/client/paths/keys_key_id_encrypt/post/responses/response_400/__init__.py @@ -0,0 +1,20 @@ +# coding: utf-8 + +""" + Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator +""" + +from pynitrokey.nethsm.client.shared_imports.response_imports import * # 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 new file mode 100644 index 00000000..cee35061 --- /dev/null +++ b/pynitrokey/nethsm/client/paths/keys_key_id_encrypt/post/responses/response_401/__init__.py @@ -0,0 +1,20 @@ +# coding: utf-8 + +""" + Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator +""" + +from pynitrokey.nethsm.client.shared_imports.response_imports import * # 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 new file mode 100644 index 00000000..7bc0249d --- /dev/null +++ b/pynitrokey/nethsm/client/paths/keys_key_id_encrypt/post/responses/response_403/__init__.py @@ -0,0 +1,20 @@ +# coding: utf-8 + +""" + Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator +""" + +from pynitrokey.nethsm.client.shared_imports.response_imports import * # 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 new file mode 100644 index 00000000..e43c74d8 --- /dev/null +++ b/pynitrokey/nethsm/client/paths/keys_key_id_encrypt/post/responses/response_404/__init__.py @@ -0,0 +1,20 @@ +# coding: utf-8 + +""" + Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator +""" + +from pynitrokey.nethsm.client.shared_imports.response_imports import * # 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 new file mode 100644 index 00000000..088c436c --- /dev/null +++ b/pynitrokey/nethsm/client/paths/keys_key_id_encrypt/post/responses/response_406/__init__.py @@ -0,0 +1,20 @@ +# coding: utf-8 + +""" + Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator +""" + +from pynitrokey.nethsm.client.shared_imports.response_imports import * # 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 new file mode 100644 index 00000000..50b6212f --- /dev/null +++ b/pynitrokey/nethsm/client/paths/keys_key_id_encrypt/post/responses/response_412/__init__.py @@ -0,0 +1,20 @@ +# coding: utf-8 + +""" + Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator +""" + +from pynitrokey.nethsm.client.shared_imports.response_imports import * # 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 new file mode 100644 index 00000000..e69de29b 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 new file mode 100644 index 00000000..f3b60942 --- /dev/null +++ b/pynitrokey/nethsm/client/paths/keys_key_id_encrypt/post/security/security_requirement_object_0.py @@ -0,0 +1,11 @@ +# 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 index 1a50d49b..608b4298 100644 --- a/pynitrokey/nethsm/client/paths/keys_key_id_public_pem/__init__.py +++ b/pynitrokey/nethsm/client/paths/keys_key_id_public_pem/__init__.py @@ -1,7 +1,5 @@ # 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.paths.keys_key_id_public_pem import Api +# from pynitrokey.nethsm.client.apis.paths.keys_key_id_public_pem import KeysKeyIDPublicPem -from pynitrokey.nethsm.client.paths import PathValues - -path = PathValues.KEYS_KEY_ID_PUBLIC_PEM \ No newline at end of file +path = "/keys/{KeyID}/public.pem" \ No newline at end of file diff --git a/pynitrokey/nethsm/client/paths/keys_key_id_public_pem/get.py b/pynitrokey/nethsm/client/paths/keys_key_id_public_pem/get.py deleted file mode 100644 index 4ca6dbd7..00000000 --- a/pynitrokey/nethsm/client/paths/keys_key_id_public_pem/get.py +++ /dev/null @@ -1,342 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from pynitrokey.nethsm.client import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from pynitrokey.nethsm.client import schemas # noqa: F401 - -from . import path - -# Path params -KeyIDSchema = schemas.StrSchema -RequestRequiredPathParams = typing_extensions.TypedDict( - 'RequestRequiredPathParams', - { - 'KeyID': typing.Union[KeyIDSchema, str, ], - } -) -RequestOptionalPathParams = typing_extensions.TypedDict( - 'RequestOptionalPathParams', - { - }, - total=False -) - - -class RequestPathParams(RequestRequiredPathParams, RequestOptionalPathParams): - pass - - -request_path_key_id = api_client.PathParameter( - name="KeyID", - style=api_client.ParameterStyle.SIMPLE, - schema=KeyIDSchema, - required=True, -) -_auth = [ - 'basic', -] -SchemaFor200ResponseBodyApplicationXPemFile = schemas.StrSchema - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: typing.Union[ - SchemaFor200ResponseBodyApplicationXPemFile, - ] - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, - content={ - 'application/x-pem-file': api_client.MediaType( - schema=SchemaFor200ResponseBodyApplicationXPemFile), - }, -) - - -@dataclass -class ApiResponseFor401(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_401 = api_client.OpenApiResponse( - response_cls=ApiResponseFor401, -) - - -@dataclass -class ApiResponseFor403(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_403 = api_client.OpenApiResponse( - response_cls=ApiResponseFor403, -) - - -@dataclass -class ApiResponseFor404(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_404 = api_client.OpenApiResponse( - response_cls=ApiResponseFor404, -) - - -@dataclass -class ApiResponseFor412(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_412 = api_client.OpenApiResponse( - response_cls=ApiResponseFor412, -) -_status_code_to_response = { - '200': _response_for_200, - '401': _response_for_401, - '403': _response_for_403, - '404': _response_for_404, - '412': _response_for_412, -} -_all_accept_content_types = ( - 'application/x-pem-file', -) - - -class BaseApi(api_client.Api): - @typing.overload - def _keys_key_id_public_pem_get_oapg( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _keys_key_id_public_pem_get_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _keys_key_id_public_pem_get_oapg( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _keys_key_id_public_pem_get_oapg( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :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 - """ - self._verify_typed_dict_inputs_oapg(RequestPathParams, path_params) - used_path = path.value - - _path_params = {} - for parameter in ( - request_path_key_id, - ): - parameter_data = path_params.get(parameter.name, schemas.unset) - if parameter_data is schemas.unset: - continue - serialized_data = parameter.serialize(parameter_data) - _path_params.update(serialized_data) - - for k, v in _path_params.items(): - used_path = used_path.replace('{%s}' % k, v) - - _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) - - response = self.api_client.call_api( - resource_path=used_path, - method='get'.upper(), - headers=_headers, - auth_settings=_auth, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class KeysKeyIdPublicPemGet(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def keys_key_id_public_pem_get( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def keys_key_id_public_pem_get( - self, - skip_deserialization: typing_extensions.Literal[True], - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def keys_key_id_public_pem_get( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def keys_key_id_public_pem_get( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._keys_key_id_public_pem_get_oapg( - path_params=path_params, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForget(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def get( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def get( - self, - skip_deserialization: typing_extensions.Literal[True], - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def get( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def get( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._keys_key_id_public_pem_get_oapg( - path_params=path_params, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/pynitrokey/nethsm/client/paths/keys_key_id_public_pem/get.pyi b/pynitrokey/nethsm/client/paths/keys_key_id_public_pem/get.pyi deleted file mode 100644 index f2da700a..00000000 --- a/pynitrokey/nethsm/client/paths/keys_key_id_public_pem/get.pyi +++ /dev/null @@ -1,330 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from pynitrokey.nethsm.client import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from pynitrokey.nethsm.client import schemas # noqa: F401 - -# Path params -KeyIDSchema = schemas.StrSchema -RequestRequiredPathParams = typing_extensions.TypedDict( - 'RequestRequiredPathParams', - { - 'KeyID': typing.Union[KeyIDSchema, str, ], - } -) -RequestOptionalPathParams = typing_extensions.TypedDict( - 'RequestOptionalPathParams', - { - }, - total=False -) - - -class RequestPathParams(RequestRequiredPathParams, RequestOptionalPathParams): - pass - - -request_path_key_id = api_client.PathParameter( - name="KeyID", - style=api_client.ParameterStyle.SIMPLE, - schema=KeyIDSchema, - required=True, -) -SchemaFor200ResponseBodyApplicationXPemFile = schemas.StrSchema - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: typing.Union[ - SchemaFor200ResponseBodyApplicationXPemFile, - ] - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, - content={ - 'application/x-pem-file': api_client.MediaType( - schema=SchemaFor200ResponseBodyApplicationXPemFile), - }, -) - - -@dataclass -class ApiResponseFor401(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_401 = api_client.OpenApiResponse( - response_cls=ApiResponseFor401, -) - - -@dataclass -class ApiResponseFor403(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_403 = api_client.OpenApiResponse( - response_cls=ApiResponseFor403, -) - - -@dataclass -class ApiResponseFor404(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_404 = api_client.OpenApiResponse( - response_cls=ApiResponseFor404, -) - - -@dataclass -class ApiResponseFor412(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_412 = api_client.OpenApiResponse( - response_cls=ApiResponseFor412, -) -_all_accept_content_types = ( - 'application/x-pem-file', -) - - -class BaseApi(api_client.Api): - @typing.overload - def _keys_key_id_public_pem_get_oapg( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _keys_key_id_public_pem_get_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _keys_key_id_public_pem_get_oapg( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _keys_key_id_public_pem_get_oapg( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :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 - """ - self._verify_typed_dict_inputs_oapg(RequestPathParams, path_params) - used_path = path.value - - _path_params = {} - for parameter in ( - request_path_key_id, - ): - parameter_data = path_params.get(parameter.name, schemas.unset) - if parameter_data is schemas.unset: - continue - serialized_data = parameter.serialize(parameter_data) - _path_params.update(serialized_data) - - for k, v in _path_params.items(): - used_path = used_path.replace('{%s}' % k, v) - - _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) - - response = self.api_client.call_api( - resource_path=used_path, - method='get'.upper(), - headers=_headers, - auth_settings=_auth, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class KeysKeyIdPublicPemGet(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def keys_key_id_public_pem_get( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def keys_key_id_public_pem_get( - self, - skip_deserialization: typing_extensions.Literal[True], - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def keys_key_id_public_pem_get( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def keys_key_id_public_pem_get( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._keys_key_id_public_pem_get_oapg( - path_params=path_params, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForget(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def get( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def get( - self, - skip_deserialization: typing_extensions.Literal[True], - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def get( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def get( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._keys_key_id_public_pem_get_oapg( - path_params=path_params, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - 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 new file mode 100644 index 00000000..e69de29b 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 new file mode 100644 index 00000000..02468708 --- /dev/null +++ b/pynitrokey/nethsm/client/paths/keys_key_id_public_pem/get/operation.py @@ -0,0 +1,197 @@ +# 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 new file mode 100644 index 00000000..e69de29b 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 new file mode 100644 index 00000000..29e0385b --- /dev/null +++ b/pynitrokey/nethsm/client/paths/keys_key_id_public_pem/get/parameters/parameter_0/__init__.py @@ -0,0 +1,16 @@ +# 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 new file mode 100644 index 00000000..951e9038 --- /dev/null +++ b/pynitrokey/nethsm/client/paths/keys_key_id_public_pem/get/parameters/parameter_0/schema.py @@ -0,0 +1,13 @@ +# 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 new file mode 100644 index 00000000..8c57d6bc --- /dev/null +++ b/pynitrokey/nethsm/client/paths/keys_key_id_public_pem/get/path_parameters.py @@ -0,0 +1,100 @@ +# 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 new file mode 100644 index 00000000..e69de29b 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 new file mode 100644 index 00000000..9354e71e --- /dev/null +++ b/pynitrokey/nethsm/client/paths/keys_key_id_public_pem/get/responses/response_200/__init__.py @@ -0,0 +1,29 @@ +# coding: utf-8 + +""" + Generated 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 new file mode 100644 index 00000000..e69de29b 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 new file mode 100644 index 00000000..e69de29b 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 new file mode 100644 index 00000000..82e35dcd --- /dev/null +++ b/pynitrokey/nethsm/client/paths/keys_key_id_public_pem/get/responses/response_200/content/application_x_pem_file/schema.py @@ -0,0 +1,13 @@ +# 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 new file mode 100644 index 00000000..0458793b --- /dev/null +++ b/pynitrokey/nethsm/client/paths/keys_key_id_public_pem/get/responses/response_400/__init__.py @@ -0,0 +1,20 @@ +# coding: utf-8 + +""" + Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator +""" + +from pynitrokey.nethsm.client.shared_imports.response_imports import * # 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 new file mode 100644 index 00000000..cee35061 --- /dev/null +++ b/pynitrokey/nethsm/client/paths/keys_key_id_public_pem/get/responses/response_401/__init__.py @@ -0,0 +1,20 @@ +# coding: utf-8 + +""" + Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator +""" + +from pynitrokey.nethsm.client.shared_imports.response_imports import * # 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 new file mode 100644 index 00000000..7bc0249d --- /dev/null +++ b/pynitrokey/nethsm/client/paths/keys_key_id_public_pem/get/responses/response_403/__init__.py @@ -0,0 +1,20 @@ +# coding: utf-8 + +""" + Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator +""" + +from pynitrokey.nethsm.client.shared_imports.response_imports import * # 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 new file mode 100644 index 00000000..e43c74d8 --- /dev/null +++ b/pynitrokey/nethsm/client/paths/keys_key_id_public_pem/get/responses/response_404/__init__.py @@ -0,0 +1,20 @@ +# coding: utf-8 + +""" + Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator +""" + +from pynitrokey.nethsm.client.shared_imports.response_imports import * # 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 new file mode 100644 index 00000000..088c436c --- /dev/null +++ b/pynitrokey/nethsm/client/paths/keys_key_id_public_pem/get/responses/response_406/__init__.py @@ -0,0 +1,20 @@ +# coding: utf-8 + +""" + Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator +""" + +from pynitrokey.nethsm.client.shared_imports.response_imports import * # 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 new file mode 100644 index 00000000..50b6212f --- /dev/null +++ b/pynitrokey/nethsm/client/paths/keys_key_id_public_pem/get/responses/response_412/__init__.py @@ -0,0 +1,20 @@ +# coding: utf-8 + +""" + Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator +""" + +from pynitrokey.nethsm.client.shared_imports.response_imports import * # 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 new file mode 100644 index 00000000..e69de29b 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 new file mode 100644 index 00000000..f3b60942 --- /dev/null +++ b/pynitrokey/nethsm/client/paths/keys_key_id_public_pem/get/security/security_requirement_object_0.py @@ -0,0 +1,11 @@ +# 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 index 1d2889b9..0a6330fe 100644 --- 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 @@ -1,7 +1,5 @@ # 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.paths.keys_key_id_restrictions_tags_tag import Api +# from pynitrokey.nethsm.client.apis.paths.keys_key_id_restrictions_tags_tag import KeysKeyIDRestrictionsTagsTag -from pynitrokey.nethsm.client.paths import PathValues - -path = PathValues.KEYS_KEY_ID_RESTRICTIONS_TAGS_TAG \ No newline at end of file +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.py b/pynitrokey/nethsm/client/paths/keys_key_id_restrictions_tags_tag/delete.py deleted file mode 100644 index 8c7289dd..00000000 --- a/pynitrokey/nethsm/client/paths/keys_key_id_restrictions_tags_tag/delete.py +++ /dev/null @@ -1,320 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 - -from pynitrokey.nethsm.client import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from pynitrokey.nethsm.client import schemas # noqa: F401 - -from . import path - -# Path params -TagSchema = schemas.StrSchema -KeyIDSchema = schemas.StrSchema -RequestRequiredPathParams = typing_extensions.TypedDict( - 'RequestRequiredPathParams', - { - 'Tag': typing.Union[TagSchema, str, ], - 'KeyID': typing.Union[KeyIDSchema, str, ], - } -) -RequestOptionalPathParams = typing_extensions.TypedDict( - 'RequestOptionalPathParams', - { - }, - total=False -) - - -class RequestPathParams(RequestRequiredPathParams, RequestOptionalPathParams): - pass - - -request_path_tag = api_client.PathParameter( - name="Tag", - style=api_client.ParameterStyle.SIMPLE, - schema=TagSchema, - required=True, -) -request_path_key_id = api_client.PathParameter( - name="KeyID", - style=api_client.ParameterStyle.SIMPLE, - schema=KeyIDSchema, - required=True, -) -_auth = [ - 'basic', -] - - -@dataclass -class ApiResponseFor204(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_204 = api_client.OpenApiResponse( - response_cls=ApiResponseFor204, -) - - -@dataclass -class ApiResponseFor401(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_401 = api_client.OpenApiResponse( - response_cls=ApiResponseFor401, -) - - -@dataclass -class ApiResponseFor403(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_403 = api_client.OpenApiResponse( - response_cls=ApiResponseFor403, -) - - -@dataclass -class ApiResponseFor404(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_404 = api_client.OpenApiResponse( - response_cls=ApiResponseFor404, -) - - -@dataclass -class ApiResponseFor412(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_412 = api_client.OpenApiResponse( - response_cls=ApiResponseFor412, -) -_status_code_to_response = { - '204': _response_for_204, - '401': _response_for_401, - '403': _response_for_403, - '404': _response_for_404, - '412': _response_for_412, -} - - -class BaseApi(api_client.Api): - @typing.overload - def _keys_key_id_restrictions_tags_tag_delete_oapg( - self, - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor204, - ]: ... - - @typing.overload - def _keys_key_id_restrictions_tags_tag_delete_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _keys_key_id_restrictions_tags_tag_delete_oapg( - self, - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor204, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _keys_key_id_restrictions_tags_tag_delete_oapg( - self, - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :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 - """ - self._verify_typed_dict_inputs_oapg(RequestPathParams, path_params) - used_path = path.value - - _path_params = {} - for parameter in ( - request_path_tag, - request_path_key_id, - ): - parameter_data = path_params.get(parameter.name, schemas.unset) - if parameter_data is schemas.unset: - continue - serialized_data = parameter.serialize(parameter_data) - _path_params.update(serialized_data) - - for k, v in _path_params.items(): - used_path = used_path.replace('{%s}' % k, v) - # TODO add cookie handling - - response = self.api_client.call_api( - resource_path=used_path, - method='delete'.upper(), - auth_settings=_auth, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class KeysKeyIdRestrictionsTagsTagDelete(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def keys_key_id_restrictions_tags_tag_delete( - self, - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor204, - ]: ... - - @typing.overload - def keys_key_id_restrictions_tags_tag_delete( - self, - skip_deserialization: typing_extensions.Literal[True], - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def keys_key_id_restrictions_tags_tag_delete( - self, - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor204, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def keys_key_id_restrictions_tags_tag_delete( - self, - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._keys_key_id_restrictions_tags_tag_delete_oapg( - path_params=path_params, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiFordelete(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def delete( - self, - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor204, - ]: ... - - @typing.overload - def delete( - self, - skip_deserialization: typing_extensions.Literal[True], - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def delete( - self, - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor204, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def delete( - self, - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._keys_key_id_restrictions_tags_tag_delete_oapg( - path_params=path_params, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/pynitrokey/nethsm/client/paths/keys_key_id_restrictions_tags_tag/delete.pyi b/pynitrokey/nethsm/client/paths/keys_key_id_restrictions_tags_tag/delete.pyi deleted file mode 100644 index 9cc9b3e8..00000000 --- a/pynitrokey/nethsm/client/paths/keys_key_id_restrictions_tags_tag/delete.pyi +++ /dev/null @@ -1,308 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 - -from pynitrokey.nethsm.client import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from pynitrokey.nethsm.client import schemas # noqa: F401 - -# Path params -TagSchema = schemas.StrSchema -KeyIDSchema = schemas.StrSchema -RequestRequiredPathParams = typing_extensions.TypedDict( - 'RequestRequiredPathParams', - { - 'Tag': typing.Union[TagSchema, str, ], - 'KeyID': typing.Union[KeyIDSchema, str, ], - } -) -RequestOptionalPathParams = typing_extensions.TypedDict( - 'RequestOptionalPathParams', - { - }, - total=False -) - - -class RequestPathParams(RequestRequiredPathParams, RequestOptionalPathParams): - pass - - -request_path_tag = api_client.PathParameter( - name="Tag", - style=api_client.ParameterStyle.SIMPLE, - schema=TagSchema, - required=True, -) -request_path_key_id = api_client.PathParameter( - name="KeyID", - style=api_client.ParameterStyle.SIMPLE, - schema=KeyIDSchema, - required=True, -) - - -@dataclass -class ApiResponseFor204(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_204 = api_client.OpenApiResponse( - response_cls=ApiResponseFor204, -) - - -@dataclass -class ApiResponseFor401(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_401 = api_client.OpenApiResponse( - response_cls=ApiResponseFor401, -) - - -@dataclass -class ApiResponseFor403(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_403 = api_client.OpenApiResponse( - response_cls=ApiResponseFor403, -) - - -@dataclass -class ApiResponseFor404(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_404 = api_client.OpenApiResponse( - response_cls=ApiResponseFor404, -) - - -@dataclass -class ApiResponseFor412(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_412 = api_client.OpenApiResponse( - response_cls=ApiResponseFor412, -) - - -class BaseApi(api_client.Api): - @typing.overload - def _keys_key_id_restrictions_tags_tag_delete_oapg( - self, - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor204, - ]: ... - - @typing.overload - def _keys_key_id_restrictions_tags_tag_delete_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _keys_key_id_restrictions_tags_tag_delete_oapg( - self, - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor204, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _keys_key_id_restrictions_tags_tag_delete_oapg( - self, - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :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 - """ - self._verify_typed_dict_inputs_oapg(RequestPathParams, path_params) - used_path = path.value - - _path_params = {} - for parameter in ( - request_path_tag, - request_path_key_id, - ): - parameter_data = path_params.get(parameter.name, schemas.unset) - if parameter_data is schemas.unset: - continue - serialized_data = parameter.serialize(parameter_data) - _path_params.update(serialized_data) - - for k, v in _path_params.items(): - used_path = used_path.replace('{%s}' % k, v) - # TODO add cookie handling - - response = self.api_client.call_api( - resource_path=used_path, - method='delete'.upper(), - auth_settings=_auth, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class KeysKeyIdRestrictionsTagsTagDelete(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def keys_key_id_restrictions_tags_tag_delete( - self, - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor204, - ]: ... - - @typing.overload - def keys_key_id_restrictions_tags_tag_delete( - self, - skip_deserialization: typing_extensions.Literal[True], - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def keys_key_id_restrictions_tags_tag_delete( - self, - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor204, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def keys_key_id_restrictions_tags_tag_delete( - self, - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._keys_key_id_restrictions_tags_tag_delete_oapg( - path_params=path_params, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiFordelete(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def delete( - self, - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor204, - ]: ... - - @typing.overload - def delete( - self, - skip_deserialization: typing_extensions.Literal[True], - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def delete( - self, - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor204, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def delete( - self, - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._keys_key_id_restrictions_tags_tag_delete_oapg( - path_params=path_params, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - 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 new file mode 100644 index 00000000..e69de29b 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 new file mode 100644 index 00000000..d972c7bb --- /dev/null +++ b/pynitrokey/nethsm/client/paths/keys_key_id_restrictions_tags_tag/delete/operation.py @@ -0,0 +1,187 @@ +# 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 new file mode 100644 index 00000000..e69de29b 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 new file mode 100644 index 00000000..476a96cc --- /dev/null +++ b/pynitrokey/nethsm/client/paths/keys_key_id_restrictions_tags_tag/delete/parameters/parameter_0/__init__.py @@ -0,0 +1,16 @@ +# 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 new file mode 100644 index 00000000..951e9038 --- /dev/null +++ b/pynitrokey/nethsm/client/paths/keys_key_id_restrictions_tags_tag/delete/parameters/parameter_0/schema.py @@ -0,0 +1,13 @@ +# 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 new file mode 100644 index 00000000..6e6a5f19 --- /dev/null +++ b/pynitrokey/nethsm/client/paths/keys_key_id_restrictions_tags_tag/delete/parameters/parameter_1/__init__.py @@ -0,0 +1,16 @@ +# 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 new file mode 100644 index 00000000..951e9038 --- /dev/null +++ b/pynitrokey/nethsm/client/paths/keys_key_id_restrictions_tags_tag/delete/parameters/parameter_1/schema.py @@ -0,0 +1,13 @@ +# 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 new file mode 100644 index 00000000..2de5ce89 --- /dev/null +++ b/pynitrokey/nethsm/client/paths/keys_key_id_restrictions_tags_tag/delete/path_parameters.py @@ -0,0 +1,113 @@ +# 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 new file mode 100644 index 00000000..e69de29b 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 new file mode 100644 index 00000000..8e822e77 --- /dev/null +++ b/pynitrokey/nethsm/client/paths/keys_key_id_restrictions_tags_tag/delete/responses/response_204/__init__.py @@ -0,0 +1,20 @@ +# coding: utf-8 + +""" + Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator +""" + +from pynitrokey.nethsm.client.shared_imports.response_imports import * # 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 new file mode 100644 index 00000000..cee35061 --- /dev/null +++ b/pynitrokey/nethsm/client/paths/keys_key_id_restrictions_tags_tag/delete/responses/response_401/__init__.py @@ -0,0 +1,20 @@ +# coding: utf-8 + +""" + Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator +""" + +from pynitrokey.nethsm.client.shared_imports.response_imports import * # 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 new file mode 100644 index 00000000..7bc0249d --- /dev/null +++ b/pynitrokey/nethsm/client/paths/keys_key_id_restrictions_tags_tag/delete/responses/response_403/__init__.py @@ -0,0 +1,20 @@ +# coding: utf-8 + +""" + Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator +""" + +from pynitrokey.nethsm.client.shared_imports.response_imports import * # 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 new file mode 100644 index 00000000..e43c74d8 --- /dev/null +++ b/pynitrokey/nethsm/client/paths/keys_key_id_restrictions_tags_tag/delete/responses/response_404/__init__.py @@ -0,0 +1,20 @@ +# coding: utf-8 + +""" + Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator +""" + +from pynitrokey.nethsm.client.shared_imports.response_imports import * # 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 new file mode 100644 index 00000000..088c436c --- /dev/null +++ b/pynitrokey/nethsm/client/paths/keys_key_id_restrictions_tags_tag/delete/responses/response_406/__init__.py @@ -0,0 +1,20 @@ +# coding: utf-8 + +""" + Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator +""" + +from pynitrokey.nethsm.client.shared_imports.response_imports import * # 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 new file mode 100644 index 00000000..50b6212f --- /dev/null +++ b/pynitrokey/nethsm/client/paths/keys_key_id_restrictions_tags_tag/delete/responses/response_412/__init__.py @@ -0,0 +1,20 @@ +# coding: utf-8 + +""" + Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator +""" + +from pynitrokey.nethsm.client.shared_imports.response_imports import * # 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 new file mode 100644 index 00000000..e69de29b 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 new file mode 100644 index 00000000..f3b60942 --- /dev/null +++ b/pynitrokey/nethsm/client/paths/keys_key_id_restrictions_tags_tag/delete/security/security_requirement_object_0.py @@ -0,0 +1,11 @@ +# 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.py b/pynitrokey/nethsm/client/paths/keys_key_id_restrictions_tags_tag/put.py deleted file mode 100644 index b4ffae2a..00000000 --- a/pynitrokey/nethsm/client/paths/keys_key_id_restrictions_tags_tag/put.py +++ /dev/null @@ -1,346 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 - -from pynitrokey.nethsm.client import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from pynitrokey.nethsm.client import schemas # noqa: F401 - -from . import path - -# Path params -TagSchema = schemas.StrSchema -KeyIDSchema = schemas.StrSchema -RequestRequiredPathParams = typing_extensions.TypedDict( - 'RequestRequiredPathParams', - { - 'Tag': typing.Union[TagSchema, str, ], - 'KeyID': typing.Union[KeyIDSchema, str, ], - } -) -RequestOptionalPathParams = typing_extensions.TypedDict( - 'RequestOptionalPathParams', - { - }, - total=False -) - - -class RequestPathParams(RequestRequiredPathParams, RequestOptionalPathParams): - pass - - -request_path_tag = api_client.PathParameter( - name="Tag", - style=api_client.ParameterStyle.SIMPLE, - schema=TagSchema, - required=True, -) -request_path_key_id = api_client.PathParameter( - name="KeyID", - style=api_client.ParameterStyle.SIMPLE, - schema=KeyIDSchema, - required=True, -) -_auth = [ - 'basic', -] - - -@dataclass -class ApiResponseFor204(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_204 = api_client.OpenApiResponse( - response_cls=ApiResponseFor204, -) - - -@dataclass -class ApiResponseFor304(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_304 = api_client.OpenApiResponse( - response_cls=ApiResponseFor304, -) - - -@dataclass -class ApiResponseFor400(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_400 = api_client.OpenApiResponse( - response_cls=ApiResponseFor400, -) - - -@dataclass -class ApiResponseFor401(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_401 = api_client.OpenApiResponse( - response_cls=ApiResponseFor401, -) - - -@dataclass -class ApiResponseFor403(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_403 = api_client.OpenApiResponse( - response_cls=ApiResponseFor403, -) - - -@dataclass -class ApiResponseFor404(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_404 = api_client.OpenApiResponse( - response_cls=ApiResponseFor404, -) - - -@dataclass -class ApiResponseFor412(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_412 = api_client.OpenApiResponse( - response_cls=ApiResponseFor412, -) -_status_code_to_response = { - '204': _response_for_204, - '304': _response_for_304, - '400': _response_for_400, - '401': _response_for_401, - '403': _response_for_403, - '404': _response_for_404, - '412': _response_for_412, -} - - -class BaseApi(api_client.Api): - @typing.overload - def _keys_key_id_restrictions_tags_tag_put_oapg( - self, - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor204, - ]: ... - - @typing.overload - def _keys_key_id_restrictions_tags_tag_put_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _keys_key_id_restrictions_tags_tag_put_oapg( - self, - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor204, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _keys_key_id_restrictions_tags_tag_put_oapg( - self, - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :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 - """ - self._verify_typed_dict_inputs_oapg(RequestPathParams, path_params) - used_path = path.value - - _path_params = {} - for parameter in ( - request_path_tag, - request_path_key_id, - ): - parameter_data = path_params.get(parameter.name, schemas.unset) - if parameter_data is schemas.unset: - continue - serialized_data = parameter.serialize(parameter_data) - _path_params.update(serialized_data) - - for k, v in _path_params.items(): - used_path = used_path.replace('{%s}' % k, v) - # TODO add cookie handling - - response = self.api_client.call_api( - resource_path=used_path, - method='put'.upper(), - auth_settings=_auth, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class KeysKeyIdRestrictionsTagsTagPut(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def keys_key_id_restrictions_tags_tag_put( - self, - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor204, - ]: ... - - @typing.overload - def keys_key_id_restrictions_tags_tag_put( - self, - skip_deserialization: typing_extensions.Literal[True], - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def keys_key_id_restrictions_tags_tag_put( - self, - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor204, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def keys_key_id_restrictions_tags_tag_put( - self, - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._keys_key_id_restrictions_tags_tag_put_oapg( - path_params=path_params, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForput(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def put( - self, - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor204, - ]: ... - - @typing.overload - def put( - self, - skip_deserialization: typing_extensions.Literal[True], - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def put( - self, - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor204, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def put( - self, - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._keys_key_id_restrictions_tags_tag_put_oapg( - path_params=path_params, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/pynitrokey/nethsm/client/paths/keys_key_id_restrictions_tags_tag/put.pyi b/pynitrokey/nethsm/client/paths/keys_key_id_restrictions_tags_tag/put.pyi deleted file mode 100644 index 90a34e7a..00000000 --- a/pynitrokey/nethsm/client/paths/keys_key_id_restrictions_tags_tag/put.pyi +++ /dev/null @@ -1,332 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 - -from pynitrokey.nethsm.client import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from pynitrokey.nethsm.client import schemas # noqa: F401 - -# Path params -TagSchema = schemas.StrSchema -KeyIDSchema = schemas.StrSchema -RequestRequiredPathParams = typing_extensions.TypedDict( - 'RequestRequiredPathParams', - { - 'Tag': typing.Union[TagSchema, str, ], - 'KeyID': typing.Union[KeyIDSchema, str, ], - } -) -RequestOptionalPathParams = typing_extensions.TypedDict( - 'RequestOptionalPathParams', - { - }, - total=False -) - - -class RequestPathParams(RequestRequiredPathParams, RequestOptionalPathParams): - pass - - -request_path_tag = api_client.PathParameter( - name="Tag", - style=api_client.ParameterStyle.SIMPLE, - schema=TagSchema, - required=True, -) -request_path_key_id = api_client.PathParameter( - name="KeyID", - style=api_client.ParameterStyle.SIMPLE, - schema=KeyIDSchema, - required=True, -) - - -@dataclass -class ApiResponseFor204(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_204 = api_client.OpenApiResponse( - response_cls=ApiResponseFor204, -) - - -@dataclass -class ApiResponseFor304(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_304 = api_client.OpenApiResponse( - response_cls=ApiResponseFor304, -) - - -@dataclass -class ApiResponseFor400(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_400 = api_client.OpenApiResponse( - response_cls=ApiResponseFor400, -) - - -@dataclass -class ApiResponseFor401(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_401 = api_client.OpenApiResponse( - response_cls=ApiResponseFor401, -) - - -@dataclass -class ApiResponseFor403(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_403 = api_client.OpenApiResponse( - response_cls=ApiResponseFor403, -) - - -@dataclass -class ApiResponseFor404(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_404 = api_client.OpenApiResponse( - response_cls=ApiResponseFor404, -) - - -@dataclass -class ApiResponseFor412(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_412 = api_client.OpenApiResponse( - response_cls=ApiResponseFor412, -) - - -class BaseApi(api_client.Api): - @typing.overload - def _keys_key_id_restrictions_tags_tag_put_oapg( - self, - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor204, - ]: ... - - @typing.overload - def _keys_key_id_restrictions_tags_tag_put_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _keys_key_id_restrictions_tags_tag_put_oapg( - self, - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor204, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _keys_key_id_restrictions_tags_tag_put_oapg( - self, - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :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 - """ - self._verify_typed_dict_inputs_oapg(RequestPathParams, path_params) - used_path = path.value - - _path_params = {} - for parameter in ( - request_path_tag, - request_path_key_id, - ): - parameter_data = path_params.get(parameter.name, schemas.unset) - if parameter_data is schemas.unset: - continue - serialized_data = parameter.serialize(parameter_data) - _path_params.update(serialized_data) - - for k, v in _path_params.items(): - used_path = used_path.replace('{%s}' % k, v) - # TODO add cookie handling - - response = self.api_client.call_api( - resource_path=used_path, - method='put'.upper(), - auth_settings=_auth, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class KeysKeyIdRestrictionsTagsTagPut(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def keys_key_id_restrictions_tags_tag_put( - self, - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor204, - ]: ... - - @typing.overload - def keys_key_id_restrictions_tags_tag_put( - self, - skip_deserialization: typing_extensions.Literal[True], - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def keys_key_id_restrictions_tags_tag_put( - self, - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor204, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def keys_key_id_restrictions_tags_tag_put( - self, - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._keys_key_id_restrictions_tags_tag_put_oapg( - path_params=path_params, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForput(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def put( - self, - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor204, - ]: ... - - @typing.overload - def put( - self, - skip_deserialization: typing_extensions.Literal[True], - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def put( - self, - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor204, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def put( - self, - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._keys_key_id_restrictions_tags_tag_put_oapg( - path_params=path_params, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - 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 new file mode 100644 index 00000000..e69de29b 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 new file mode 100644 index 00000000..977b4cd6 --- /dev/null +++ b/pynitrokey/nethsm/client/paths/keys_key_id_restrictions_tags_tag/put/operation.py @@ -0,0 +1,200 @@ +# 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 new file mode 100644 index 00000000..e69de29b 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 new file mode 100644 index 00000000..476a96cc --- /dev/null +++ b/pynitrokey/nethsm/client/paths/keys_key_id_restrictions_tags_tag/put/parameters/parameter_0/__init__.py @@ -0,0 +1,16 @@ +# 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 new file mode 100644 index 00000000..951e9038 --- /dev/null +++ b/pynitrokey/nethsm/client/paths/keys_key_id_restrictions_tags_tag/put/parameters/parameter_0/schema.py @@ -0,0 +1,13 @@ +# 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 new file mode 100644 index 00000000..6e6a5f19 --- /dev/null +++ b/pynitrokey/nethsm/client/paths/keys_key_id_restrictions_tags_tag/put/parameters/parameter_1/__init__.py @@ -0,0 +1,16 @@ +# 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 new file mode 100644 index 00000000..951e9038 --- /dev/null +++ b/pynitrokey/nethsm/client/paths/keys_key_id_restrictions_tags_tag/put/parameters/parameter_1/schema.py @@ -0,0 +1,13 @@ +# 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 new file mode 100644 index 00000000..0e94422f --- /dev/null +++ b/pynitrokey/nethsm/client/paths/keys_key_id_restrictions_tags_tag/put/path_parameters.py @@ -0,0 +1,113 @@ +# 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 new file mode 100644 index 00000000..e69de29b 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 new file mode 100644 index 00000000..8e822e77 --- /dev/null +++ b/pynitrokey/nethsm/client/paths/keys_key_id_restrictions_tags_tag/put/responses/response_204/__init__.py @@ -0,0 +1,20 @@ +# coding: utf-8 + +""" + Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator +""" + +from pynitrokey.nethsm.client.shared_imports.response_imports import * # 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 new file mode 100644 index 00000000..287e3265 --- /dev/null +++ b/pynitrokey/nethsm/client/paths/keys_key_id_restrictions_tags_tag/put/responses/response_304/__init__.py @@ -0,0 +1,20 @@ +# coding: utf-8 + +""" + Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator +""" + +from pynitrokey.nethsm.client.shared_imports.response_imports import * # 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 new file mode 100644 index 00000000..0458793b --- /dev/null +++ b/pynitrokey/nethsm/client/paths/keys_key_id_restrictions_tags_tag/put/responses/response_400/__init__.py @@ -0,0 +1,20 @@ +# coding: utf-8 + +""" + Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator +""" + +from pynitrokey.nethsm.client.shared_imports.response_imports import * # 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 new file mode 100644 index 00000000..cee35061 --- /dev/null +++ b/pynitrokey/nethsm/client/paths/keys_key_id_restrictions_tags_tag/put/responses/response_401/__init__.py @@ -0,0 +1,20 @@ +# coding: utf-8 + +""" + Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator +""" + +from pynitrokey.nethsm.client.shared_imports.response_imports import * # 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 new file mode 100644 index 00000000..7bc0249d --- /dev/null +++ b/pynitrokey/nethsm/client/paths/keys_key_id_restrictions_tags_tag/put/responses/response_403/__init__.py @@ -0,0 +1,20 @@ +# coding: utf-8 + +""" + Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator +""" + +from pynitrokey.nethsm.client.shared_imports.response_imports import * # 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 new file mode 100644 index 00000000..e43c74d8 --- /dev/null +++ b/pynitrokey/nethsm/client/paths/keys_key_id_restrictions_tags_tag/put/responses/response_404/__init__.py @@ -0,0 +1,20 @@ +# coding: utf-8 + +""" + Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator +""" + +from pynitrokey.nethsm.client.shared_imports.response_imports import * # 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 new file mode 100644 index 00000000..088c436c --- /dev/null +++ b/pynitrokey/nethsm/client/paths/keys_key_id_restrictions_tags_tag/put/responses/response_406/__init__.py @@ -0,0 +1,20 @@ +# coding: utf-8 + +""" + Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator +""" + +from pynitrokey.nethsm.client.shared_imports.response_imports import * # 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 new file mode 100644 index 00000000..50b6212f --- /dev/null +++ b/pynitrokey/nethsm/client/paths/keys_key_id_restrictions_tags_tag/put/responses/response_412/__init__.py @@ -0,0 +1,20 @@ +# coding: utf-8 + +""" + Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator +""" + +from pynitrokey.nethsm.client.shared_imports.response_imports import * # 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 new file mode 100644 index 00000000..e69de29b 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 new file mode 100644 index 00000000..f3b60942 --- /dev/null +++ b/pynitrokey/nethsm/client/paths/keys_key_id_restrictions_tags_tag/put/security/security_requirement_object_0.py @@ -0,0 +1,11 @@ +# 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 index 02a3cc60..0c954441 100644 --- a/pynitrokey/nethsm/client/paths/keys_key_id_sign/__init__.py +++ b/pynitrokey/nethsm/client/paths/keys_key_id_sign/__init__.py @@ -1,7 +1,5 @@ # 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.paths.keys_key_id_sign import Api +# from pynitrokey.nethsm.client.apis.paths.keys_key_id_sign import KeysKeyIDSign -from pynitrokey.nethsm.client.paths import PathValues - -path = PathValues.KEYS_KEY_ID_SIGN \ No newline at end of file +path = "/keys/{KeyID}/sign" \ No newline at end of file diff --git a/pynitrokey/nethsm/client/paths/keys_key_id_sign/post.py b/pynitrokey/nethsm/client/paths/keys_key_id_sign/post.py deleted file mode 100644 index f493d08e..00000000 --- a/pynitrokey/nethsm/client/paths/keys_key_id_sign/post.py +++ /dev/null @@ -1,455 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from pynitrokey.nethsm.client import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from pynitrokey.nethsm.client import schemas # noqa: F401 - -from pynitrokey.nethsm.client.model.sign_request_data import SignRequestData -from pynitrokey.nethsm.client.model.sign_data import SignData - -from . import path - -# Path params -KeyIDSchema = schemas.StrSchema -RequestRequiredPathParams = typing_extensions.TypedDict( - 'RequestRequiredPathParams', - { - 'KeyID': typing.Union[KeyIDSchema, str, ], - } -) -RequestOptionalPathParams = typing_extensions.TypedDict( - 'RequestOptionalPathParams', - { - }, - total=False -) - - -class RequestPathParams(RequestRequiredPathParams, RequestOptionalPathParams): - pass - - -request_path_key_id = api_client.PathParameter( - name="KeyID", - style=api_client.ParameterStyle.SIMPLE, - schema=KeyIDSchema, - required=True, -) -# body param -SchemaForRequestBodyApplicationJson = SignRequestData - - -request_body_sign_request_data = api_client.RequestBody( - content={ - 'application/json': api_client.MediaType( - schema=SchemaForRequestBodyApplicationJson), - }, - required=True, -) -_auth = [ - 'basic', -] -SchemaFor200ResponseBodyApplicationJson = SignData - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: typing.Union[ - SchemaFor200ResponseBodyApplicationJson, - ] - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, - content={ - 'application/json': api_client.MediaType( - schema=SchemaFor200ResponseBodyApplicationJson), - }, -) - - -@dataclass -class ApiResponseFor400(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_400 = api_client.OpenApiResponse( - response_cls=ApiResponseFor400, -) - - -@dataclass -class ApiResponseFor401(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_401 = api_client.OpenApiResponse( - response_cls=ApiResponseFor401, -) - - -@dataclass -class ApiResponseFor403(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_403 = api_client.OpenApiResponse( - response_cls=ApiResponseFor403, -) - - -@dataclass -class ApiResponseFor404(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_404 = api_client.OpenApiResponse( - response_cls=ApiResponseFor404, -) - - -@dataclass -class ApiResponseFor412(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_412 = api_client.OpenApiResponse( - response_cls=ApiResponseFor412, -) -_status_code_to_response = { - '200': _response_for_200, - '400': _response_for_400, - '401': _response_for_401, - '403': _response_for_403, - '404': _response_for_404, - '412': _response_for_412, -} -_all_accept_content_types = ( - 'application/json', -) - - -class BaseApi(api_client.Api): - @typing.overload - def _keys_key_id_sign_post_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _keys_key_id_sign_post_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def _keys_key_id_sign_post_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _keys_key_id_sign_post_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _keys_key_id_sign_post_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :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 - """ - self._verify_typed_dict_inputs_oapg(RequestPathParams, path_params) - used_path = path.value - - _path_params = {} - for parameter in ( - request_path_key_id, - ): - parameter_data = path_params.get(parameter.name, schemas.unset) - if parameter_data is schemas.unset: - continue - serialized_data = parameter.serialize(parameter_data) - _path_params.update(serialized_data) - - for k, v in _path_params.items(): - used_path = used_path.replace('{%s}' % k, v) - - _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) - - if body is schemas.unset: - raise exceptions.ApiValueError( - 'The required body parameter has an invalid value of: unset. Set a valid value instead') - _fields = None - _body = None - serialized_data = request_body_sign_request_data.serialize(body, content_type) - _headers.add('Content-Type', content_type) - if 'fields' in serialized_data: - _fields = serialized_data['fields'] - elif 'body' in serialized_data: - _body = serialized_data['body'] - response = self.api_client.call_api( - resource_path=used_path, - method='post'.upper(), - headers=_headers, - fields=_fields, - body=_body, - auth_settings=_auth, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class KeysKeyIdSignPost(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def keys_key_id_sign_post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def keys_key_id_sign_post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def keys_key_id_sign_post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def keys_key_id_sign_post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def keys_key_id_sign_post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._keys_key_id_sign_post_oapg( - body=body, - path_params=path_params, - content_type=content_type, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForpost(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._keys_key_id_sign_post_oapg( - body=body, - path_params=path_params, - content_type=content_type, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/pynitrokey/nethsm/client/paths/keys_key_id_sign/post.pyi b/pynitrokey/nethsm/client/paths/keys_key_id_sign/post.pyi deleted file mode 100644 index 1730c482..00000000 --- a/pynitrokey/nethsm/client/paths/keys_key_id_sign/post.pyi +++ /dev/null @@ -1,442 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from pynitrokey.nethsm.client import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from pynitrokey.nethsm.client import schemas # noqa: F401 - -from pynitrokey.nethsm.client.model.sign_request_data import SignRequestData -from pynitrokey.nethsm.client.model.sign_data import SignData - -# Path params -KeyIDSchema = schemas.StrSchema -RequestRequiredPathParams = typing_extensions.TypedDict( - 'RequestRequiredPathParams', - { - 'KeyID': typing.Union[KeyIDSchema, str, ], - } -) -RequestOptionalPathParams = typing_extensions.TypedDict( - 'RequestOptionalPathParams', - { - }, - total=False -) - - -class RequestPathParams(RequestRequiredPathParams, RequestOptionalPathParams): - pass - - -request_path_key_id = api_client.PathParameter( - name="KeyID", - style=api_client.ParameterStyle.SIMPLE, - schema=KeyIDSchema, - required=True, -) -# body param -SchemaForRequestBodyApplicationJson = SignRequestData - - -request_body_sign_request_data = api_client.RequestBody( - content={ - 'application/json': api_client.MediaType( - schema=SchemaForRequestBodyApplicationJson), - }, - required=True, -) -SchemaFor200ResponseBodyApplicationJson = SignData - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: typing.Union[ - SchemaFor200ResponseBodyApplicationJson, - ] - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, - content={ - 'application/json': api_client.MediaType( - schema=SchemaFor200ResponseBodyApplicationJson), - }, -) - - -@dataclass -class ApiResponseFor400(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_400 = api_client.OpenApiResponse( - response_cls=ApiResponseFor400, -) - - -@dataclass -class ApiResponseFor401(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_401 = api_client.OpenApiResponse( - response_cls=ApiResponseFor401, -) - - -@dataclass -class ApiResponseFor403(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_403 = api_client.OpenApiResponse( - response_cls=ApiResponseFor403, -) - - -@dataclass -class ApiResponseFor404(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_404 = api_client.OpenApiResponse( - response_cls=ApiResponseFor404, -) - - -@dataclass -class ApiResponseFor412(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_412 = api_client.OpenApiResponse( - response_cls=ApiResponseFor412, -) -_all_accept_content_types = ( - 'application/json', -) - - -class BaseApi(api_client.Api): - @typing.overload - def _keys_key_id_sign_post_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _keys_key_id_sign_post_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def _keys_key_id_sign_post_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _keys_key_id_sign_post_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _keys_key_id_sign_post_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :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 - """ - self._verify_typed_dict_inputs_oapg(RequestPathParams, path_params) - used_path = path.value - - _path_params = {} - for parameter in ( - request_path_key_id, - ): - parameter_data = path_params.get(parameter.name, schemas.unset) - if parameter_data is schemas.unset: - continue - serialized_data = parameter.serialize(parameter_data) - _path_params.update(serialized_data) - - for k, v in _path_params.items(): - used_path = used_path.replace('{%s}' % k, v) - - _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) - - if body is schemas.unset: - raise exceptions.ApiValueError( - 'The required body parameter has an invalid value of: unset. Set a valid value instead') - _fields = None - _body = None - serialized_data = request_body_sign_request_data.serialize(body, content_type) - _headers.add('Content-Type', content_type) - if 'fields' in serialized_data: - _fields = serialized_data['fields'] - elif 'body' in serialized_data: - _body = serialized_data['body'] - response = self.api_client.call_api( - resource_path=used_path, - method='post'.upper(), - headers=_headers, - fields=_fields, - body=_body, - auth_settings=_auth, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class KeysKeyIdSignPost(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def keys_key_id_sign_post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def keys_key_id_sign_post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def keys_key_id_sign_post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def keys_key_id_sign_post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def keys_key_id_sign_post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._keys_key_id_sign_post_oapg( - body=body, - path_params=path_params, - content_type=content_type, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForpost(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._keys_key_id_sign_post_oapg( - body=body, - path_params=path_params, - content_type=content_type, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - 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 new file mode 100644 index 00000000..e69de29b 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 new file mode 100644 index 00000000..000cde0f --- /dev/null +++ b/pynitrokey/nethsm/client/paths/keys_key_id_sign/post/operation.py @@ -0,0 +1,223 @@ +# 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 new file mode 100644 index 00000000..e69de29b 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 new file mode 100644 index 00000000..29e0385b --- /dev/null +++ b/pynitrokey/nethsm/client/paths/keys_key_id_sign/post/parameters/parameter_0/__init__.py @@ -0,0 +1,16 @@ +# 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 new file mode 100644 index 00000000..951e9038 --- /dev/null +++ b/pynitrokey/nethsm/client/paths/keys_key_id_sign/post/parameters/parameter_0/schema.py @@ -0,0 +1,13 @@ +# 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 new file mode 100644 index 00000000..1369866a --- /dev/null +++ b/pynitrokey/nethsm/client/paths/keys_key_id_sign/post/path_parameters.py @@ -0,0 +1,100 @@ +# 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 new file mode 100644 index 00000000..ad29c4a8 --- /dev/null +++ b/pynitrokey/nethsm/client/paths/keys_key_id_sign/post/request_body/__init__.py @@ -0,0 +1,20 @@ +# 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 new file mode 100644 index 00000000..e69de29b 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 new file mode 100644 index 00000000..e69de29b 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 new file mode 100644 index 00000000..e2dc4b06 --- /dev/null +++ b/pynitrokey/nethsm/client/paths/keys_key_id_sign/post/request_body/content/application_json/schema.py @@ -0,0 +1,13 @@ +# 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 new file mode 100644 index 00000000..e69de29b 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 new file mode 100644 index 00000000..ceb5e774 --- /dev/null +++ b/pynitrokey/nethsm/client/paths/keys_key_id_sign/post/responses/response_200/__init__.py @@ -0,0 +1,29 @@ +# coding: utf-8 + +""" + Generated 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 new file mode 100644 index 00000000..e69de29b 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 new file mode 100644 index 00000000..e69de29b 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 new file mode 100644 index 00000000..8a3a0d87 --- /dev/null +++ b/pynitrokey/nethsm/client/paths/keys_key_id_sign/post/responses/response_200/content/application_json/schema.py @@ -0,0 +1,13 @@ +# 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 new file mode 100644 index 00000000..0458793b --- /dev/null +++ b/pynitrokey/nethsm/client/paths/keys_key_id_sign/post/responses/response_400/__init__.py @@ -0,0 +1,20 @@ +# coding: utf-8 + +""" + Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator +""" + +from pynitrokey.nethsm.client.shared_imports.response_imports import * # 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 new file mode 100644 index 00000000..cee35061 --- /dev/null +++ b/pynitrokey/nethsm/client/paths/keys_key_id_sign/post/responses/response_401/__init__.py @@ -0,0 +1,20 @@ +# coding: utf-8 + +""" + Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator +""" + +from pynitrokey.nethsm.client.shared_imports.response_imports import * # 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 new file mode 100644 index 00000000..7bc0249d --- /dev/null +++ b/pynitrokey/nethsm/client/paths/keys_key_id_sign/post/responses/response_403/__init__.py @@ -0,0 +1,20 @@ +# coding: utf-8 + +""" + Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator +""" + +from pynitrokey.nethsm.client.shared_imports.response_imports import * # 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 new file mode 100644 index 00000000..e43c74d8 --- /dev/null +++ b/pynitrokey/nethsm/client/paths/keys_key_id_sign/post/responses/response_404/__init__.py @@ -0,0 +1,20 @@ +# coding: utf-8 + +""" + Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator +""" + +from pynitrokey.nethsm.client.shared_imports.response_imports import * # 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 new file mode 100644 index 00000000..088c436c --- /dev/null +++ b/pynitrokey/nethsm/client/paths/keys_key_id_sign/post/responses/response_406/__init__.py @@ -0,0 +1,20 @@ +# coding: utf-8 + +""" + Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator +""" + +from pynitrokey.nethsm.client.shared_imports.response_imports import * # 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 new file mode 100644 index 00000000..50b6212f --- /dev/null +++ b/pynitrokey/nethsm/client/paths/keys_key_id_sign/post/responses/response_412/__init__.py @@ -0,0 +1,20 @@ +# coding: utf-8 + +""" + Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator +""" + +from pynitrokey.nethsm.client.shared_imports.response_imports import * # 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 new file mode 100644 index 00000000..e69de29b 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 new file mode 100644 index 00000000..f3b60942 --- /dev/null +++ b/pynitrokey/nethsm/client/paths/keys_key_id_sign/post/security/security_requirement_object_0.py @@ -0,0 +1,11 @@ +# 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 index 03efe3e8..d3a99891 100644 --- a/pynitrokey/nethsm/client/paths/lock/__init__.py +++ b/pynitrokey/nethsm/client/paths/lock/__init__.py @@ -1,7 +1,5 @@ # 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.paths.lock import Api +# from pynitrokey.nethsm.client.apis.paths.lock import Lock -from pynitrokey.nethsm.client.paths import PathValues - -path = PathValues.LOCK \ No newline at end of file +path = "/lock" \ No newline at end of file diff --git a/pynitrokey/nethsm/client/paths/lock/post.py b/pynitrokey/nethsm/client/paths/lock/post.py deleted file mode 100644 index 3ef4502d..00000000 --- a/pynitrokey/nethsm/client/paths/lock/post.py +++ /dev/null @@ -1,244 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 - -from pynitrokey.nethsm.client import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from pynitrokey.nethsm.client import schemas # noqa: F401 - -from . import path - -_auth = [ - 'basic', -] - - -@dataclass -class ApiResponseFor204(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_204 = api_client.OpenApiResponse( - response_cls=ApiResponseFor204, -) - - -@dataclass -class ApiResponseFor401(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_401 = api_client.OpenApiResponse( - response_cls=ApiResponseFor401, -) - - -@dataclass -class ApiResponseFor403(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_403 = api_client.OpenApiResponse( - response_cls=ApiResponseFor403, -) - - -@dataclass -class ApiResponseFor412(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_412 = api_client.OpenApiResponse( - response_cls=ApiResponseFor412, -) -_status_code_to_response = { - '204': _response_for_204, - '401': _response_for_401, - '403': _response_for_403, - '412': _response_for_412, -} - - -class BaseApi(api_client.Api): - @typing.overload - def _lock_post_oapg( - self, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor204, - ]: ... - - @typing.overload - def _lock_post_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _lock_post_oapg( - self, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor204, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _lock_post_oapg( - self, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :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.value - # TODO add cookie handling - - response = self.api_client.call_api( - resource_path=used_path, - method='post'.upper(), - auth_settings=_auth, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class LockPost(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def lock_post( - self, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor204, - ]: ... - - @typing.overload - def lock_post( - self, - skip_deserialization: typing_extensions.Literal[True], - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def lock_post( - self, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor204, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def lock_post( - self, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._lock_post_oapg( - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForpost(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def post( - self, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor204, - ]: ... - - @typing.overload - def post( - self, - skip_deserialization: typing_extensions.Literal[True], - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post( - self, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor204, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post( - self, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._lock_post_oapg( - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/pynitrokey/nethsm/client/paths/lock/post.pyi b/pynitrokey/nethsm/client/paths/lock/post.pyi deleted file mode 100644 index acf9bc69..00000000 --- a/pynitrokey/nethsm/client/paths/lock/post.pyi +++ /dev/null @@ -1,233 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 - -from pynitrokey.nethsm.client import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from pynitrokey.nethsm.client import schemas # noqa: F401 - - - -@dataclass -class ApiResponseFor204(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_204 = api_client.OpenApiResponse( - response_cls=ApiResponseFor204, -) - - -@dataclass -class ApiResponseFor401(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_401 = api_client.OpenApiResponse( - response_cls=ApiResponseFor401, -) - - -@dataclass -class ApiResponseFor403(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_403 = api_client.OpenApiResponse( - response_cls=ApiResponseFor403, -) - - -@dataclass -class ApiResponseFor412(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_412 = api_client.OpenApiResponse( - response_cls=ApiResponseFor412, -) - - -class BaseApi(api_client.Api): - @typing.overload - def _lock_post_oapg( - self, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor204, - ]: ... - - @typing.overload - def _lock_post_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _lock_post_oapg( - self, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor204, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _lock_post_oapg( - self, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :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.value - # TODO add cookie handling - - response = self.api_client.call_api( - resource_path=used_path, - method='post'.upper(), - auth_settings=_auth, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class LockPost(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def lock_post( - self, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor204, - ]: ... - - @typing.overload - def lock_post( - self, - skip_deserialization: typing_extensions.Literal[True], - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def lock_post( - self, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor204, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def lock_post( - self, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._lock_post_oapg( - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForpost(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def post( - self, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor204, - ]: ... - - @typing.overload - def post( - self, - skip_deserialization: typing_extensions.Literal[True], - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post( - self, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor204, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post( - self, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._lock_post_oapg( - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/pynitrokey/nethsm/client/paths/lock/post/__init__.py b/pynitrokey/nethsm/client/paths/lock/post/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/pynitrokey/nethsm/client/paths/lock/post/operation.py b/pynitrokey/nethsm/client/paths/lock/post/operation.py new file mode 100644 index 00000000..f4c30dd8 --- /dev/null +++ b/pynitrokey/nethsm/client/paths/lock/post/operation.py @@ -0,0 +1,155 @@ +# 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 new file mode 100644 index 00000000..e69de29b 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 new file mode 100644 index 00000000..8e822e77 --- /dev/null +++ b/pynitrokey/nethsm/client/paths/lock/post/responses/response_204/__init__.py @@ -0,0 +1,20 @@ +# coding: utf-8 + +""" + Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator +""" + +from pynitrokey.nethsm.client.shared_imports.response_imports import * # 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 new file mode 100644 index 00000000..cee35061 --- /dev/null +++ b/pynitrokey/nethsm/client/paths/lock/post/responses/response_401/__init__.py @@ -0,0 +1,20 @@ +# coding: utf-8 + +""" + Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator +""" + +from pynitrokey.nethsm.client.shared_imports.response_imports import * # 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 new file mode 100644 index 00000000..7bc0249d --- /dev/null +++ b/pynitrokey/nethsm/client/paths/lock/post/responses/response_403/__init__.py @@ -0,0 +1,20 @@ +# coding: utf-8 + +""" + Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator +""" + +from pynitrokey.nethsm.client.shared_imports.response_imports import * # 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 new file mode 100644 index 00000000..088c436c --- /dev/null +++ b/pynitrokey/nethsm/client/paths/lock/post/responses/response_406/__init__.py @@ -0,0 +1,20 @@ +# coding: utf-8 + +""" + Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator +""" + +from pynitrokey.nethsm.client.shared_imports.response_imports import * # 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 new file mode 100644 index 00000000..50b6212f --- /dev/null +++ b/pynitrokey/nethsm/client/paths/lock/post/responses/response_412/__init__.py @@ -0,0 +1,20 @@ +# coding: utf-8 + +""" + Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator +""" + +from pynitrokey.nethsm.client.shared_imports.response_imports import * # 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 new file mode 100644 index 00000000..e69de29b 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 new file mode 100644 index 00000000..f3b60942 --- /dev/null +++ b/pynitrokey/nethsm/client/paths/lock/post/security/security_requirement_object_0.py @@ -0,0 +1,11 @@ +# 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 index ab096836..d6b45ce5 100644 --- a/pynitrokey/nethsm/client/paths/metrics/__init__.py +++ b/pynitrokey/nethsm/client/paths/metrics/__init__.py @@ -1,7 +1,5 @@ # 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.paths.metrics import Api +# from pynitrokey.nethsm.client.apis.paths.metrics import Metrics -from pynitrokey.nethsm.client.paths import PathValues - -path = PathValues.METRICS \ No newline at end of file +path = "/metrics" \ No newline at end of file diff --git a/pynitrokey/nethsm/client/paths/metrics/get.py b/pynitrokey/nethsm/client/paths/metrics/get.py deleted file mode 100644 index caef3b6c..00000000 --- a/pynitrokey/nethsm/client/paths/metrics/get.py +++ /dev/null @@ -1,275 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from pynitrokey.nethsm.client import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from pynitrokey.nethsm.client import schemas # noqa: F401 - -from . import path - -_auth = [ - 'basic', -] -SchemaFor200ResponseBodyApplicationJson = schemas.DictSchema - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: typing.Union[ - SchemaFor200ResponseBodyApplicationJson, - ] - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, - content={ - 'application/json': api_client.MediaType( - schema=SchemaFor200ResponseBodyApplicationJson), - }, -) - - -@dataclass -class ApiResponseFor401(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_401 = api_client.OpenApiResponse( - response_cls=ApiResponseFor401, -) - - -@dataclass -class ApiResponseFor403(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_403 = api_client.OpenApiResponse( - response_cls=ApiResponseFor403, -) - - -@dataclass -class ApiResponseFor412(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_412 = api_client.OpenApiResponse( - response_cls=ApiResponseFor412, -) -_status_code_to_response = { - '200': _response_for_200, - '401': _response_for_401, - '403': _response_for_403, - '412': _response_for_412, -} -_all_accept_content_types = ( - 'application/json', -) - - -class BaseApi(api_client.Api): - @typing.overload - def _metrics_get_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _metrics_get_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _metrics_get_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _metrics_get_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :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.value - - _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) - - response = self.api_client.call_api( - resource_path=used_path, - method='get'.upper(), - headers=_headers, - auth_settings=_auth, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class MetricsGet(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def metrics_get( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def metrics_get( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def metrics_get( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def metrics_get( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._metrics_get_oapg( - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForget(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def get( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def get( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def get( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def get( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._metrics_get_oapg( - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/pynitrokey/nethsm/client/paths/metrics/get.pyi b/pynitrokey/nethsm/client/paths/metrics/get.pyi deleted file mode 100644 index a835fb97..00000000 --- a/pynitrokey/nethsm/client/paths/metrics/get.pyi +++ /dev/null @@ -1,264 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from pynitrokey.nethsm.client import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from pynitrokey.nethsm.client import schemas # noqa: F401 - -SchemaFor200ResponseBodyApplicationJson = schemas.DictSchema - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: typing.Union[ - SchemaFor200ResponseBodyApplicationJson, - ] - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, - content={ - 'application/json': api_client.MediaType( - schema=SchemaFor200ResponseBodyApplicationJson), - }, -) - - -@dataclass -class ApiResponseFor401(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_401 = api_client.OpenApiResponse( - response_cls=ApiResponseFor401, -) - - -@dataclass -class ApiResponseFor403(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_403 = api_client.OpenApiResponse( - response_cls=ApiResponseFor403, -) - - -@dataclass -class ApiResponseFor412(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_412 = api_client.OpenApiResponse( - response_cls=ApiResponseFor412, -) -_all_accept_content_types = ( - 'application/json', -) - - -class BaseApi(api_client.Api): - @typing.overload - def _metrics_get_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _metrics_get_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _metrics_get_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _metrics_get_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :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.value - - _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) - - response = self.api_client.call_api( - resource_path=used_path, - method='get'.upper(), - headers=_headers, - auth_settings=_auth, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class MetricsGet(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def metrics_get( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def metrics_get( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def metrics_get( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def metrics_get( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._metrics_get_oapg( - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForget(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def get( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def get( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def get( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def get( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._metrics_get_oapg( - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/pynitrokey/nethsm/client/paths/metrics/get/__init__.py b/pynitrokey/nethsm/client/paths/metrics/get/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/pynitrokey/nethsm/client/paths/metrics/get/operation.py b/pynitrokey/nethsm/client/paths/metrics/get/operation.py new file mode 100644 index 00000000..21f1db42 --- /dev/null +++ b/pynitrokey/nethsm/client/paths/metrics/get/operation.py @@ -0,0 +1,164 @@ +# 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 new file mode 100644 index 00000000..e69de29b 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 new file mode 100644 index 00000000..1a163a3e --- /dev/null +++ b/pynitrokey/nethsm/client/paths/metrics/get/responses/response_200/__init__.py @@ -0,0 +1,29 @@ +# coding: utf-8 + +""" + Generated 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 new file mode 100644 index 00000000..e69de29b 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 new file mode 100644 index 00000000..e69de29b 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 new file mode 100644 index 00000000..d2dd7a3d --- /dev/null +++ b/pynitrokey/nethsm/client/paths/metrics/get/responses/response_200/content/application_json/schema.py @@ -0,0 +1,13 @@ +# 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 new file mode 100644 index 00000000..cee35061 --- /dev/null +++ b/pynitrokey/nethsm/client/paths/metrics/get/responses/response_401/__init__.py @@ -0,0 +1,20 @@ +# coding: utf-8 + +""" + Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator +""" + +from pynitrokey.nethsm.client.shared_imports.response_imports import * # 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 new file mode 100644 index 00000000..7bc0249d --- /dev/null +++ b/pynitrokey/nethsm/client/paths/metrics/get/responses/response_403/__init__.py @@ -0,0 +1,20 @@ +# coding: utf-8 + +""" + Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator +""" + +from pynitrokey.nethsm.client.shared_imports.response_imports import * # 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 new file mode 100644 index 00000000..088c436c --- /dev/null +++ b/pynitrokey/nethsm/client/paths/metrics/get/responses/response_406/__init__.py @@ -0,0 +1,20 @@ +# coding: utf-8 + +""" + Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator +""" + +from pynitrokey.nethsm.client.shared_imports.response_imports import * # 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 new file mode 100644 index 00000000..50b6212f --- /dev/null +++ b/pynitrokey/nethsm/client/paths/metrics/get/responses/response_412/__init__.py @@ -0,0 +1,20 @@ +# coding: utf-8 + +""" + Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator +""" + +from pynitrokey.nethsm.client.shared_imports.response_imports import * # 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 new file mode 100644 index 00000000..e69de29b 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 new file mode 100644 index 00000000..f3b60942 --- /dev/null +++ b/pynitrokey/nethsm/client/paths/metrics/get/security/security_requirement_object_0.py @@ -0,0 +1,11 @@ +# 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 index c8bb8bd3..ff082400 100644 --- a/pynitrokey/nethsm/client/paths/provision/__init__.py +++ b/pynitrokey/nethsm/client/paths/provision/__init__.py @@ -1,7 +1,5 @@ # 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.paths.provision import Api +# from pynitrokey.nethsm.client.apis.paths.provision import Provision -from pynitrokey.nethsm.client.paths import PathValues - -path = PathValues.PROVISION \ No newline at end of file +path = "/provision" \ No newline at end of file diff --git a/pynitrokey/nethsm/client/paths/provision/post.py b/pynitrokey/nethsm/client/paths/provision/post.py deleted file mode 100644 index 9d0e681f..00000000 --- a/pynitrokey/nethsm/client/paths/provision/post.py +++ /dev/null @@ -1,324 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from pynitrokey.nethsm.client import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from pynitrokey.nethsm.client import schemas # noqa: F401 - -from pynitrokey.nethsm.client.model.provision_request_data import ProvisionRequestData - -from . import path - -# body param -SchemaForRequestBodyApplicationJson = ProvisionRequestData - - -request_body_provision_request_data = api_client.RequestBody( - content={ - 'application/json': api_client.MediaType( - schema=SchemaForRequestBodyApplicationJson), - }, - required=True, -) - - -@dataclass -class ApiResponseFor204(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_204 = api_client.OpenApiResponse( - response_cls=ApiResponseFor204, -) - - -@dataclass -class ApiResponseFor400(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_400 = api_client.OpenApiResponse( - response_cls=ApiResponseFor400, -) - - -@dataclass -class ApiResponseFor412(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_412 = api_client.OpenApiResponse( - response_cls=ApiResponseFor412, -) -_status_code_to_response = { - '204': _response_for_204, - '400': _response_for_400, - '412': _response_for_412, -} - - -class BaseApi(api_client.Api): - @typing.overload - def _provision_post_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor204, - ]: ... - - @typing.overload - def _provision_post_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor204, - ]: ... - - - @typing.overload - def _provision_post_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _provision_post_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor204, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _provision_post_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :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.value - - _headers = HTTPHeaderDict() - # TODO add cookie handling - - if body is schemas.unset: - raise exceptions.ApiValueError( - 'The required body parameter has an invalid value of: unset. Set a valid value instead') - _fields = None - _body = None - serialized_data = request_body_provision_request_data.serialize(body, content_type) - _headers.add('Content-Type', content_type) - if 'fields' in serialized_data: - _fields = serialized_data['fields'] - elif 'body' in serialized_data: - _body = serialized_data['body'] - response = self.api_client.call_api( - resource_path=used_path, - method='post'.upper(), - headers=_headers, - fields=_fields, - body=_body, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class ProvisionPost(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def provision_post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor204, - ]: ... - - @typing.overload - def provision_post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor204, - ]: ... - - - @typing.overload - def provision_post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def provision_post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor204, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def provision_post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._provision_post_oapg( - body=body, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForpost(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor204, - ]: ... - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor204, - ]: ... - - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor204, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._provision_post_oapg( - body=body, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/pynitrokey/nethsm/client/paths/provision/post.pyi b/pynitrokey/nethsm/client/paths/provision/post.pyi deleted file mode 100644 index 952d9d65..00000000 --- a/pynitrokey/nethsm/client/paths/provision/post.pyi +++ /dev/null @@ -1,317 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from pynitrokey.nethsm.client import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from pynitrokey.nethsm.client import schemas # noqa: F401 - -from pynitrokey.nethsm.client.model.provision_request_data import ProvisionRequestData - -# body param -SchemaForRequestBodyApplicationJson = ProvisionRequestData - - -request_body_provision_request_data = api_client.RequestBody( - content={ - 'application/json': api_client.MediaType( - schema=SchemaForRequestBodyApplicationJson), - }, - required=True, -) - - -@dataclass -class ApiResponseFor204(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_204 = api_client.OpenApiResponse( - response_cls=ApiResponseFor204, -) - - -@dataclass -class ApiResponseFor400(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_400 = api_client.OpenApiResponse( - response_cls=ApiResponseFor400, -) - - -@dataclass -class ApiResponseFor412(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_412 = api_client.OpenApiResponse( - response_cls=ApiResponseFor412, -) - - -class BaseApi(api_client.Api): - @typing.overload - def _provision_post_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor204, - ]: ... - - @typing.overload - def _provision_post_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor204, - ]: ... - - - @typing.overload - def _provision_post_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _provision_post_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor204, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _provision_post_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :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.value - - _headers = HTTPHeaderDict() - # TODO add cookie handling - - if body is schemas.unset: - raise exceptions.ApiValueError( - 'The required body parameter has an invalid value of: unset. Set a valid value instead') - _fields = None - _body = None - serialized_data = request_body_provision_request_data.serialize(body, content_type) - _headers.add('Content-Type', content_type) - if 'fields' in serialized_data: - _fields = serialized_data['fields'] - elif 'body' in serialized_data: - _body = serialized_data['body'] - response = self.api_client.call_api( - resource_path=used_path, - method='post'.upper(), - headers=_headers, - fields=_fields, - body=_body, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class ProvisionPost(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def provision_post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor204, - ]: ... - - @typing.overload - def provision_post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor204, - ]: ... - - - @typing.overload - def provision_post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def provision_post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor204, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def provision_post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._provision_post_oapg( - body=body, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForpost(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor204, - ]: ... - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor204, - ]: ... - - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor204, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._provision_post_oapg( - body=body, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/pynitrokey/nethsm/client/paths/provision/post/__init__.py b/pynitrokey/nethsm/client/paths/provision/post/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/pynitrokey/nethsm/client/paths/provision/post/operation.py b/pynitrokey/nethsm/client/paths/provision/post/operation.py new file mode 100644 index 00000000..2a8db709 --- /dev/null +++ b/pynitrokey/nethsm/client/paths/provision/post/operation.py @@ -0,0 +1,164 @@ +# 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 new file mode 100644 index 00000000..ad29c4a8 --- /dev/null +++ b/pynitrokey/nethsm/client/paths/provision/post/request_body/__init__.py @@ -0,0 +1,20 @@ +# 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 new file mode 100644 index 00000000..e69de29b 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 new file mode 100644 index 00000000..e69de29b 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 new file mode 100644 index 00000000..a492e70e --- /dev/null +++ b/pynitrokey/nethsm/client/paths/provision/post/request_body/content/application_json/schema.py @@ -0,0 +1,13 @@ +# 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 new file mode 100644 index 00000000..e69de29b 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 new file mode 100644 index 00000000..8e822e77 --- /dev/null +++ b/pynitrokey/nethsm/client/paths/provision/post/responses/response_204/__init__.py @@ -0,0 +1,20 @@ +# coding: utf-8 + +""" + Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator +""" + +from pynitrokey.nethsm.client.shared_imports.response_imports import * # 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 new file mode 100644 index 00000000..0458793b --- /dev/null +++ b/pynitrokey/nethsm/client/paths/provision/post/responses/response_400/__init__.py @@ -0,0 +1,20 @@ +# coding: utf-8 + +""" + Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator +""" + +from pynitrokey.nethsm.client.shared_imports.response_imports import * # 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 new file mode 100644 index 00000000..088c436c --- /dev/null +++ b/pynitrokey/nethsm/client/paths/provision/post/responses/response_406/__init__.py @@ -0,0 +1,20 @@ +# coding: utf-8 + +""" + Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator +""" + +from pynitrokey.nethsm.client.shared_imports.response_imports import * # 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 new file mode 100644 index 00000000..50b6212f --- /dev/null +++ b/pynitrokey/nethsm/client/paths/provision/post/responses/response_412/__init__.py @@ -0,0 +1,20 @@ +# coding: utf-8 + +""" + Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator +""" + +from pynitrokey.nethsm.client.shared_imports.response_imports import * # 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 index 047e32a8..bb6d109a 100644 --- a/pynitrokey/nethsm/client/paths/random/__init__.py +++ b/pynitrokey/nethsm/client/paths/random/__init__.py @@ -1,7 +1,5 @@ # 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.paths.random import Api +# from pynitrokey.nethsm.client.apis.paths.random import Random -from pynitrokey.nethsm.client.paths import PathValues - -path = PathValues.RANDOM \ No newline at end of file +path = "/random" \ No newline at end of file diff --git a/pynitrokey/nethsm/client/paths/random/post.py b/pynitrokey/nethsm/client/paths/random/post.py deleted file mode 100644 index 1d5ed1ad..00000000 --- a/pynitrokey/nethsm/client/paths/random/post.py +++ /dev/null @@ -1,372 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from pynitrokey.nethsm.client import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from pynitrokey.nethsm.client import schemas # noqa: F401 - -from pynitrokey.nethsm.client.model.random_request_data import RandomRequestData -from pynitrokey.nethsm.client.model.random_data import RandomData - -from . import path - -# body param -SchemaForRequestBodyApplicationJson = RandomRequestData - - -request_body_random_request_data = api_client.RequestBody( - content={ - 'application/json': api_client.MediaType( - schema=SchemaForRequestBodyApplicationJson), - }, - required=True, -) -_auth = [ - 'basic', -] -SchemaFor200ResponseBodyApplicationJson = RandomData - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: typing.Union[ - SchemaFor200ResponseBodyApplicationJson, - ] - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, - content={ - 'application/json': api_client.MediaType( - schema=SchemaFor200ResponseBodyApplicationJson), - }, -) - - -@dataclass -class ApiResponseFor401(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_401 = api_client.OpenApiResponse( - response_cls=ApiResponseFor401, -) - - -@dataclass -class ApiResponseFor403(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_403 = api_client.OpenApiResponse( - response_cls=ApiResponseFor403, -) - - -@dataclass -class ApiResponseFor412(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_412 = api_client.OpenApiResponse( - response_cls=ApiResponseFor412, -) -_status_code_to_response = { - '200': _response_for_200, - '401': _response_for_401, - '403': _response_for_403, - '412': _response_for_412, -} -_all_accept_content_types = ( - 'application/json', -) - - -class BaseApi(api_client.Api): - @typing.overload - def _random_post_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _random_post_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def _random_post_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _random_post_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _random_post_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :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.value - - _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) - - if body is schemas.unset: - raise exceptions.ApiValueError( - 'The required body parameter has an invalid value of: unset. Set a valid value instead') - _fields = None - _body = None - serialized_data = request_body_random_request_data.serialize(body, content_type) - _headers.add('Content-Type', content_type) - if 'fields' in serialized_data: - _fields = serialized_data['fields'] - elif 'body' in serialized_data: - _body = serialized_data['body'] - response = self.api_client.call_api( - resource_path=used_path, - method='post'.upper(), - headers=_headers, - fields=_fields, - body=_body, - auth_settings=_auth, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class RandomPost(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def random_post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def random_post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def random_post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def random_post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def random_post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._random_post_oapg( - body=body, - content_type=content_type, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForpost(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._random_post_oapg( - body=body, - content_type=content_type, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/pynitrokey/nethsm/client/paths/random/post.pyi b/pynitrokey/nethsm/client/paths/random/post.pyi deleted file mode 100644 index 0fed9544..00000000 --- a/pynitrokey/nethsm/client/paths/random/post.pyi +++ /dev/null @@ -1,361 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from pynitrokey.nethsm.client import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from pynitrokey.nethsm.client import schemas # noqa: F401 - -from pynitrokey.nethsm.client.model.random_request_data import RandomRequestData -from pynitrokey.nethsm.client.model.random_data import RandomData - -# body param -SchemaForRequestBodyApplicationJson = RandomRequestData - - -request_body_random_request_data = api_client.RequestBody( - content={ - 'application/json': api_client.MediaType( - schema=SchemaForRequestBodyApplicationJson), - }, - required=True, -) -SchemaFor200ResponseBodyApplicationJson = RandomData - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: typing.Union[ - SchemaFor200ResponseBodyApplicationJson, - ] - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, - content={ - 'application/json': api_client.MediaType( - schema=SchemaFor200ResponseBodyApplicationJson), - }, -) - - -@dataclass -class ApiResponseFor401(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_401 = api_client.OpenApiResponse( - response_cls=ApiResponseFor401, -) - - -@dataclass -class ApiResponseFor403(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_403 = api_client.OpenApiResponse( - response_cls=ApiResponseFor403, -) - - -@dataclass -class ApiResponseFor412(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_412 = api_client.OpenApiResponse( - response_cls=ApiResponseFor412, -) -_all_accept_content_types = ( - 'application/json', -) - - -class BaseApi(api_client.Api): - @typing.overload - def _random_post_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _random_post_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def _random_post_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _random_post_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _random_post_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :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.value - - _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) - - if body is schemas.unset: - raise exceptions.ApiValueError( - 'The required body parameter has an invalid value of: unset. Set a valid value instead') - _fields = None - _body = None - serialized_data = request_body_random_request_data.serialize(body, content_type) - _headers.add('Content-Type', content_type) - if 'fields' in serialized_data: - _fields = serialized_data['fields'] - elif 'body' in serialized_data: - _body = serialized_data['body'] - response = self.api_client.call_api( - resource_path=used_path, - method='post'.upper(), - headers=_headers, - fields=_fields, - body=_body, - auth_settings=_auth, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class RandomPost(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def random_post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def random_post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def random_post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def random_post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def random_post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._random_post_oapg( - body=body, - content_type=content_type, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForpost(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._random_post_oapg( - body=body, - content_type=content_type, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/pynitrokey/nethsm/client/paths/random/post/__init__.py b/pynitrokey/nethsm/client/paths/random/post/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/pynitrokey/nethsm/client/paths/random/post/operation.py b/pynitrokey/nethsm/client/paths/random/post/operation.py new file mode 100644 index 00000000..72c64a12 --- /dev/null +++ b/pynitrokey/nethsm/client/paths/random/post/operation.py @@ -0,0 +1,195 @@ +# 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 new file mode 100644 index 00000000..ad29c4a8 --- /dev/null +++ b/pynitrokey/nethsm/client/paths/random/post/request_body/__init__.py @@ -0,0 +1,20 @@ +# 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 new file mode 100644 index 00000000..e69de29b 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 new file mode 100644 index 00000000..e69de29b 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 new file mode 100644 index 00000000..b1d691a8 --- /dev/null +++ b/pynitrokey/nethsm/client/paths/random/post/request_body/content/application_json/schema.py @@ -0,0 +1,13 @@ +# 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 new file mode 100644 index 00000000..e69de29b 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 new file mode 100644 index 00000000..566e2394 --- /dev/null +++ b/pynitrokey/nethsm/client/paths/random/post/responses/response_200/__init__.py @@ -0,0 +1,29 @@ +# coding: utf-8 + +""" + Generated 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 new file mode 100644 index 00000000..e69de29b 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 new file mode 100644 index 00000000..e69de29b 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 new file mode 100644 index 00000000..4502d95e --- /dev/null +++ b/pynitrokey/nethsm/client/paths/random/post/responses/response_200/content/application_json/schema.py @@ -0,0 +1,13 @@ +# 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 new file mode 100644 index 00000000..0458793b --- /dev/null +++ b/pynitrokey/nethsm/client/paths/random/post/responses/response_400/__init__.py @@ -0,0 +1,20 @@ +# coding: utf-8 + +""" + Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator +""" + +from pynitrokey.nethsm.client.shared_imports.response_imports import * # 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 new file mode 100644 index 00000000..cee35061 --- /dev/null +++ b/pynitrokey/nethsm/client/paths/random/post/responses/response_401/__init__.py @@ -0,0 +1,20 @@ +# coding: utf-8 + +""" + Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator +""" + +from pynitrokey.nethsm.client.shared_imports.response_imports import * # 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 new file mode 100644 index 00000000..7bc0249d --- /dev/null +++ b/pynitrokey/nethsm/client/paths/random/post/responses/response_403/__init__.py @@ -0,0 +1,20 @@ +# coding: utf-8 + +""" + Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator +""" + +from pynitrokey.nethsm.client.shared_imports.response_imports import * # 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 new file mode 100644 index 00000000..088c436c --- /dev/null +++ b/pynitrokey/nethsm/client/paths/random/post/responses/response_406/__init__.py @@ -0,0 +1,20 @@ +# coding: utf-8 + +""" + Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator +""" + +from pynitrokey.nethsm.client.shared_imports.response_imports import * # 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 new file mode 100644 index 00000000..50b6212f --- /dev/null +++ b/pynitrokey/nethsm/client/paths/random/post/responses/response_412/__init__.py @@ -0,0 +1,20 @@ +# coding: utf-8 + +""" + Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator +""" + +from pynitrokey.nethsm.client.shared_imports.response_imports import * # 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 new file mode 100644 index 00000000..e69de29b 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 new file mode 100644 index 00000000..f3b60942 --- /dev/null +++ b/pynitrokey/nethsm/client/paths/random/post/security/security_requirement_object_0.py @@ -0,0 +1,11 @@ +# 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 index 7870fbde..5439df83 100644 --- a/pynitrokey/nethsm/client/paths/system_backup/__init__.py +++ b/pynitrokey/nethsm/client/paths/system_backup/__init__.py @@ -1,7 +1,5 @@ # 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.paths.system_backup import Api +# from pynitrokey.nethsm.client.apis.paths.system_backup import SystemBackup -from pynitrokey.nethsm.client.paths import PathValues - -path = PathValues.SYSTEM_BACKUP \ No newline at end of file +path = "/system/backup" \ No newline at end of file diff --git a/pynitrokey/nethsm/client/paths/system_backup/post.py b/pynitrokey/nethsm/client/paths/system_backup/post.py deleted file mode 100644 index 9a860a5c..00000000 --- a/pynitrokey/nethsm/client/paths/system_backup/post.py +++ /dev/null @@ -1,244 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 - -from pynitrokey.nethsm.client import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from pynitrokey.nethsm.client import schemas # noqa: F401 - -from . import path - -_auth = [ - 'basic', -] - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, -) - - -@dataclass -class ApiResponseFor401(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_401 = api_client.OpenApiResponse( - response_cls=ApiResponseFor401, -) - - -@dataclass -class ApiResponseFor403(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_403 = api_client.OpenApiResponse( - response_cls=ApiResponseFor403, -) - - -@dataclass -class ApiResponseFor412(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_412 = api_client.OpenApiResponse( - response_cls=ApiResponseFor412, -) -_status_code_to_response = { - '200': _response_for_200, - '401': _response_for_401, - '403': _response_for_403, - '412': _response_for_412, -} - - -class BaseApi(api_client.Api): - @typing.overload - def _system_backup_post_oapg( - self, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _system_backup_post_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _system_backup_post_oapg( - self, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _system_backup_post_oapg( - self, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :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.value - # TODO add cookie handling - - response = self.api_client.call_api( - resource_path=used_path, - method='post'.upper(), - auth_settings=_auth, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class SystemBackupPost(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def system_backup_post( - self, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def system_backup_post( - self, - skip_deserialization: typing_extensions.Literal[True], - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def system_backup_post( - self, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def system_backup_post( - self, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._system_backup_post_oapg( - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForpost(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def post( - self, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post( - self, - skip_deserialization: typing_extensions.Literal[True], - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post( - self, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post( - self, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._system_backup_post_oapg( - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/pynitrokey/nethsm/client/paths/system_backup/post.pyi b/pynitrokey/nethsm/client/paths/system_backup/post.pyi deleted file mode 100644 index c847ed5c..00000000 --- a/pynitrokey/nethsm/client/paths/system_backup/post.pyi +++ /dev/null @@ -1,233 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 - -from pynitrokey.nethsm.client import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from pynitrokey.nethsm.client import schemas # noqa: F401 - - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, -) - - -@dataclass -class ApiResponseFor401(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_401 = api_client.OpenApiResponse( - response_cls=ApiResponseFor401, -) - - -@dataclass -class ApiResponseFor403(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_403 = api_client.OpenApiResponse( - response_cls=ApiResponseFor403, -) - - -@dataclass -class ApiResponseFor412(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_412 = api_client.OpenApiResponse( - response_cls=ApiResponseFor412, -) - - -class BaseApi(api_client.Api): - @typing.overload - def _system_backup_post_oapg( - self, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _system_backup_post_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _system_backup_post_oapg( - self, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _system_backup_post_oapg( - self, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :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.value - # TODO add cookie handling - - response = self.api_client.call_api( - resource_path=used_path, - method='post'.upper(), - auth_settings=_auth, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class SystemBackupPost(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def system_backup_post( - self, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def system_backup_post( - self, - skip_deserialization: typing_extensions.Literal[True], - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def system_backup_post( - self, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def system_backup_post( - self, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._system_backup_post_oapg( - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForpost(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def post( - self, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post( - self, - skip_deserialization: typing_extensions.Literal[True], - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post( - self, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post( - self, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._system_backup_post_oapg( - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/pynitrokey/nethsm/client/paths/system_backup/post/__init__.py b/pynitrokey/nethsm/client/paths/system_backup/post/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/pynitrokey/nethsm/client/paths/system_backup/post/operation.py b/pynitrokey/nethsm/client/paths/system_backup/post/operation.py new file mode 100644 index 00000000..12f37f03 --- /dev/null +++ b/pynitrokey/nethsm/client/paths/system_backup/post/operation.py @@ -0,0 +1,155 @@ +# 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 new file mode 100644 index 00000000..e69de29b 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 new file mode 100644 index 00000000..fc4b07d0 --- /dev/null +++ b/pynitrokey/nethsm/client/paths/system_backup/post/responses/response_200/__init__.py @@ -0,0 +1,20 @@ +# coding: utf-8 + +""" + Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator +""" + +from pynitrokey.nethsm.client.shared_imports.response_imports import * # 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 new file mode 100644 index 00000000..cee35061 --- /dev/null +++ b/pynitrokey/nethsm/client/paths/system_backup/post/responses/response_401/__init__.py @@ -0,0 +1,20 @@ +# coding: utf-8 + +""" + Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator +""" + +from pynitrokey.nethsm.client.shared_imports.response_imports import * # 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 new file mode 100644 index 00000000..7bc0249d --- /dev/null +++ b/pynitrokey/nethsm/client/paths/system_backup/post/responses/response_403/__init__.py @@ -0,0 +1,20 @@ +# coding: utf-8 + +""" + Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator +""" + +from pynitrokey.nethsm.client.shared_imports.response_imports import * # 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 new file mode 100644 index 00000000..088c436c --- /dev/null +++ b/pynitrokey/nethsm/client/paths/system_backup/post/responses/response_406/__init__.py @@ -0,0 +1,20 @@ +# coding: utf-8 + +""" + Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator +""" + +from pynitrokey.nethsm.client.shared_imports.response_imports import * # 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 new file mode 100644 index 00000000..50b6212f --- /dev/null +++ b/pynitrokey/nethsm/client/paths/system_backup/post/responses/response_412/__init__.py @@ -0,0 +1,20 @@ +# coding: utf-8 + +""" + Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator +""" + +from pynitrokey.nethsm.client.shared_imports.response_imports import * # 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 new file mode 100644 index 00000000..e69de29b 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 new file mode 100644 index 00000000..f3b60942 --- /dev/null +++ b/pynitrokey/nethsm/client/paths/system_backup/post/security/security_requirement_object_0.py @@ -0,0 +1,11 @@ +# 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 index edd4b69f..1db88e33 100644 --- a/pynitrokey/nethsm/client/paths/system_cancel_update/__init__.py +++ b/pynitrokey/nethsm/client/paths/system_cancel_update/__init__.py @@ -1,7 +1,5 @@ # 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.paths.system_cancel_update import Api +# from pynitrokey.nethsm.client.apis.paths.system_cancel_update import SystemCancelUpdate -from pynitrokey.nethsm.client.paths import PathValues - -path = PathValues.SYSTEM_CANCELUPDATE \ No newline at end of file +path = "/system/cancel-update" \ No newline at end of file diff --git a/pynitrokey/nethsm/client/paths/system_cancel_update/post.py b/pynitrokey/nethsm/client/paths/system_cancel_update/post.py deleted file mode 100644 index d501ba68..00000000 --- a/pynitrokey/nethsm/client/paths/system_cancel_update/post.py +++ /dev/null @@ -1,244 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 - -from pynitrokey.nethsm.client import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from pynitrokey.nethsm.client import schemas # noqa: F401 - -from . import path - -_auth = [ - 'basic', -] - - -@dataclass -class ApiResponseFor204(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_204 = api_client.OpenApiResponse( - response_cls=ApiResponseFor204, -) - - -@dataclass -class ApiResponseFor401(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_401 = api_client.OpenApiResponse( - response_cls=ApiResponseFor401, -) - - -@dataclass -class ApiResponseFor403(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_403 = api_client.OpenApiResponse( - response_cls=ApiResponseFor403, -) - - -@dataclass -class ApiResponseFor412(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_412 = api_client.OpenApiResponse( - response_cls=ApiResponseFor412, -) -_status_code_to_response = { - '204': _response_for_204, - '401': _response_for_401, - '403': _response_for_403, - '412': _response_for_412, -} - - -class BaseApi(api_client.Api): - @typing.overload - def _system_cancel_update_post_oapg( - self, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor204, - ]: ... - - @typing.overload - def _system_cancel_update_post_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _system_cancel_update_post_oapg( - self, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor204, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _system_cancel_update_post_oapg( - self, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :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.value - # TODO add cookie handling - - response = self.api_client.call_api( - resource_path=used_path, - method='post'.upper(), - auth_settings=_auth, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class SystemCancelUpdatePost(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def system_cancel_update_post( - self, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor204, - ]: ... - - @typing.overload - def system_cancel_update_post( - self, - skip_deserialization: typing_extensions.Literal[True], - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def system_cancel_update_post( - self, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor204, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def system_cancel_update_post( - self, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._system_cancel_update_post_oapg( - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForpost(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def post( - self, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor204, - ]: ... - - @typing.overload - def post( - self, - skip_deserialization: typing_extensions.Literal[True], - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post( - self, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor204, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post( - self, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._system_cancel_update_post_oapg( - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/pynitrokey/nethsm/client/paths/system_cancel_update/post.pyi b/pynitrokey/nethsm/client/paths/system_cancel_update/post.pyi deleted file mode 100644 index 9c721883..00000000 --- a/pynitrokey/nethsm/client/paths/system_cancel_update/post.pyi +++ /dev/null @@ -1,233 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 - -from pynitrokey.nethsm.client import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from pynitrokey.nethsm.client import schemas # noqa: F401 - - - -@dataclass -class ApiResponseFor204(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_204 = api_client.OpenApiResponse( - response_cls=ApiResponseFor204, -) - - -@dataclass -class ApiResponseFor401(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_401 = api_client.OpenApiResponse( - response_cls=ApiResponseFor401, -) - - -@dataclass -class ApiResponseFor403(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_403 = api_client.OpenApiResponse( - response_cls=ApiResponseFor403, -) - - -@dataclass -class ApiResponseFor412(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_412 = api_client.OpenApiResponse( - response_cls=ApiResponseFor412, -) - - -class BaseApi(api_client.Api): - @typing.overload - def _system_cancel_update_post_oapg( - self, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor204, - ]: ... - - @typing.overload - def _system_cancel_update_post_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _system_cancel_update_post_oapg( - self, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor204, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _system_cancel_update_post_oapg( - self, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :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.value - # TODO add cookie handling - - response = self.api_client.call_api( - resource_path=used_path, - method='post'.upper(), - auth_settings=_auth, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class SystemCancelUpdatePost(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def system_cancel_update_post( - self, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor204, - ]: ... - - @typing.overload - def system_cancel_update_post( - self, - skip_deserialization: typing_extensions.Literal[True], - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def system_cancel_update_post( - self, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor204, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def system_cancel_update_post( - self, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._system_cancel_update_post_oapg( - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForpost(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def post( - self, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor204, - ]: ... - - @typing.overload - def post( - self, - skip_deserialization: typing_extensions.Literal[True], - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post( - self, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor204, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post( - self, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._system_cancel_update_post_oapg( - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/pynitrokey/nethsm/client/paths/system_cancel_update/post/__init__.py b/pynitrokey/nethsm/client/paths/system_cancel_update/post/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/pynitrokey/nethsm/client/paths/system_cancel_update/post/operation.py b/pynitrokey/nethsm/client/paths/system_cancel_update/post/operation.py new file mode 100644 index 00000000..731f0643 --- /dev/null +++ b/pynitrokey/nethsm/client/paths/system_cancel_update/post/operation.py @@ -0,0 +1,155 @@ +# 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 new file mode 100644 index 00000000..e69de29b 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 new file mode 100644 index 00000000..8e822e77 --- /dev/null +++ b/pynitrokey/nethsm/client/paths/system_cancel_update/post/responses/response_204/__init__.py @@ -0,0 +1,20 @@ +# coding: utf-8 + +""" + Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator +""" + +from pynitrokey.nethsm.client.shared_imports.response_imports import * # 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 new file mode 100644 index 00000000..cee35061 --- /dev/null +++ b/pynitrokey/nethsm/client/paths/system_cancel_update/post/responses/response_401/__init__.py @@ -0,0 +1,20 @@ +# coding: utf-8 + +""" + Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator +""" + +from pynitrokey.nethsm.client.shared_imports.response_imports import * # 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 new file mode 100644 index 00000000..7bc0249d --- /dev/null +++ b/pynitrokey/nethsm/client/paths/system_cancel_update/post/responses/response_403/__init__.py @@ -0,0 +1,20 @@ +# coding: utf-8 + +""" + Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator +""" + +from pynitrokey.nethsm.client.shared_imports.response_imports import * # 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 new file mode 100644 index 00000000..088c436c --- /dev/null +++ b/pynitrokey/nethsm/client/paths/system_cancel_update/post/responses/response_406/__init__.py @@ -0,0 +1,20 @@ +# coding: utf-8 + +""" + Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator +""" + +from pynitrokey.nethsm.client.shared_imports.response_imports import * # 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 new file mode 100644 index 00000000..50b6212f --- /dev/null +++ b/pynitrokey/nethsm/client/paths/system_cancel_update/post/responses/response_412/__init__.py @@ -0,0 +1,20 @@ +# coding: utf-8 + +""" + Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator +""" + +from pynitrokey.nethsm.client.shared_imports.response_imports import * # 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 new file mode 100644 index 00000000..e69de29b 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 new file mode 100644 index 00000000..f3b60942 --- /dev/null +++ b/pynitrokey/nethsm/client/paths/system_cancel_update/post/security/security_requirement_object_0.py @@ -0,0 +1,11 @@ +# 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 index 754eee7f..906cfe0d 100644 --- a/pynitrokey/nethsm/client/paths/system_commit_update/__init__.py +++ b/pynitrokey/nethsm/client/paths/system_commit_update/__init__.py @@ -1,7 +1,5 @@ # 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.paths.system_commit_update import Api +# from pynitrokey.nethsm.client.apis.paths.system_commit_update import SystemCommitUpdate -from pynitrokey.nethsm.client.paths import PathValues - -path = PathValues.SYSTEM_COMMITUPDATE \ No newline at end of file +path = "/system/commit-update" \ No newline at end of file diff --git a/pynitrokey/nethsm/client/paths/system_commit_update/post.py b/pynitrokey/nethsm/client/paths/system_commit_update/post.py deleted file mode 100644 index c5ad8b38..00000000 --- a/pynitrokey/nethsm/client/paths/system_commit_update/post.py +++ /dev/null @@ -1,244 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 - -from pynitrokey.nethsm.client import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from pynitrokey.nethsm.client import schemas # noqa: F401 - -from . import path - -_auth = [ - 'basic', -] - - -@dataclass -class ApiResponseFor204(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_204 = api_client.OpenApiResponse( - response_cls=ApiResponseFor204, -) - - -@dataclass -class ApiResponseFor401(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_401 = api_client.OpenApiResponse( - response_cls=ApiResponseFor401, -) - - -@dataclass -class ApiResponseFor403(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_403 = api_client.OpenApiResponse( - response_cls=ApiResponseFor403, -) - - -@dataclass -class ApiResponseFor412(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_412 = api_client.OpenApiResponse( - response_cls=ApiResponseFor412, -) -_status_code_to_response = { - '204': _response_for_204, - '401': _response_for_401, - '403': _response_for_403, - '412': _response_for_412, -} - - -class BaseApi(api_client.Api): - @typing.overload - def _system_commit_update_post_oapg( - self, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor204, - ]: ... - - @typing.overload - def _system_commit_update_post_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _system_commit_update_post_oapg( - self, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor204, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _system_commit_update_post_oapg( - self, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :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.value - # TODO add cookie handling - - response = self.api_client.call_api( - resource_path=used_path, - method='post'.upper(), - auth_settings=_auth, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class SystemCommitUpdatePost(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def system_commit_update_post( - self, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor204, - ]: ... - - @typing.overload - def system_commit_update_post( - self, - skip_deserialization: typing_extensions.Literal[True], - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def system_commit_update_post( - self, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor204, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def system_commit_update_post( - self, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._system_commit_update_post_oapg( - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForpost(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def post( - self, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor204, - ]: ... - - @typing.overload - def post( - self, - skip_deserialization: typing_extensions.Literal[True], - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post( - self, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor204, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post( - self, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._system_commit_update_post_oapg( - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/pynitrokey/nethsm/client/paths/system_commit_update/post.pyi b/pynitrokey/nethsm/client/paths/system_commit_update/post.pyi deleted file mode 100644 index 4e576cf0..00000000 --- a/pynitrokey/nethsm/client/paths/system_commit_update/post.pyi +++ /dev/null @@ -1,233 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 - -from pynitrokey.nethsm.client import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from pynitrokey.nethsm.client import schemas # noqa: F401 - - - -@dataclass -class ApiResponseFor204(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_204 = api_client.OpenApiResponse( - response_cls=ApiResponseFor204, -) - - -@dataclass -class ApiResponseFor401(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_401 = api_client.OpenApiResponse( - response_cls=ApiResponseFor401, -) - - -@dataclass -class ApiResponseFor403(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_403 = api_client.OpenApiResponse( - response_cls=ApiResponseFor403, -) - - -@dataclass -class ApiResponseFor412(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_412 = api_client.OpenApiResponse( - response_cls=ApiResponseFor412, -) - - -class BaseApi(api_client.Api): - @typing.overload - def _system_commit_update_post_oapg( - self, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor204, - ]: ... - - @typing.overload - def _system_commit_update_post_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _system_commit_update_post_oapg( - self, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor204, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _system_commit_update_post_oapg( - self, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :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.value - # TODO add cookie handling - - response = self.api_client.call_api( - resource_path=used_path, - method='post'.upper(), - auth_settings=_auth, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class SystemCommitUpdatePost(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def system_commit_update_post( - self, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor204, - ]: ... - - @typing.overload - def system_commit_update_post( - self, - skip_deserialization: typing_extensions.Literal[True], - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def system_commit_update_post( - self, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor204, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def system_commit_update_post( - self, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._system_commit_update_post_oapg( - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForpost(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def post( - self, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor204, - ]: ... - - @typing.overload - def post( - self, - skip_deserialization: typing_extensions.Literal[True], - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post( - self, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor204, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post( - self, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._system_commit_update_post_oapg( - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/pynitrokey/nethsm/client/paths/system_commit_update/post/__init__.py b/pynitrokey/nethsm/client/paths/system_commit_update/post/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/pynitrokey/nethsm/client/paths/system_commit_update/post/operation.py b/pynitrokey/nethsm/client/paths/system_commit_update/post/operation.py new file mode 100644 index 00000000..ad55e8b3 --- /dev/null +++ b/pynitrokey/nethsm/client/paths/system_commit_update/post/operation.py @@ -0,0 +1,155 @@ +# 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 new file mode 100644 index 00000000..e69de29b 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 new file mode 100644 index 00000000..8e822e77 --- /dev/null +++ b/pynitrokey/nethsm/client/paths/system_commit_update/post/responses/response_204/__init__.py @@ -0,0 +1,20 @@ +# coding: utf-8 + +""" + Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator +""" + +from pynitrokey.nethsm.client.shared_imports.response_imports import * # 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 new file mode 100644 index 00000000..cee35061 --- /dev/null +++ b/pynitrokey/nethsm/client/paths/system_commit_update/post/responses/response_401/__init__.py @@ -0,0 +1,20 @@ +# coding: utf-8 + +""" + Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator +""" + +from pynitrokey.nethsm.client.shared_imports.response_imports import * # 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 new file mode 100644 index 00000000..7bc0249d --- /dev/null +++ b/pynitrokey/nethsm/client/paths/system_commit_update/post/responses/response_403/__init__.py @@ -0,0 +1,20 @@ +# coding: utf-8 + +""" + Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator +""" + +from pynitrokey.nethsm.client.shared_imports.response_imports import * # 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 new file mode 100644 index 00000000..088c436c --- /dev/null +++ b/pynitrokey/nethsm/client/paths/system_commit_update/post/responses/response_406/__init__.py @@ -0,0 +1,20 @@ +# coding: utf-8 + +""" + Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator +""" + +from pynitrokey.nethsm.client.shared_imports.response_imports import * # 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 new file mode 100644 index 00000000..50b6212f --- /dev/null +++ b/pynitrokey/nethsm/client/paths/system_commit_update/post/responses/response_412/__init__.py @@ -0,0 +1,20 @@ +# coding: utf-8 + +""" + Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator +""" + +from pynitrokey.nethsm.client.shared_imports.response_imports import * # 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 new file mode 100644 index 00000000..e69de29b 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 new file mode 100644 index 00000000..f3b60942 --- /dev/null +++ b/pynitrokey/nethsm/client/paths/system_commit_update/post/security/security_requirement_object_0.py @@ -0,0 +1,11 @@ +# 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 index a54efe82..a99b3df4 100644 --- a/pynitrokey/nethsm/client/paths/system_factory_reset/__init__.py +++ b/pynitrokey/nethsm/client/paths/system_factory_reset/__init__.py @@ -1,7 +1,5 @@ # 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.paths.system_factory_reset import Api +# from pynitrokey.nethsm.client.apis.paths.system_factory_reset import SystemFactoryReset -from pynitrokey.nethsm.client.paths import PathValues - -path = PathValues.SYSTEM_FACTORYRESET \ No newline at end of file +path = "/system/factory-reset" \ No newline at end of file diff --git a/pynitrokey/nethsm/client/paths/system_factory_reset/post.py b/pynitrokey/nethsm/client/paths/system_factory_reset/post.py deleted file mode 100644 index a867a68f..00000000 --- a/pynitrokey/nethsm/client/paths/system_factory_reset/post.py +++ /dev/null @@ -1,244 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 - -from pynitrokey.nethsm.client import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from pynitrokey.nethsm.client import schemas # noqa: F401 - -from . import path - -_auth = [ - 'basic', -] - - -@dataclass -class ApiResponseFor204(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_204 = api_client.OpenApiResponse( - response_cls=ApiResponseFor204, -) - - -@dataclass -class ApiResponseFor401(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_401 = api_client.OpenApiResponse( - response_cls=ApiResponseFor401, -) - - -@dataclass -class ApiResponseFor403(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_403 = api_client.OpenApiResponse( - response_cls=ApiResponseFor403, -) - - -@dataclass -class ApiResponseFor412(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_412 = api_client.OpenApiResponse( - response_cls=ApiResponseFor412, -) -_status_code_to_response = { - '204': _response_for_204, - '401': _response_for_401, - '403': _response_for_403, - '412': _response_for_412, -} - - -class BaseApi(api_client.Api): - @typing.overload - def _system_factory_reset_post_oapg( - self, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor204, - ]: ... - - @typing.overload - def _system_factory_reset_post_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _system_factory_reset_post_oapg( - self, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor204, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _system_factory_reset_post_oapg( - self, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :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.value - # TODO add cookie handling - - response = self.api_client.call_api( - resource_path=used_path, - method='post'.upper(), - auth_settings=_auth, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class SystemFactoryResetPost(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def system_factory_reset_post( - self, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor204, - ]: ... - - @typing.overload - def system_factory_reset_post( - self, - skip_deserialization: typing_extensions.Literal[True], - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def system_factory_reset_post( - self, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor204, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def system_factory_reset_post( - self, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._system_factory_reset_post_oapg( - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForpost(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def post( - self, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor204, - ]: ... - - @typing.overload - def post( - self, - skip_deserialization: typing_extensions.Literal[True], - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post( - self, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor204, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post( - self, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._system_factory_reset_post_oapg( - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/pynitrokey/nethsm/client/paths/system_factory_reset/post.pyi b/pynitrokey/nethsm/client/paths/system_factory_reset/post.pyi deleted file mode 100644 index 6ed08013..00000000 --- a/pynitrokey/nethsm/client/paths/system_factory_reset/post.pyi +++ /dev/null @@ -1,233 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 - -from pynitrokey.nethsm.client import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from pynitrokey.nethsm.client import schemas # noqa: F401 - - - -@dataclass -class ApiResponseFor204(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_204 = api_client.OpenApiResponse( - response_cls=ApiResponseFor204, -) - - -@dataclass -class ApiResponseFor401(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_401 = api_client.OpenApiResponse( - response_cls=ApiResponseFor401, -) - - -@dataclass -class ApiResponseFor403(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_403 = api_client.OpenApiResponse( - response_cls=ApiResponseFor403, -) - - -@dataclass -class ApiResponseFor412(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_412 = api_client.OpenApiResponse( - response_cls=ApiResponseFor412, -) - - -class BaseApi(api_client.Api): - @typing.overload - def _system_factory_reset_post_oapg( - self, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor204, - ]: ... - - @typing.overload - def _system_factory_reset_post_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _system_factory_reset_post_oapg( - self, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor204, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _system_factory_reset_post_oapg( - self, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :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.value - # TODO add cookie handling - - response = self.api_client.call_api( - resource_path=used_path, - method='post'.upper(), - auth_settings=_auth, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class SystemFactoryResetPost(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def system_factory_reset_post( - self, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor204, - ]: ... - - @typing.overload - def system_factory_reset_post( - self, - skip_deserialization: typing_extensions.Literal[True], - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def system_factory_reset_post( - self, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor204, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def system_factory_reset_post( - self, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._system_factory_reset_post_oapg( - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForpost(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def post( - self, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor204, - ]: ... - - @typing.overload - def post( - self, - skip_deserialization: typing_extensions.Literal[True], - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post( - self, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor204, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post( - self, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._system_factory_reset_post_oapg( - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/pynitrokey/nethsm/client/paths/system_factory_reset/post/__init__.py b/pynitrokey/nethsm/client/paths/system_factory_reset/post/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/pynitrokey/nethsm/client/paths/system_factory_reset/post/operation.py b/pynitrokey/nethsm/client/paths/system_factory_reset/post/operation.py new file mode 100644 index 00000000..40301089 --- /dev/null +++ b/pynitrokey/nethsm/client/paths/system_factory_reset/post/operation.py @@ -0,0 +1,155 @@ +# 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 new file mode 100644 index 00000000..e69de29b 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 new file mode 100644 index 00000000..8e822e77 --- /dev/null +++ b/pynitrokey/nethsm/client/paths/system_factory_reset/post/responses/response_204/__init__.py @@ -0,0 +1,20 @@ +# coding: utf-8 + +""" + Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator +""" + +from pynitrokey.nethsm.client.shared_imports.response_imports import * # 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 new file mode 100644 index 00000000..cee35061 --- /dev/null +++ b/pynitrokey/nethsm/client/paths/system_factory_reset/post/responses/response_401/__init__.py @@ -0,0 +1,20 @@ +# coding: utf-8 + +""" + Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator +""" + +from pynitrokey.nethsm.client.shared_imports.response_imports import * # 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 new file mode 100644 index 00000000..7bc0249d --- /dev/null +++ b/pynitrokey/nethsm/client/paths/system_factory_reset/post/responses/response_403/__init__.py @@ -0,0 +1,20 @@ +# coding: utf-8 + +""" + Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator +""" + +from pynitrokey.nethsm.client.shared_imports.response_imports import * # 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 new file mode 100644 index 00000000..088c436c --- /dev/null +++ b/pynitrokey/nethsm/client/paths/system_factory_reset/post/responses/response_406/__init__.py @@ -0,0 +1,20 @@ +# coding: utf-8 + +""" + Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator +""" + +from pynitrokey.nethsm.client.shared_imports.response_imports import * # 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 new file mode 100644 index 00000000..50b6212f --- /dev/null +++ b/pynitrokey/nethsm/client/paths/system_factory_reset/post/responses/response_412/__init__.py @@ -0,0 +1,20 @@ +# coding: utf-8 + +""" + Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator +""" + +from pynitrokey.nethsm.client.shared_imports.response_imports import * # 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 new file mode 100644 index 00000000..e69de29b 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 new file mode 100644 index 00000000..f3b60942 --- /dev/null +++ b/pynitrokey/nethsm/client/paths/system_factory_reset/post/security/security_requirement_object_0.py @@ -0,0 +1,11 @@ +# 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 index 9868cb11..5acb17bc 100644 --- a/pynitrokey/nethsm/client/paths/system_info/__init__.py +++ b/pynitrokey/nethsm/client/paths/system_info/__init__.py @@ -1,7 +1,5 @@ # 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.paths.system_info import Api +# from pynitrokey.nethsm.client.apis.paths.system_info import SystemInfo -from pynitrokey.nethsm.client.paths import PathValues - -path = PathValues.SYSTEM_INFO \ No newline at end of file +path = "/system/info" \ No newline at end of file diff --git a/pynitrokey/nethsm/client/paths/system_info/get.py b/pynitrokey/nethsm/client/paths/system_info/get.py deleted file mode 100644 index 9f69f2c4..00000000 --- a/pynitrokey/nethsm/client/paths/system_info/get.py +++ /dev/null @@ -1,277 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from pynitrokey.nethsm.client import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from pynitrokey.nethsm.client import schemas # noqa: F401 - -from pynitrokey.nethsm.client.model.system_info import SystemInfo - -from . import path - -_auth = [ - 'basic', -] -SchemaFor200ResponseBodyApplicationJson = SystemInfo - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: typing.Union[ - SchemaFor200ResponseBodyApplicationJson, - ] - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, - content={ - 'application/json': api_client.MediaType( - schema=SchemaFor200ResponseBodyApplicationJson), - }, -) - - -@dataclass -class ApiResponseFor401(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_401 = api_client.OpenApiResponse( - response_cls=ApiResponseFor401, -) - - -@dataclass -class ApiResponseFor403(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_403 = api_client.OpenApiResponse( - response_cls=ApiResponseFor403, -) - - -@dataclass -class ApiResponseFor412(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_412 = api_client.OpenApiResponse( - response_cls=ApiResponseFor412, -) -_status_code_to_response = { - '200': _response_for_200, - '401': _response_for_401, - '403': _response_for_403, - '412': _response_for_412, -} -_all_accept_content_types = ( - 'application/json', -) - - -class BaseApi(api_client.Api): - @typing.overload - def _system_info_get_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _system_info_get_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _system_info_get_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _system_info_get_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :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.value - - _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) - - response = self.api_client.call_api( - resource_path=used_path, - method='get'.upper(), - headers=_headers, - auth_settings=_auth, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class SystemInfoGet(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def system_info_get( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def system_info_get( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def system_info_get( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def system_info_get( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._system_info_get_oapg( - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForget(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def get( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def get( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def get( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def get( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._system_info_get_oapg( - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/pynitrokey/nethsm/client/paths/system_info/get.pyi b/pynitrokey/nethsm/client/paths/system_info/get.pyi deleted file mode 100644 index 067ea297..00000000 --- a/pynitrokey/nethsm/client/paths/system_info/get.pyi +++ /dev/null @@ -1,266 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from pynitrokey.nethsm.client import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from pynitrokey.nethsm.client import schemas # noqa: F401 - -from pynitrokey.nethsm.client.model.system_info import SystemInfo - -SchemaFor200ResponseBodyApplicationJson = SystemInfo - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: typing.Union[ - SchemaFor200ResponseBodyApplicationJson, - ] - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, - content={ - 'application/json': api_client.MediaType( - schema=SchemaFor200ResponseBodyApplicationJson), - }, -) - - -@dataclass -class ApiResponseFor401(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_401 = api_client.OpenApiResponse( - response_cls=ApiResponseFor401, -) - - -@dataclass -class ApiResponseFor403(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_403 = api_client.OpenApiResponse( - response_cls=ApiResponseFor403, -) - - -@dataclass -class ApiResponseFor412(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_412 = api_client.OpenApiResponse( - response_cls=ApiResponseFor412, -) -_all_accept_content_types = ( - 'application/json', -) - - -class BaseApi(api_client.Api): - @typing.overload - def _system_info_get_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _system_info_get_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _system_info_get_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _system_info_get_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :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.value - - _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) - - response = self.api_client.call_api( - resource_path=used_path, - method='get'.upper(), - headers=_headers, - auth_settings=_auth, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class SystemInfoGet(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def system_info_get( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def system_info_get( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def system_info_get( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def system_info_get( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._system_info_get_oapg( - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForget(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def get( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def get( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def get( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def get( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._system_info_get_oapg( - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/pynitrokey/nethsm/client/paths/system_info/get/__init__.py b/pynitrokey/nethsm/client/paths/system_info/get/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/pynitrokey/nethsm/client/paths/system_info/get/operation.py b/pynitrokey/nethsm/client/paths/system_info/get/operation.py new file mode 100644 index 00000000..eeab7125 --- /dev/null +++ b/pynitrokey/nethsm/client/paths/system_info/get/operation.py @@ -0,0 +1,164 @@ +# 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 new file mode 100644 index 00000000..e69de29b 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 new file mode 100644 index 00000000..fc0cfe63 --- /dev/null +++ b/pynitrokey/nethsm/client/paths/system_info/get/responses/response_200/__init__.py @@ -0,0 +1,29 @@ +# coding: utf-8 + +""" + Generated 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 new file mode 100644 index 00000000..e69de29b 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 new file mode 100644 index 00000000..e69de29b 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 new file mode 100644 index 00000000..d0e4230c --- /dev/null +++ b/pynitrokey/nethsm/client/paths/system_info/get/responses/response_200/content/application_json/schema.py @@ -0,0 +1,13 @@ +# 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 new file mode 100644 index 00000000..cee35061 --- /dev/null +++ b/pynitrokey/nethsm/client/paths/system_info/get/responses/response_401/__init__.py @@ -0,0 +1,20 @@ +# coding: utf-8 + +""" + Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator +""" + +from pynitrokey.nethsm.client.shared_imports.response_imports import * # 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 new file mode 100644 index 00000000..7bc0249d --- /dev/null +++ b/pynitrokey/nethsm/client/paths/system_info/get/responses/response_403/__init__.py @@ -0,0 +1,20 @@ +# coding: utf-8 + +""" + Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator +""" + +from pynitrokey.nethsm.client.shared_imports.response_imports import * # 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 new file mode 100644 index 00000000..088c436c --- /dev/null +++ b/pynitrokey/nethsm/client/paths/system_info/get/responses/response_406/__init__.py @@ -0,0 +1,20 @@ +# coding: utf-8 + +""" + Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator +""" + +from pynitrokey.nethsm.client.shared_imports.response_imports import * # 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 new file mode 100644 index 00000000..50b6212f --- /dev/null +++ b/pynitrokey/nethsm/client/paths/system_info/get/responses/response_412/__init__.py @@ -0,0 +1,20 @@ +# coding: utf-8 + +""" + Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator +""" + +from pynitrokey.nethsm.client.shared_imports.response_imports import * # 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 new file mode 100644 index 00000000..e69de29b 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 new file mode 100644 index 00000000..f3b60942 --- /dev/null +++ b/pynitrokey/nethsm/client/paths/system_info/get/security/security_requirement_object_0.py @@ -0,0 +1,11 @@ +# 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 index 2a5c20ff..a4c53188 100644 --- a/pynitrokey/nethsm/client/paths/system_reboot/__init__.py +++ b/pynitrokey/nethsm/client/paths/system_reboot/__init__.py @@ -1,7 +1,5 @@ # 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.paths.system_reboot import Api +# from pynitrokey.nethsm.client.apis.paths.system_reboot import SystemReboot -from pynitrokey.nethsm.client.paths import PathValues - -path = PathValues.SYSTEM_REBOOT \ No newline at end of file +path = "/system/reboot" \ No newline at end of file diff --git a/pynitrokey/nethsm/client/paths/system_reboot/post.py b/pynitrokey/nethsm/client/paths/system_reboot/post.py deleted file mode 100644 index 400cacfe..00000000 --- a/pynitrokey/nethsm/client/paths/system_reboot/post.py +++ /dev/null @@ -1,244 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 - -from pynitrokey.nethsm.client import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from pynitrokey.nethsm.client import schemas # noqa: F401 - -from . import path - -_auth = [ - 'basic', -] - - -@dataclass -class ApiResponseFor204(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_204 = api_client.OpenApiResponse( - response_cls=ApiResponseFor204, -) - - -@dataclass -class ApiResponseFor401(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_401 = api_client.OpenApiResponse( - response_cls=ApiResponseFor401, -) - - -@dataclass -class ApiResponseFor403(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_403 = api_client.OpenApiResponse( - response_cls=ApiResponseFor403, -) - - -@dataclass -class ApiResponseFor412(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_412 = api_client.OpenApiResponse( - response_cls=ApiResponseFor412, -) -_status_code_to_response = { - '204': _response_for_204, - '401': _response_for_401, - '403': _response_for_403, - '412': _response_for_412, -} - - -class BaseApi(api_client.Api): - @typing.overload - def _system_reboot_post_oapg( - self, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor204, - ]: ... - - @typing.overload - def _system_reboot_post_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _system_reboot_post_oapg( - self, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor204, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _system_reboot_post_oapg( - self, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :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.value - # TODO add cookie handling - - response = self.api_client.call_api( - resource_path=used_path, - method='post'.upper(), - auth_settings=_auth, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class SystemRebootPost(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def system_reboot_post( - self, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor204, - ]: ... - - @typing.overload - def system_reboot_post( - self, - skip_deserialization: typing_extensions.Literal[True], - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def system_reboot_post( - self, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor204, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def system_reboot_post( - self, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._system_reboot_post_oapg( - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForpost(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def post( - self, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor204, - ]: ... - - @typing.overload - def post( - self, - skip_deserialization: typing_extensions.Literal[True], - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post( - self, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor204, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post( - self, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._system_reboot_post_oapg( - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/pynitrokey/nethsm/client/paths/system_reboot/post.pyi b/pynitrokey/nethsm/client/paths/system_reboot/post.pyi deleted file mode 100644 index d86be3e8..00000000 --- a/pynitrokey/nethsm/client/paths/system_reboot/post.pyi +++ /dev/null @@ -1,233 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 - -from pynitrokey.nethsm.client import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from pynitrokey.nethsm.client import schemas # noqa: F401 - - - -@dataclass -class ApiResponseFor204(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_204 = api_client.OpenApiResponse( - response_cls=ApiResponseFor204, -) - - -@dataclass -class ApiResponseFor401(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_401 = api_client.OpenApiResponse( - response_cls=ApiResponseFor401, -) - - -@dataclass -class ApiResponseFor403(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_403 = api_client.OpenApiResponse( - response_cls=ApiResponseFor403, -) - - -@dataclass -class ApiResponseFor412(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_412 = api_client.OpenApiResponse( - response_cls=ApiResponseFor412, -) - - -class BaseApi(api_client.Api): - @typing.overload - def _system_reboot_post_oapg( - self, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor204, - ]: ... - - @typing.overload - def _system_reboot_post_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _system_reboot_post_oapg( - self, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor204, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _system_reboot_post_oapg( - self, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :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.value - # TODO add cookie handling - - response = self.api_client.call_api( - resource_path=used_path, - method='post'.upper(), - auth_settings=_auth, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class SystemRebootPost(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def system_reboot_post( - self, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor204, - ]: ... - - @typing.overload - def system_reboot_post( - self, - skip_deserialization: typing_extensions.Literal[True], - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def system_reboot_post( - self, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor204, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def system_reboot_post( - self, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._system_reboot_post_oapg( - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForpost(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def post( - self, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor204, - ]: ... - - @typing.overload - def post( - self, - skip_deserialization: typing_extensions.Literal[True], - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post( - self, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor204, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post( - self, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._system_reboot_post_oapg( - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/pynitrokey/nethsm/client/paths/system_reboot/post/__init__.py b/pynitrokey/nethsm/client/paths/system_reboot/post/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/pynitrokey/nethsm/client/paths/system_reboot/post/operation.py b/pynitrokey/nethsm/client/paths/system_reboot/post/operation.py new file mode 100644 index 00000000..5efee474 --- /dev/null +++ b/pynitrokey/nethsm/client/paths/system_reboot/post/operation.py @@ -0,0 +1,155 @@ +# 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 new file mode 100644 index 00000000..e69de29b 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 new file mode 100644 index 00000000..8e822e77 --- /dev/null +++ b/pynitrokey/nethsm/client/paths/system_reboot/post/responses/response_204/__init__.py @@ -0,0 +1,20 @@ +# coding: utf-8 + +""" + Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator +""" + +from pynitrokey.nethsm.client.shared_imports.response_imports import * # 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 new file mode 100644 index 00000000..cee35061 --- /dev/null +++ b/pynitrokey/nethsm/client/paths/system_reboot/post/responses/response_401/__init__.py @@ -0,0 +1,20 @@ +# coding: utf-8 + +""" + Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator +""" + +from pynitrokey.nethsm.client.shared_imports.response_imports import * # 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 new file mode 100644 index 00000000..7bc0249d --- /dev/null +++ b/pynitrokey/nethsm/client/paths/system_reboot/post/responses/response_403/__init__.py @@ -0,0 +1,20 @@ +# coding: utf-8 + +""" + Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator +""" + +from pynitrokey.nethsm.client.shared_imports.response_imports import * # 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 new file mode 100644 index 00000000..088c436c --- /dev/null +++ b/pynitrokey/nethsm/client/paths/system_reboot/post/responses/response_406/__init__.py @@ -0,0 +1,20 @@ +# coding: utf-8 + +""" + Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator +""" + +from pynitrokey.nethsm.client.shared_imports.response_imports import * # 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 new file mode 100644 index 00000000..50b6212f --- /dev/null +++ b/pynitrokey/nethsm/client/paths/system_reboot/post/responses/response_412/__init__.py @@ -0,0 +1,20 @@ +# coding: utf-8 + +""" + Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator +""" + +from pynitrokey.nethsm.client.shared_imports.response_imports import * # 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 new file mode 100644 index 00000000..e69de29b 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 new file mode 100644 index 00000000..f3b60942 --- /dev/null +++ b/pynitrokey/nethsm/client/paths/system_reboot/post/security/security_requirement_object_0.py @@ -0,0 +1,11 @@ +# 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 index f892ec8a..e6b3146f 100644 --- a/pynitrokey/nethsm/client/paths/system_restore/__init__.py +++ b/pynitrokey/nethsm/client/paths/system_restore/__init__.py @@ -1,7 +1,5 @@ # 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.paths.system_restore import Api +# from pynitrokey.nethsm.client.apis.paths.system_restore import SystemRestore -from pynitrokey.nethsm.client.paths import PathValues - -path = PathValues.SYSTEM_RESTORE \ No newline at end of file +path = "/system/restore" \ No newline at end of file diff --git a/pynitrokey/nethsm/client/paths/system_restore/post.py b/pynitrokey/nethsm/client/paths/system_restore/post.py deleted file mode 100644 index f37c63bd..00000000 --- a/pynitrokey/nethsm/client/paths/system_restore/post.py +++ /dev/null @@ -1,392 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from pynitrokey.nethsm.client import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from pynitrokey.nethsm.client import schemas # noqa: F401 - -from pynitrokey.nethsm.client.model.passphrase import Passphrase - -from . import path - -# Query params -BackupPassphraseSchema = Passphrase -SystemTimeSchema = schemas.DateTimeSchema -RequestRequiredQueryParams = typing_extensions.TypedDict( - 'RequestRequiredQueryParams', - { - 'backupPassphrase': typing.Union[BackupPassphraseSchema, ], - 'systemTime': typing.Union[SystemTimeSchema, str, datetime, ], - } -) -RequestOptionalQueryParams = typing_extensions.TypedDict( - 'RequestOptionalQueryParams', - { - }, - total=False -) - - -class RequestQueryParams(RequestRequiredQueryParams, RequestOptionalQueryParams): - pass - - -request_query_backup_passphrase = api_client.QueryParameter( - name="backupPassphrase", - style=api_client.ParameterStyle.FORM, - schema=BackupPassphraseSchema, - required=True, - explode=True, -) -request_query_system_time = api_client.QueryParameter( - name="systemTime", - style=api_client.ParameterStyle.FORM, - schema=SystemTimeSchema, - required=True, - explode=True, -) -# body param -SchemaForRequestBodyApplicationOctetStream = schemas.StrSchema - - -request_body_body = api_client.RequestBody( - content={ - 'application/octet-stream': api_client.MediaType( - schema=SchemaForRequestBodyApplicationOctetStream), - }, - required=True, -) - - -@dataclass -class ApiResponseFor204(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_204 = api_client.OpenApiResponse( - response_cls=ApiResponseFor204, -) - - -@dataclass -class ApiResponseFor400(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_400 = api_client.OpenApiResponse( - response_cls=ApiResponseFor400, -) - - -@dataclass -class ApiResponseFor412(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_412 = api_client.OpenApiResponse( - response_cls=ApiResponseFor412, -) -_status_code_to_response = { - '204': _response_for_204, - '400': _response_for_400, - '412': _response_for_412, -} - - -class BaseApi(api_client.Api): - @typing.overload - def _system_restore_post_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationOctetStream,str, ], - content_type: typing_extensions.Literal["application/octet-stream"] = ..., - query_params: RequestQueryParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor204, - ]: ... - - @typing.overload - def _system_restore_post_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationOctetStream,str, ], - content_type: str = ..., - query_params: RequestQueryParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor204, - ]: ... - - - @typing.overload - def _system_restore_post_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationOctetStream,str, ], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - query_params: RequestQueryParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _system_restore_post_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationOctetStream,str, ], - content_type: str = ..., - query_params: RequestQueryParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor204, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _system_restore_post_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationOctetStream,str, ], - content_type: str = 'application/octet-stream', - query_params: RequestQueryParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :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 - """ - self._verify_typed_dict_inputs_oapg(RequestQueryParams, query_params) - used_path = path.value - - prefix_separator_iterator = None - for parameter in ( - request_query_backup_passphrase, - request_query_system_time, - ): - parameter_data = query_params.get(parameter.name, schemas.unset) - if parameter_data is schemas.unset: - continue - if prefix_separator_iterator is None: - prefix_separator_iterator = parameter.get_prefix_separator_iterator() - serialized_data = parameter.serialize(parameter_data, prefix_separator_iterator) - for serialized_value in serialized_data.values(): - used_path += serialized_value - - _headers = HTTPHeaderDict() - # TODO add cookie handling - - if body is schemas.unset: - raise exceptions.ApiValueError( - 'The required body parameter has an invalid value of: unset. Set a valid value instead') - _fields = None - _body = None - serialized_data = request_body_body.serialize(body, content_type) - _headers.add('Content-Type', content_type) - if 'fields' in serialized_data: - _fields = serialized_data['fields'] - elif 'body' in serialized_data: - _body = serialized_data['body'] - response = self.api_client.call_api( - resource_path=used_path, - method='post'.upper(), - headers=_headers, - fields=_fields, - body=_body, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class SystemRestorePost(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def system_restore_post( - self, - body: typing.Union[SchemaForRequestBodyApplicationOctetStream,str, ], - content_type: typing_extensions.Literal["application/octet-stream"] = ..., - query_params: RequestQueryParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor204, - ]: ... - - @typing.overload - def system_restore_post( - self, - body: typing.Union[SchemaForRequestBodyApplicationOctetStream,str, ], - content_type: str = ..., - query_params: RequestQueryParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor204, - ]: ... - - - @typing.overload - def system_restore_post( - self, - body: typing.Union[SchemaForRequestBodyApplicationOctetStream,str, ], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - query_params: RequestQueryParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def system_restore_post( - self, - body: typing.Union[SchemaForRequestBodyApplicationOctetStream,str, ], - content_type: str = ..., - query_params: RequestQueryParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor204, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def system_restore_post( - self, - body: typing.Union[SchemaForRequestBodyApplicationOctetStream,str, ], - content_type: str = 'application/octet-stream', - query_params: RequestQueryParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._system_restore_post_oapg( - body=body, - query_params=query_params, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForpost(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationOctetStream,str, ], - content_type: typing_extensions.Literal["application/octet-stream"] = ..., - query_params: RequestQueryParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor204, - ]: ... - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationOctetStream,str, ], - content_type: str = ..., - query_params: RequestQueryParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor204, - ]: ... - - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationOctetStream,str, ], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - query_params: RequestQueryParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationOctetStream,str, ], - content_type: str = ..., - query_params: RequestQueryParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor204, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationOctetStream,str, ], - content_type: str = 'application/octet-stream', - query_params: RequestQueryParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._system_restore_post_oapg( - body=body, - query_params=query_params, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/pynitrokey/nethsm/client/paths/system_restore/post.pyi b/pynitrokey/nethsm/client/paths/system_restore/post.pyi deleted file mode 100644 index d554cbf8..00000000 --- a/pynitrokey/nethsm/client/paths/system_restore/post.pyi +++ /dev/null @@ -1,385 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from pynitrokey.nethsm.client import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from pynitrokey.nethsm.client import schemas # noqa: F401 - -from pynitrokey.nethsm.client.model.passphrase import Passphrase - -# Query params -BackupPassphraseSchema = Passphrase -SystemTimeSchema = schemas.DateTimeSchema -RequestRequiredQueryParams = typing_extensions.TypedDict( - 'RequestRequiredQueryParams', - { - 'backupPassphrase': typing.Union[BackupPassphraseSchema, ], - 'systemTime': typing.Union[SystemTimeSchema, str, datetime, ], - } -) -RequestOptionalQueryParams = typing_extensions.TypedDict( - 'RequestOptionalQueryParams', - { - }, - total=False -) - - -class RequestQueryParams(RequestRequiredQueryParams, RequestOptionalQueryParams): - pass - - -request_query_backup_passphrase = api_client.QueryParameter( - name="backupPassphrase", - style=api_client.ParameterStyle.FORM, - schema=BackupPassphraseSchema, - required=True, - explode=True, -) -request_query_system_time = api_client.QueryParameter( - name="systemTime", - style=api_client.ParameterStyle.FORM, - schema=SystemTimeSchema, - required=True, - explode=True, -) -# body param -SchemaForRequestBodyApplicationOctetStream = schemas.StrSchema - - -request_body_body = api_client.RequestBody( - content={ - 'application/octet-stream': api_client.MediaType( - schema=SchemaForRequestBodyApplicationOctetStream), - }, - required=True, -) - - -@dataclass -class ApiResponseFor204(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_204 = api_client.OpenApiResponse( - response_cls=ApiResponseFor204, -) - - -@dataclass -class ApiResponseFor400(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_400 = api_client.OpenApiResponse( - response_cls=ApiResponseFor400, -) - - -@dataclass -class ApiResponseFor412(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_412 = api_client.OpenApiResponse( - response_cls=ApiResponseFor412, -) - - -class BaseApi(api_client.Api): - @typing.overload - def _system_restore_post_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationOctetStream,str, ], - content_type: typing_extensions.Literal["application/octet-stream"] = ..., - query_params: RequestQueryParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor204, - ]: ... - - @typing.overload - def _system_restore_post_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationOctetStream,str, ], - content_type: str = ..., - query_params: RequestQueryParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor204, - ]: ... - - - @typing.overload - def _system_restore_post_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationOctetStream,str, ], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - query_params: RequestQueryParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _system_restore_post_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationOctetStream,str, ], - content_type: str = ..., - query_params: RequestQueryParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor204, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _system_restore_post_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationOctetStream,str, ], - content_type: str = 'application/octet-stream', - query_params: RequestQueryParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :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 - """ - self._verify_typed_dict_inputs_oapg(RequestQueryParams, query_params) - used_path = path.value - - prefix_separator_iterator = None - for parameter in ( - request_query_backup_passphrase, - request_query_system_time, - ): - parameter_data = query_params.get(parameter.name, schemas.unset) - if parameter_data is schemas.unset: - continue - if prefix_separator_iterator is None: - prefix_separator_iterator = parameter.get_prefix_separator_iterator() - serialized_data = parameter.serialize(parameter_data, prefix_separator_iterator) - for serialized_value in serialized_data.values(): - used_path += serialized_value - - _headers = HTTPHeaderDict() - # TODO add cookie handling - - if body is schemas.unset: - raise exceptions.ApiValueError( - 'The required body parameter has an invalid value of: unset. Set a valid value instead') - _fields = None - _body = None - serialized_data = request_body_body.serialize(body, content_type) - _headers.add('Content-Type', content_type) - if 'fields' in serialized_data: - _fields = serialized_data['fields'] - elif 'body' in serialized_data: - _body = serialized_data['body'] - response = self.api_client.call_api( - resource_path=used_path, - method='post'.upper(), - headers=_headers, - fields=_fields, - body=_body, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class SystemRestorePost(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def system_restore_post( - self, - body: typing.Union[SchemaForRequestBodyApplicationOctetStream,str, ], - content_type: typing_extensions.Literal["application/octet-stream"] = ..., - query_params: RequestQueryParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor204, - ]: ... - - @typing.overload - def system_restore_post( - self, - body: typing.Union[SchemaForRequestBodyApplicationOctetStream,str, ], - content_type: str = ..., - query_params: RequestQueryParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor204, - ]: ... - - - @typing.overload - def system_restore_post( - self, - body: typing.Union[SchemaForRequestBodyApplicationOctetStream,str, ], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - query_params: RequestQueryParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def system_restore_post( - self, - body: typing.Union[SchemaForRequestBodyApplicationOctetStream,str, ], - content_type: str = ..., - query_params: RequestQueryParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor204, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def system_restore_post( - self, - body: typing.Union[SchemaForRequestBodyApplicationOctetStream,str, ], - content_type: str = 'application/octet-stream', - query_params: RequestQueryParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._system_restore_post_oapg( - body=body, - query_params=query_params, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForpost(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationOctetStream,str, ], - content_type: typing_extensions.Literal["application/octet-stream"] = ..., - query_params: RequestQueryParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor204, - ]: ... - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationOctetStream,str, ], - content_type: str = ..., - query_params: RequestQueryParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor204, - ]: ... - - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationOctetStream,str, ], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - query_params: RequestQueryParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationOctetStream,str, ], - content_type: str = ..., - query_params: RequestQueryParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor204, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationOctetStream,str, ], - content_type: str = 'application/octet-stream', - query_params: RequestQueryParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._system_restore_post_oapg( - body=body, - query_params=query_params, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/pynitrokey/nethsm/client/paths/system_restore/post/__init__.py b/pynitrokey/nethsm/client/paths/system_restore/post/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/pynitrokey/nethsm/client/paths/system_restore/post/operation.py b/pynitrokey/nethsm/client/paths/system_restore/post/operation.py new file mode 100644 index 00000000..1d7fff28 --- /dev/null +++ b/pynitrokey/nethsm/client/paths/system_restore/post/operation.py @@ -0,0 +1,183 @@ +# 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 new file mode 100644 index 00000000..e69de29b 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 new file mode 100644 index 00000000..da2e873f --- /dev/null +++ b/pynitrokey/nethsm/client/paths/system_restore/post/parameters/parameter_0/__init__.py @@ -0,0 +1,17 @@ +# 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 new file mode 100644 index 00000000..27a9983e --- /dev/null +++ b/pynitrokey/nethsm/client/paths/system_restore/post/parameters/parameter_0/schema.py @@ -0,0 +1,13 @@ +# 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 new file mode 100644 index 00000000..5cb581b3 --- /dev/null +++ b/pynitrokey/nethsm/client/paths/system_restore/post/parameters/parameter_1/__init__.py @@ -0,0 +1,16 @@ +# 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 new file mode 100644 index 00000000..57499bda --- /dev/null +++ b/pynitrokey/nethsm/client/paths/system_restore/post/parameters/parameter_1/schema.py @@ -0,0 +1,13 @@ +# 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 new file mode 100644 index 00000000..0e7c2dc9 --- /dev/null +++ b/pynitrokey/nethsm/client/paths/system_restore/post/query_parameters.py @@ -0,0 +1,137 @@ +# 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 new file mode 100644 index 00000000..73ff4116 --- /dev/null +++ b/pynitrokey/nethsm/client/paths/system_restore/post/request_body/__init__.py @@ -0,0 +1,20 @@ +# 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 new file mode 100644 index 00000000..e69de29b 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 new file mode 100644 index 00000000..e69de29b 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 new file mode 100644 index 00000000..951e9038 --- /dev/null +++ b/pynitrokey/nethsm/client/paths/system_restore/post/request_body/content/application_octet_stream/schema.py @@ -0,0 +1,13 @@ +# 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 new file mode 100644 index 00000000..e69de29b 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 new file mode 100644 index 00000000..8e822e77 --- /dev/null +++ b/pynitrokey/nethsm/client/paths/system_restore/post/responses/response_204/__init__.py @@ -0,0 +1,20 @@ +# coding: utf-8 + +""" + Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator +""" + +from pynitrokey.nethsm.client.shared_imports.response_imports import * # 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 new file mode 100644 index 00000000..0458793b --- /dev/null +++ b/pynitrokey/nethsm/client/paths/system_restore/post/responses/response_400/__init__.py @@ -0,0 +1,20 @@ +# coding: utf-8 + +""" + Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator +""" + +from pynitrokey.nethsm.client.shared_imports.response_imports import * # 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 new file mode 100644 index 00000000..088c436c --- /dev/null +++ b/pynitrokey/nethsm/client/paths/system_restore/post/responses/response_406/__init__.py @@ -0,0 +1,20 @@ +# coding: utf-8 + +""" + Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator +""" + +from pynitrokey.nethsm.client.shared_imports.response_imports import * # 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 new file mode 100644 index 00000000..50b6212f --- /dev/null +++ b/pynitrokey/nethsm/client/paths/system_restore/post/responses/response_412/__init__.py @@ -0,0 +1,20 @@ +# coding: utf-8 + +""" + Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator +""" + +from pynitrokey.nethsm.client.shared_imports.response_imports import * # 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 index 692bdccf..9cf06895 100644 --- a/pynitrokey/nethsm/client/paths/system_shutdown/__init__.py +++ b/pynitrokey/nethsm/client/paths/system_shutdown/__init__.py @@ -1,7 +1,5 @@ # 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.paths.system_shutdown import Api +# from pynitrokey.nethsm.client.apis.paths.system_shutdown import SystemShutdown -from pynitrokey.nethsm.client.paths import PathValues - -path = PathValues.SYSTEM_SHUTDOWN \ No newline at end of file +path = "/system/shutdown" \ No newline at end of file diff --git a/pynitrokey/nethsm/client/paths/system_shutdown/post.py b/pynitrokey/nethsm/client/paths/system_shutdown/post.py deleted file mode 100644 index 68efa457..00000000 --- a/pynitrokey/nethsm/client/paths/system_shutdown/post.py +++ /dev/null @@ -1,244 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 - -from pynitrokey.nethsm.client import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from pynitrokey.nethsm.client import schemas # noqa: F401 - -from . import path - -_auth = [ - 'basic', -] - - -@dataclass -class ApiResponseFor204(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_204 = api_client.OpenApiResponse( - response_cls=ApiResponseFor204, -) - - -@dataclass -class ApiResponseFor401(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_401 = api_client.OpenApiResponse( - response_cls=ApiResponseFor401, -) - - -@dataclass -class ApiResponseFor403(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_403 = api_client.OpenApiResponse( - response_cls=ApiResponseFor403, -) - - -@dataclass -class ApiResponseFor412(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_412 = api_client.OpenApiResponse( - response_cls=ApiResponseFor412, -) -_status_code_to_response = { - '204': _response_for_204, - '401': _response_for_401, - '403': _response_for_403, - '412': _response_for_412, -} - - -class BaseApi(api_client.Api): - @typing.overload - def _system_shutdown_post_oapg( - self, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor204, - ]: ... - - @typing.overload - def _system_shutdown_post_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _system_shutdown_post_oapg( - self, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor204, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _system_shutdown_post_oapg( - self, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :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.value - # TODO add cookie handling - - response = self.api_client.call_api( - resource_path=used_path, - method='post'.upper(), - auth_settings=_auth, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class SystemShutdownPost(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def system_shutdown_post( - self, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor204, - ]: ... - - @typing.overload - def system_shutdown_post( - self, - skip_deserialization: typing_extensions.Literal[True], - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def system_shutdown_post( - self, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor204, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def system_shutdown_post( - self, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._system_shutdown_post_oapg( - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForpost(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def post( - self, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor204, - ]: ... - - @typing.overload - def post( - self, - skip_deserialization: typing_extensions.Literal[True], - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post( - self, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor204, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post( - self, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._system_shutdown_post_oapg( - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/pynitrokey/nethsm/client/paths/system_shutdown/post.pyi b/pynitrokey/nethsm/client/paths/system_shutdown/post.pyi deleted file mode 100644 index cdf21a89..00000000 --- a/pynitrokey/nethsm/client/paths/system_shutdown/post.pyi +++ /dev/null @@ -1,233 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 - -from pynitrokey.nethsm.client import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from pynitrokey.nethsm.client import schemas # noqa: F401 - - - -@dataclass -class ApiResponseFor204(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_204 = api_client.OpenApiResponse( - response_cls=ApiResponseFor204, -) - - -@dataclass -class ApiResponseFor401(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_401 = api_client.OpenApiResponse( - response_cls=ApiResponseFor401, -) - - -@dataclass -class ApiResponseFor403(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_403 = api_client.OpenApiResponse( - response_cls=ApiResponseFor403, -) - - -@dataclass -class ApiResponseFor412(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_412 = api_client.OpenApiResponse( - response_cls=ApiResponseFor412, -) - - -class BaseApi(api_client.Api): - @typing.overload - def _system_shutdown_post_oapg( - self, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor204, - ]: ... - - @typing.overload - def _system_shutdown_post_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _system_shutdown_post_oapg( - self, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor204, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _system_shutdown_post_oapg( - self, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :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.value - # TODO add cookie handling - - response = self.api_client.call_api( - resource_path=used_path, - method='post'.upper(), - auth_settings=_auth, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class SystemShutdownPost(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def system_shutdown_post( - self, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor204, - ]: ... - - @typing.overload - def system_shutdown_post( - self, - skip_deserialization: typing_extensions.Literal[True], - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def system_shutdown_post( - self, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor204, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def system_shutdown_post( - self, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._system_shutdown_post_oapg( - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForpost(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def post( - self, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor204, - ]: ... - - @typing.overload - def post( - self, - skip_deserialization: typing_extensions.Literal[True], - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post( - self, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor204, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post( - self, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._system_shutdown_post_oapg( - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/pynitrokey/nethsm/client/paths/system_shutdown/post/__init__.py b/pynitrokey/nethsm/client/paths/system_shutdown/post/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/pynitrokey/nethsm/client/paths/system_shutdown/post/operation.py b/pynitrokey/nethsm/client/paths/system_shutdown/post/operation.py new file mode 100644 index 00000000..7a7cf4e1 --- /dev/null +++ b/pynitrokey/nethsm/client/paths/system_shutdown/post/operation.py @@ -0,0 +1,155 @@ +# 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 new file mode 100644 index 00000000..e69de29b 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 new file mode 100644 index 00000000..8e822e77 --- /dev/null +++ b/pynitrokey/nethsm/client/paths/system_shutdown/post/responses/response_204/__init__.py @@ -0,0 +1,20 @@ +# coding: utf-8 + +""" + Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator +""" + +from pynitrokey.nethsm.client.shared_imports.response_imports import * # 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 new file mode 100644 index 00000000..cee35061 --- /dev/null +++ b/pynitrokey/nethsm/client/paths/system_shutdown/post/responses/response_401/__init__.py @@ -0,0 +1,20 @@ +# coding: utf-8 + +""" + Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator +""" + +from pynitrokey.nethsm.client.shared_imports.response_imports import * # 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 new file mode 100644 index 00000000..7bc0249d --- /dev/null +++ b/pynitrokey/nethsm/client/paths/system_shutdown/post/responses/response_403/__init__.py @@ -0,0 +1,20 @@ +# coding: utf-8 + +""" + Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator +""" + +from pynitrokey.nethsm.client.shared_imports.response_imports import * # 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 new file mode 100644 index 00000000..088c436c --- /dev/null +++ b/pynitrokey/nethsm/client/paths/system_shutdown/post/responses/response_406/__init__.py @@ -0,0 +1,20 @@ +# coding: utf-8 + +""" + Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator +""" + +from pynitrokey.nethsm.client.shared_imports.response_imports import * # 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 new file mode 100644 index 00000000..50b6212f --- /dev/null +++ b/pynitrokey/nethsm/client/paths/system_shutdown/post/responses/response_412/__init__.py @@ -0,0 +1,20 @@ +# coding: utf-8 + +""" + Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator +""" + +from pynitrokey.nethsm.client.shared_imports.response_imports import * # 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 new file mode 100644 index 00000000..e69de29b 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 new file mode 100644 index 00000000..f3b60942 --- /dev/null +++ b/pynitrokey/nethsm/client/paths/system_shutdown/post/security/security_requirement_object_0.py @@ -0,0 +1,11 @@ +# 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 index 7364819c..77a9e07e 100644 --- a/pynitrokey/nethsm/client/paths/system_update/__init__.py +++ b/pynitrokey/nethsm/client/paths/system_update/__init__.py @@ -1,7 +1,5 @@ # 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.paths.system_update import Api +# from pynitrokey.nethsm.client.apis.paths.system_update import SystemUpdate -from pynitrokey.nethsm.client.paths import PathValues - -path = PathValues.SYSTEM_UPDATE \ No newline at end of file +path = "/system/update" \ No newline at end of file diff --git a/pynitrokey/nethsm/client/paths/system_update/post.py b/pynitrokey/nethsm/client/paths/system_update/post.py deleted file mode 100644 index 838af936..00000000 --- a/pynitrokey/nethsm/client/paths/system_update/post.py +++ /dev/null @@ -1,384 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from pynitrokey.nethsm.client import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from pynitrokey.nethsm.client import schemas # noqa: F401 - -from pynitrokey.nethsm.client.model.system_update_data import SystemUpdateData - -from . import path - -# body param -SchemaForRequestBodyApplicationOctetStream = schemas.StrSchema - - -request_body_body = api_client.RequestBody( - content={ - 'application/octet-stream': api_client.MediaType( - schema=SchemaForRequestBodyApplicationOctetStream), - }, - required=True, -) -_auth = [ - 'basic', -] -SchemaFor200ResponseBodyApplicationJson = SystemUpdateData - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: typing.Union[ - SchemaFor200ResponseBodyApplicationJson, - ] - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, - content={ - 'application/json': api_client.MediaType( - schema=SchemaFor200ResponseBodyApplicationJson), - }, -) - - -@dataclass -class ApiResponseFor401(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_401 = api_client.OpenApiResponse( - response_cls=ApiResponseFor401, -) - - -@dataclass -class ApiResponseFor403(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_403 = api_client.OpenApiResponse( - response_cls=ApiResponseFor403, -) - - -@dataclass -class ApiResponseFor409(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_409 = api_client.OpenApiResponse( - response_cls=ApiResponseFor409, -) - - -@dataclass -class ApiResponseFor412(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_412 = api_client.OpenApiResponse( - response_cls=ApiResponseFor412, -) -_status_code_to_response = { - '200': _response_for_200, - '401': _response_for_401, - '403': _response_for_403, - '409': _response_for_409, - '412': _response_for_412, -} -_all_accept_content_types = ( - 'application/json', -) - - -class BaseApi(api_client.Api): - @typing.overload - def _system_update_post_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationOctetStream,str, ], - content_type: typing_extensions.Literal["application/octet-stream"] = ..., - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _system_update_post_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationOctetStream,str, ], - content_type: str = ..., - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def _system_update_post_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationOctetStream,str, ], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _system_update_post_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationOctetStream,str, ], - content_type: str = ..., - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _system_update_post_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationOctetStream,str, ], - content_type: str = 'application/octet-stream', - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :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.value - - _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) - - if body is schemas.unset: - raise exceptions.ApiValueError( - 'The required body parameter has an invalid value of: unset. Set a valid value instead') - _fields = None - _body = None - serialized_data = request_body_body.serialize(body, content_type) - _headers.add('Content-Type', content_type) - if 'fields' in serialized_data: - _fields = serialized_data['fields'] - elif 'body' in serialized_data: - _body = serialized_data['body'] - response = self.api_client.call_api( - resource_path=used_path, - method='post'.upper(), - headers=_headers, - fields=_fields, - body=_body, - auth_settings=_auth, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class SystemUpdatePost(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def system_update_post( - self, - body: typing.Union[SchemaForRequestBodyApplicationOctetStream,str, ], - content_type: typing_extensions.Literal["application/octet-stream"] = ..., - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def system_update_post( - self, - body: typing.Union[SchemaForRequestBodyApplicationOctetStream,str, ], - content_type: str = ..., - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def system_update_post( - self, - body: typing.Union[SchemaForRequestBodyApplicationOctetStream,str, ], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def system_update_post( - self, - body: typing.Union[SchemaForRequestBodyApplicationOctetStream,str, ], - content_type: str = ..., - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def system_update_post( - self, - body: typing.Union[SchemaForRequestBodyApplicationOctetStream,str, ], - content_type: str = 'application/octet-stream', - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._system_update_post_oapg( - body=body, - content_type=content_type, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForpost(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationOctetStream,str, ], - content_type: typing_extensions.Literal["application/octet-stream"] = ..., - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationOctetStream,str, ], - content_type: str = ..., - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationOctetStream,str, ], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationOctetStream,str, ], - content_type: str = ..., - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationOctetStream,str, ], - content_type: str = 'application/octet-stream', - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._system_update_post_oapg( - body=body, - content_type=content_type, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/pynitrokey/nethsm/client/paths/system_update/post.pyi b/pynitrokey/nethsm/client/paths/system_update/post.pyi deleted file mode 100644 index af64623d..00000000 --- a/pynitrokey/nethsm/client/paths/system_update/post.pyi +++ /dev/null @@ -1,372 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from pynitrokey.nethsm.client import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from pynitrokey.nethsm.client import schemas # noqa: F401 - -from pynitrokey.nethsm.client.model.system_update_data import SystemUpdateData - -# body param -SchemaForRequestBodyApplicationOctetStream = schemas.StrSchema - - -request_body_body = api_client.RequestBody( - content={ - 'application/octet-stream': api_client.MediaType( - schema=SchemaForRequestBodyApplicationOctetStream), - }, - required=True, -) -SchemaFor200ResponseBodyApplicationJson = SystemUpdateData - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: typing.Union[ - SchemaFor200ResponseBodyApplicationJson, - ] - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, - content={ - 'application/json': api_client.MediaType( - schema=SchemaFor200ResponseBodyApplicationJson), - }, -) - - -@dataclass -class ApiResponseFor401(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_401 = api_client.OpenApiResponse( - response_cls=ApiResponseFor401, -) - - -@dataclass -class ApiResponseFor403(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_403 = api_client.OpenApiResponse( - response_cls=ApiResponseFor403, -) - - -@dataclass -class ApiResponseFor409(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_409 = api_client.OpenApiResponse( - response_cls=ApiResponseFor409, -) - - -@dataclass -class ApiResponseFor412(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_412 = api_client.OpenApiResponse( - response_cls=ApiResponseFor412, -) -_all_accept_content_types = ( - 'application/json', -) - - -class BaseApi(api_client.Api): - @typing.overload - def _system_update_post_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationOctetStream,str, ], - content_type: typing_extensions.Literal["application/octet-stream"] = ..., - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _system_update_post_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationOctetStream,str, ], - content_type: str = ..., - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def _system_update_post_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationOctetStream,str, ], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _system_update_post_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationOctetStream,str, ], - content_type: str = ..., - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _system_update_post_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationOctetStream,str, ], - content_type: str = 'application/octet-stream', - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :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.value - - _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) - - if body is schemas.unset: - raise exceptions.ApiValueError( - 'The required body parameter has an invalid value of: unset. Set a valid value instead') - _fields = None - _body = None - serialized_data = request_body_body.serialize(body, content_type) - _headers.add('Content-Type', content_type) - if 'fields' in serialized_data: - _fields = serialized_data['fields'] - elif 'body' in serialized_data: - _body = serialized_data['body'] - response = self.api_client.call_api( - resource_path=used_path, - method='post'.upper(), - headers=_headers, - fields=_fields, - body=_body, - auth_settings=_auth, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class SystemUpdatePost(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def system_update_post( - self, - body: typing.Union[SchemaForRequestBodyApplicationOctetStream,str, ], - content_type: typing_extensions.Literal["application/octet-stream"] = ..., - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def system_update_post( - self, - body: typing.Union[SchemaForRequestBodyApplicationOctetStream,str, ], - content_type: str = ..., - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def system_update_post( - self, - body: typing.Union[SchemaForRequestBodyApplicationOctetStream,str, ], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def system_update_post( - self, - body: typing.Union[SchemaForRequestBodyApplicationOctetStream,str, ], - content_type: str = ..., - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def system_update_post( - self, - body: typing.Union[SchemaForRequestBodyApplicationOctetStream,str, ], - content_type: str = 'application/octet-stream', - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._system_update_post_oapg( - body=body, - content_type=content_type, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForpost(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationOctetStream,str, ], - content_type: typing_extensions.Literal["application/octet-stream"] = ..., - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationOctetStream,str, ], - content_type: str = ..., - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationOctetStream,str, ], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationOctetStream,str, ], - content_type: str = ..., - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationOctetStream,str, ], - content_type: str = 'application/octet-stream', - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._system_update_post_oapg( - body=body, - content_type=content_type, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/pynitrokey/nethsm/client/paths/system_update/post/__init__.py b/pynitrokey/nethsm/client/paths/system_update/post/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/pynitrokey/nethsm/client/paths/system_update/post/operation.py b/pynitrokey/nethsm/client/paths/system_update/post/operation.py new file mode 100644 index 00000000..61db7b17 --- /dev/null +++ b/pynitrokey/nethsm/client/paths/system_update/post/operation.py @@ -0,0 +1,191 @@ +# 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 new file mode 100644 index 00000000..73ff4116 --- /dev/null +++ b/pynitrokey/nethsm/client/paths/system_update/post/request_body/__init__.py @@ -0,0 +1,20 @@ +# 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 new file mode 100644 index 00000000..e69de29b 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 new file mode 100644 index 00000000..e69de29b 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 new file mode 100644 index 00000000..951e9038 --- /dev/null +++ b/pynitrokey/nethsm/client/paths/system_update/post/request_body/content/application_octet_stream/schema.py @@ -0,0 +1,13 @@ +# 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 new file mode 100644 index 00000000..e69de29b 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 new file mode 100644 index 00000000..2f117879 --- /dev/null +++ b/pynitrokey/nethsm/client/paths/system_update/post/responses/response_200/__init__.py @@ -0,0 +1,29 @@ +# coding: utf-8 + +""" + Generated 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 new file mode 100644 index 00000000..e69de29b 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 new file mode 100644 index 00000000..e69de29b 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 new file mode 100644 index 00000000..eaa104bb --- /dev/null +++ b/pynitrokey/nethsm/client/paths/system_update/post/responses/response_200/content/application_json/schema.py @@ -0,0 +1,13 @@ +# 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 new file mode 100644 index 00000000..0458793b --- /dev/null +++ b/pynitrokey/nethsm/client/paths/system_update/post/responses/response_400/__init__.py @@ -0,0 +1,20 @@ +# coding: utf-8 + +""" + Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator +""" + +from pynitrokey.nethsm.client.shared_imports.response_imports import * # 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 new file mode 100644 index 00000000..cee35061 --- /dev/null +++ b/pynitrokey/nethsm/client/paths/system_update/post/responses/response_401/__init__.py @@ -0,0 +1,20 @@ +# coding: utf-8 + +""" + Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator +""" + +from pynitrokey.nethsm.client.shared_imports.response_imports import * # 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 new file mode 100644 index 00000000..7bc0249d --- /dev/null +++ b/pynitrokey/nethsm/client/paths/system_update/post/responses/response_403/__init__.py @@ -0,0 +1,20 @@ +# coding: utf-8 + +""" + Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator +""" + +from pynitrokey.nethsm.client.shared_imports.response_imports import * # 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 new file mode 100644 index 00000000..088c436c --- /dev/null +++ b/pynitrokey/nethsm/client/paths/system_update/post/responses/response_406/__init__.py @@ -0,0 +1,20 @@ +# coding: utf-8 + +""" + Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator +""" + +from pynitrokey.nethsm.client.shared_imports.response_imports import * # 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 new file mode 100644 index 00000000..ce260df9 --- /dev/null +++ b/pynitrokey/nethsm/client/paths/system_update/post/responses/response_409/__init__.py @@ -0,0 +1,20 @@ +# coding: utf-8 + +""" + Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator +""" + +from pynitrokey.nethsm.client.shared_imports.response_imports import * # 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 new file mode 100644 index 00000000..50b6212f --- /dev/null +++ b/pynitrokey/nethsm/client/paths/system_update/post/responses/response_412/__init__.py @@ -0,0 +1,20 @@ +# coding: utf-8 + +""" + Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator +""" + +from pynitrokey.nethsm.client.shared_imports.response_imports import * # 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 new file mode 100644 index 00000000..e69de29b 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 new file mode 100644 index 00000000..f3b60942 --- /dev/null +++ b/pynitrokey/nethsm/client/paths/system_update/post/security/security_requirement_object_0.py @@ -0,0 +1,11 @@ +# 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 index e7c9ef9c..e04e6b98 100644 --- a/pynitrokey/nethsm/client/paths/unlock/__init__.py +++ b/pynitrokey/nethsm/client/paths/unlock/__init__.py @@ -1,7 +1,5 @@ # 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.paths.unlock import Api +# from pynitrokey.nethsm.client.apis.paths.unlock import Unlock -from pynitrokey.nethsm.client.paths import PathValues - -path = PathValues.UNLOCK \ No newline at end of file +path = "/unlock" \ No newline at end of file diff --git a/pynitrokey/nethsm/client/paths/unlock/post.py b/pynitrokey/nethsm/client/paths/unlock/post.py deleted file mode 100644 index 8579e4bb..00000000 --- a/pynitrokey/nethsm/client/paths/unlock/post.py +++ /dev/null @@ -1,337 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from pynitrokey.nethsm.client import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from pynitrokey.nethsm.client import schemas # noqa: F401 - -from pynitrokey.nethsm.client.model.unlock_request_data import UnlockRequestData - -from . import path - -# body param -SchemaForRequestBodyApplicationJson = UnlockRequestData - - -request_body_unlock_request_data = api_client.RequestBody( - content={ - 'application/json': api_client.MediaType( - schema=SchemaForRequestBodyApplicationJson), - }, - required=True, -) - - -@dataclass -class ApiResponseFor204(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_204 = api_client.OpenApiResponse( - response_cls=ApiResponseFor204, -) - - -@dataclass -class ApiResponseFor400(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_400 = api_client.OpenApiResponse( - response_cls=ApiResponseFor400, -) - - -@dataclass -class ApiResponseFor403(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_403 = api_client.OpenApiResponse( - response_cls=ApiResponseFor403, -) - - -@dataclass -class ApiResponseFor412(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_412 = api_client.OpenApiResponse( - response_cls=ApiResponseFor412, -) -_status_code_to_response = { - '204': _response_for_204, - '400': _response_for_400, - '403': _response_for_403, - '412': _response_for_412, -} - - -class BaseApi(api_client.Api): - @typing.overload - def _unlock_post_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor204, - ]: ... - - @typing.overload - def _unlock_post_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor204, - ]: ... - - - @typing.overload - def _unlock_post_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _unlock_post_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor204, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _unlock_post_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :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.value - - _headers = HTTPHeaderDict() - # TODO add cookie handling - - if body is schemas.unset: - raise exceptions.ApiValueError( - 'The required body parameter has an invalid value of: unset. Set a valid value instead') - _fields = None - _body = None - serialized_data = request_body_unlock_request_data.serialize(body, content_type) - _headers.add('Content-Type', content_type) - if 'fields' in serialized_data: - _fields = serialized_data['fields'] - elif 'body' in serialized_data: - _body = serialized_data['body'] - response = self.api_client.call_api( - resource_path=used_path, - method='post'.upper(), - headers=_headers, - fields=_fields, - body=_body, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class UnlockPost(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def unlock_post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor204, - ]: ... - - @typing.overload - def unlock_post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor204, - ]: ... - - - @typing.overload - def unlock_post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def unlock_post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor204, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def unlock_post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._unlock_post_oapg( - body=body, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForpost(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor204, - ]: ... - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor204, - ]: ... - - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor204, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._unlock_post_oapg( - body=body, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/pynitrokey/nethsm/client/paths/unlock/post.pyi b/pynitrokey/nethsm/client/paths/unlock/post.pyi deleted file mode 100644 index c1af087b..00000000 --- a/pynitrokey/nethsm/client/paths/unlock/post.pyi +++ /dev/null @@ -1,329 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from pynitrokey.nethsm.client import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from pynitrokey.nethsm.client import schemas # noqa: F401 - -from pynitrokey.nethsm.client.model.unlock_request_data import UnlockRequestData - -# body param -SchemaForRequestBodyApplicationJson = UnlockRequestData - - -request_body_unlock_request_data = api_client.RequestBody( - content={ - 'application/json': api_client.MediaType( - schema=SchemaForRequestBodyApplicationJson), - }, - required=True, -) - - -@dataclass -class ApiResponseFor204(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_204 = api_client.OpenApiResponse( - response_cls=ApiResponseFor204, -) - - -@dataclass -class ApiResponseFor400(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_400 = api_client.OpenApiResponse( - response_cls=ApiResponseFor400, -) - - -@dataclass -class ApiResponseFor403(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_403 = api_client.OpenApiResponse( - response_cls=ApiResponseFor403, -) - - -@dataclass -class ApiResponseFor412(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_412 = api_client.OpenApiResponse( - response_cls=ApiResponseFor412, -) - - -class BaseApi(api_client.Api): - @typing.overload - def _unlock_post_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor204, - ]: ... - - @typing.overload - def _unlock_post_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor204, - ]: ... - - - @typing.overload - def _unlock_post_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _unlock_post_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor204, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _unlock_post_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :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.value - - _headers = HTTPHeaderDict() - # TODO add cookie handling - - if body is schemas.unset: - raise exceptions.ApiValueError( - 'The required body parameter has an invalid value of: unset. Set a valid value instead') - _fields = None - _body = None - serialized_data = request_body_unlock_request_data.serialize(body, content_type) - _headers.add('Content-Type', content_type) - if 'fields' in serialized_data: - _fields = serialized_data['fields'] - elif 'body' in serialized_data: - _body = serialized_data['body'] - response = self.api_client.call_api( - resource_path=used_path, - method='post'.upper(), - headers=_headers, - fields=_fields, - body=_body, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class UnlockPost(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def unlock_post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor204, - ]: ... - - @typing.overload - def unlock_post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor204, - ]: ... - - - @typing.overload - def unlock_post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def unlock_post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor204, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def unlock_post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._unlock_post_oapg( - body=body, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForpost(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor204, - ]: ... - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor204, - ]: ... - - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor204, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._unlock_post_oapg( - body=body, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/pynitrokey/nethsm/client/paths/unlock/post/__init__.py b/pynitrokey/nethsm/client/paths/unlock/post/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/pynitrokey/nethsm/client/paths/unlock/post/operation.py b/pynitrokey/nethsm/client/paths/unlock/post/operation.py new file mode 100644 index 00000000..8c1a5678 --- /dev/null +++ b/pynitrokey/nethsm/client/paths/unlock/post/operation.py @@ -0,0 +1,169 @@ +# 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 new file mode 100644 index 00000000..ad29c4a8 --- /dev/null +++ b/pynitrokey/nethsm/client/paths/unlock/post/request_body/__init__.py @@ -0,0 +1,20 @@ +# 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 new file mode 100644 index 00000000..e69de29b 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 new file mode 100644 index 00000000..e69de29b 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 new file mode 100644 index 00000000..9b716bca --- /dev/null +++ b/pynitrokey/nethsm/client/paths/unlock/post/request_body/content/application_json/schema.py @@ -0,0 +1,13 @@ +# 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 new file mode 100644 index 00000000..e69de29b 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 new file mode 100644 index 00000000..8e822e77 --- /dev/null +++ b/pynitrokey/nethsm/client/paths/unlock/post/responses/response_204/__init__.py @@ -0,0 +1,20 @@ +# coding: utf-8 + +""" + Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator +""" + +from pynitrokey.nethsm.client.shared_imports.response_imports import * # 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 new file mode 100644 index 00000000..0458793b --- /dev/null +++ b/pynitrokey/nethsm/client/paths/unlock/post/responses/response_400/__init__.py @@ -0,0 +1,20 @@ +# coding: utf-8 + +""" + Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator +""" + +from pynitrokey.nethsm.client.shared_imports.response_imports import * # 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 new file mode 100644 index 00000000..7bc0249d --- /dev/null +++ b/pynitrokey/nethsm/client/paths/unlock/post/responses/response_403/__init__.py @@ -0,0 +1,20 @@ +# coding: utf-8 + +""" + Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator +""" + +from pynitrokey.nethsm.client.shared_imports.response_imports import * # 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 new file mode 100644 index 00000000..088c436c --- /dev/null +++ b/pynitrokey/nethsm/client/paths/unlock/post/responses/response_406/__init__.py @@ -0,0 +1,20 @@ +# coding: utf-8 + +""" + Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator +""" + +from pynitrokey.nethsm.client.shared_imports.response_imports import * # 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 new file mode 100644 index 00000000..50b6212f --- /dev/null +++ b/pynitrokey/nethsm/client/paths/unlock/post/responses/response_412/__init__.py @@ -0,0 +1,20 @@ +# coding: utf-8 + +""" + Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator +""" + +from pynitrokey.nethsm.client.shared_imports.response_imports import * # 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 index 8b081198..cf0d7bd0 100644 --- a/pynitrokey/nethsm/client/paths/users/__init__.py +++ b/pynitrokey/nethsm/client/paths/users/__init__.py @@ -1,7 +1,5 @@ # 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.paths.users import Api +# from pynitrokey.nethsm.client.apis.paths.users import Users -from pynitrokey.nethsm.client.paths import PathValues - -path = PathValues.USERS \ No newline at end of file +path = "/users" \ No newline at end of file diff --git a/pynitrokey/nethsm/client/paths/users/get.py b/pynitrokey/nethsm/client/paths/users/get.py deleted file mode 100644 index 7634694e..00000000 --- a/pynitrokey/nethsm/client/paths/users/get.py +++ /dev/null @@ -1,277 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from pynitrokey.nethsm.client import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from pynitrokey.nethsm.client import schemas # noqa: F401 - -from pynitrokey.nethsm.client.model.user_list import UserList - -from . import path - -_auth = [ - 'basic', -] -SchemaFor200ResponseBodyApplicationJson = UserList - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: typing.Union[ - SchemaFor200ResponseBodyApplicationJson, - ] - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, - content={ - 'application/json': api_client.MediaType( - schema=SchemaFor200ResponseBodyApplicationJson), - }, -) - - -@dataclass -class ApiResponseFor401(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_401 = api_client.OpenApiResponse( - response_cls=ApiResponseFor401, -) - - -@dataclass -class ApiResponseFor403(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_403 = api_client.OpenApiResponse( - response_cls=ApiResponseFor403, -) - - -@dataclass -class ApiResponseFor412(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_412 = api_client.OpenApiResponse( - response_cls=ApiResponseFor412, -) -_status_code_to_response = { - '200': _response_for_200, - '401': _response_for_401, - '403': _response_for_403, - '412': _response_for_412, -} -_all_accept_content_types = ( - 'application/json', -) - - -class BaseApi(api_client.Api): - @typing.overload - def _users_get_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _users_get_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _users_get_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _users_get_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :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.value - - _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) - - response = self.api_client.call_api( - resource_path=used_path, - method='get'.upper(), - headers=_headers, - auth_settings=_auth, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class UsersGet(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def users_get( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def users_get( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def users_get( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def users_get( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._users_get_oapg( - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForget(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def get( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def get( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def get( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def get( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._users_get_oapg( - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/pynitrokey/nethsm/client/paths/users/get.pyi b/pynitrokey/nethsm/client/paths/users/get.pyi deleted file mode 100644 index d64136c3..00000000 --- a/pynitrokey/nethsm/client/paths/users/get.pyi +++ /dev/null @@ -1,266 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from pynitrokey.nethsm.client import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from pynitrokey.nethsm.client import schemas # noqa: F401 - -from pynitrokey.nethsm.client.model.user_list import UserList - -SchemaFor200ResponseBodyApplicationJson = UserList - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: typing.Union[ - SchemaFor200ResponseBodyApplicationJson, - ] - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, - content={ - 'application/json': api_client.MediaType( - schema=SchemaFor200ResponseBodyApplicationJson), - }, -) - - -@dataclass -class ApiResponseFor401(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_401 = api_client.OpenApiResponse( - response_cls=ApiResponseFor401, -) - - -@dataclass -class ApiResponseFor403(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_403 = api_client.OpenApiResponse( - response_cls=ApiResponseFor403, -) - - -@dataclass -class ApiResponseFor412(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_412 = api_client.OpenApiResponse( - response_cls=ApiResponseFor412, -) -_all_accept_content_types = ( - 'application/json', -) - - -class BaseApi(api_client.Api): - @typing.overload - def _users_get_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _users_get_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _users_get_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _users_get_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :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.value - - _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) - - response = self.api_client.call_api( - resource_path=used_path, - method='get'.upper(), - headers=_headers, - auth_settings=_auth, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class UsersGet(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def users_get( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def users_get( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def users_get( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def users_get( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._users_get_oapg( - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForget(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def get( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def get( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def get( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def get( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._users_get_oapg( - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/pynitrokey/nethsm/client/paths/users/get/__init__.py b/pynitrokey/nethsm/client/paths/users/get/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/pynitrokey/nethsm/client/paths/users/get/operation.py b/pynitrokey/nethsm/client/paths/users/get/operation.py new file mode 100644 index 00000000..80b744d0 --- /dev/null +++ b/pynitrokey/nethsm/client/paths/users/get/operation.py @@ -0,0 +1,164 @@ +# 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 new file mode 100644 index 00000000..e69de29b 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 new file mode 100644 index 00000000..b2010a34 --- /dev/null +++ b/pynitrokey/nethsm/client/paths/users/get/responses/response_200/__init__.py @@ -0,0 +1,29 @@ +# coding: utf-8 + +""" + Generated 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 new file mode 100644 index 00000000..e69de29b 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 new file mode 100644 index 00000000..e69de29b 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 new file mode 100644 index 00000000..e88a209d --- /dev/null +++ b/pynitrokey/nethsm/client/paths/users/get/responses/response_200/content/application_json/schema.py @@ -0,0 +1,13 @@ +# 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 new file mode 100644 index 00000000..cee35061 --- /dev/null +++ b/pynitrokey/nethsm/client/paths/users/get/responses/response_401/__init__.py @@ -0,0 +1,20 @@ +# coding: utf-8 + +""" + Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator +""" + +from pynitrokey.nethsm.client.shared_imports.response_imports import * # 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 new file mode 100644 index 00000000..7bc0249d --- /dev/null +++ b/pynitrokey/nethsm/client/paths/users/get/responses/response_403/__init__.py @@ -0,0 +1,20 @@ +# coding: utf-8 + +""" + Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator +""" + +from pynitrokey.nethsm.client.shared_imports.response_imports import * # 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 new file mode 100644 index 00000000..088c436c --- /dev/null +++ b/pynitrokey/nethsm/client/paths/users/get/responses/response_406/__init__.py @@ -0,0 +1,20 @@ +# coding: utf-8 + +""" + Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator +""" + +from pynitrokey.nethsm.client.shared_imports.response_imports import * # 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 new file mode 100644 index 00000000..50b6212f --- /dev/null +++ b/pynitrokey/nethsm/client/paths/users/get/responses/response_412/__init__.py @@ -0,0 +1,20 @@ +# coding: utf-8 + +""" + Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator +""" + +from pynitrokey.nethsm.client.shared_imports.response_imports import * # 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 new file mode 100644 index 00000000..e69de29b 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 new file mode 100644 index 00000000..f3b60942 --- /dev/null +++ b/pynitrokey/nethsm/client/paths/users/get/security/security_requirement_object_0.py @@ -0,0 +1,11 @@ +# 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.py b/pynitrokey/nethsm/client/paths/users/post.py deleted file mode 100644 index 24adc78c..00000000 --- a/pynitrokey/nethsm/client/paths/users/post.py +++ /dev/null @@ -1,354 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from pynitrokey.nethsm.client import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from pynitrokey.nethsm.client import schemas # noqa: F401 - -from pynitrokey.nethsm.client.model.user_post_data import UserPostData - -from . import path - -# body param -SchemaForRequestBodyApplicationJson = UserPostData - - -request_body_user_post_data = api_client.RequestBody( - content={ - 'application/json': api_client.MediaType( - schema=SchemaForRequestBodyApplicationJson), - }, - required=True, -) -_auth = [ - 'basic', -] - - -@dataclass -class ApiResponseFor201(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_201 = api_client.OpenApiResponse( - response_cls=ApiResponseFor201, -) - - -@dataclass -class ApiResponseFor400(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_400 = api_client.OpenApiResponse( - response_cls=ApiResponseFor400, -) - - -@dataclass -class ApiResponseFor401(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_401 = api_client.OpenApiResponse( - response_cls=ApiResponseFor401, -) - - -@dataclass -class ApiResponseFor403(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_403 = api_client.OpenApiResponse( - response_cls=ApiResponseFor403, -) - - -@dataclass -class ApiResponseFor412(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_412 = api_client.OpenApiResponse( - response_cls=ApiResponseFor412, -) -_status_code_to_response = { - '201': _response_for_201, - '400': _response_for_400, - '401': _response_for_401, - '403': _response_for_403, - '412': _response_for_412, -} - - -class BaseApi(api_client.Api): - @typing.overload - def _users_post_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor201, - ]: ... - - @typing.overload - def _users_post_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor201, - ]: ... - - - @typing.overload - def _users_post_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _users_post_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor201, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _users_post_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :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.value - - _headers = HTTPHeaderDict() - # TODO add cookie handling - - if body is schemas.unset: - raise exceptions.ApiValueError( - 'The required body parameter has an invalid value of: unset. Set a valid value instead') - _fields = None - _body = None - serialized_data = request_body_user_post_data.serialize(body, content_type) - _headers.add('Content-Type', content_type) - if 'fields' in serialized_data: - _fields = serialized_data['fields'] - elif 'body' in serialized_data: - _body = serialized_data['body'] - response = self.api_client.call_api( - resource_path=used_path, - method='post'.upper(), - headers=_headers, - fields=_fields, - body=_body, - auth_settings=_auth, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class UsersPost(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def users_post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor201, - ]: ... - - @typing.overload - def users_post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor201, - ]: ... - - - @typing.overload - def users_post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def users_post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor201, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def users_post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._users_post_oapg( - body=body, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForpost(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor201, - ]: ... - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor201, - ]: ... - - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor201, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._users_post_oapg( - body=body, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/pynitrokey/nethsm/client/paths/users/post.pyi b/pynitrokey/nethsm/client/paths/users/post.pyi deleted file mode 100644 index c9f4cb88..00000000 --- a/pynitrokey/nethsm/client/paths/users/post.pyi +++ /dev/null @@ -1,342 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from pynitrokey.nethsm.client import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from pynitrokey.nethsm.client import schemas # noqa: F401 - -from pynitrokey.nethsm.client.model.user_post_data import UserPostData - -# body param -SchemaForRequestBodyApplicationJson = UserPostData - - -request_body_user_post_data = api_client.RequestBody( - content={ - 'application/json': api_client.MediaType( - schema=SchemaForRequestBodyApplicationJson), - }, - required=True, -) - - -@dataclass -class ApiResponseFor201(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_201 = api_client.OpenApiResponse( - response_cls=ApiResponseFor201, -) - - -@dataclass -class ApiResponseFor400(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_400 = api_client.OpenApiResponse( - response_cls=ApiResponseFor400, -) - - -@dataclass -class ApiResponseFor401(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_401 = api_client.OpenApiResponse( - response_cls=ApiResponseFor401, -) - - -@dataclass -class ApiResponseFor403(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_403 = api_client.OpenApiResponse( - response_cls=ApiResponseFor403, -) - - -@dataclass -class ApiResponseFor412(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_412 = api_client.OpenApiResponse( - response_cls=ApiResponseFor412, -) - - -class BaseApi(api_client.Api): - @typing.overload - def _users_post_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor201, - ]: ... - - @typing.overload - def _users_post_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor201, - ]: ... - - - @typing.overload - def _users_post_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _users_post_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor201, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _users_post_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :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.value - - _headers = HTTPHeaderDict() - # TODO add cookie handling - - if body is schemas.unset: - raise exceptions.ApiValueError( - 'The required body parameter has an invalid value of: unset. Set a valid value instead') - _fields = None - _body = None - serialized_data = request_body_user_post_data.serialize(body, content_type) - _headers.add('Content-Type', content_type) - if 'fields' in serialized_data: - _fields = serialized_data['fields'] - elif 'body' in serialized_data: - _body = serialized_data['body'] - response = self.api_client.call_api( - resource_path=used_path, - method='post'.upper(), - headers=_headers, - fields=_fields, - body=_body, - auth_settings=_auth, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class UsersPost(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def users_post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor201, - ]: ... - - @typing.overload - def users_post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor201, - ]: ... - - - @typing.overload - def users_post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def users_post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor201, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def users_post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._users_post_oapg( - body=body, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForpost(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor201, - ]: ... - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor201, - ]: ... - - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor201, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._users_post_oapg( - body=body, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/pynitrokey/nethsm/client/paths/users/post/__init__.py b/pynitrokey/nethsm/client/paths/users/post/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/pynitrokey/nethsm/client/paths/users/post/operation.py b/pynitrokey/nethsm/client/paths/users/post/operation.py new file mode 100644 index 00000000..b5d4a97d --- /dev/null +++ b/pynitrokey/nethsm/client/paths/users/post/operation.py @@ -0,0 +1,188 @@ +# 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 new file mode 100644 index 00000000..ad29c4a8 --- /dev/null +++ b/pynitrokey/nethsm/client/paths/users/post/request_body/__init__.py @@ -0,0 +1,20 @@ +# 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 new file mode 100644 index 00000000..e69de29b 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 new file mode 100644 index 00000000..e69de29b 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 new file mode 100644 index 00000000..a532c81f --- /dev/null +++ b/pynitrokey/nethsm/client/paths/users/post/request_body/content/application_json/schema.py @@ -0,0 +1,13 @@ +# 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 new file mode 100644 index 00000000..e69de29b 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 new file mode 100644 index 00000000..dca4edc5 --- /dev/null +++ b/pynitrokey/nethsm/client/paths/users/post/responses/response_201/__init__.py @@ -0,0 +1,20 @@ +# coding: utf-8 + +""" + Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator +""" + +from pynitrokey.nethsm.client.shared_imports.response_imports import * # 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 new file mode 100644 index 00000000..0458793b --- /dev/null +++ b/pynitrokey/nethsm/client/paths/users/post/responses/response_400/__init__.py @@ -0,0 +1,20 @@ +# coding: utf-8 + +""" + Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator +""" + +from pynitrokey.nethsm.client.shared_imports.response_imports import * # 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 new file mode 100644 index 00000000..cee35061 --- /dev/null +++ b/pynitrokey/nethsm/client/paths/users/post/responses/response_401/__init__.py @@ -0,0 +1,20 @@ +# coding: utf-8 + +""" + Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator +""" + +from pynitrokey.nethsm.client.shared_imports.response_imports import * # 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 new file mode 100644 index 00000000..7bc0249d --- /dev/null +++ b/pynitrokey/nethsm/client/paths/users/post/responses/response_403/__init__.py @@ -0,0 +1,20 @@ +# coding: utf-8 + +""" + Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator +""" + +from pynitrokey.nethsm.client.shared_imports.response_imports import * # 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 new file mode 100644 index 00000000..088c436c --- /dev/null +++ b/pynitrokey/nethsm/client/paths/users/post/responses/response_406/__init__.py @@ -0,0 +1,20 @@ +# coding: utf-8 + +""" + Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator +""" + +from pynitrokey.nethsm.client.shared_imports.response_imports import * # 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 new file mode 100644 index 00000000..50b6212f --- /dev/null +++ b/pynitrokey/nethsm/client/paths/users/post/responses/response_412/__init__.py @@ -0,0 +1,20 @@ +# coding: utf-8 + +""" + Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator +""" + +from pynitrokey.nethsm.client.shared_imports.response_imports import * # 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 new file mode 100644 index 00000000..e69de29b 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 new file mode 100644 index 00000000..f3b60942 --- /dev/null +++ b/pynitrokey/nethsm/client/paths/users/post/security/security_requirement_object_0.py @@ -0,0 +1,11 @@ +# 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 index ca582301..78b50211 100644 --- a/pynitrokey/nethsm/client/paths/users_user_id/__init__.py +++ b/pynitrokey/nethsm/client/paths/users_user_id/__init__.py @@ -1,7 +1,5 @@ # 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.paths.users_user_id import Api +# from pynitrokey.nethsm.client.apis.paths.users_user_id import UsersUserID -from pynitrokey.nethsm.client.paths import PathValues - -path = PathValues.USERS_USER_ID \ No newline at end of file +path = "/users/{UserID}" \ No newline at end of file diff --git a/pynitrokey/nethsm/client/paths/users_user_id/delete.py b/pynitrokey/nethsm/client/paths/users_user_id/delete.py deleted file mode 100644 index 5ef94e51..00000000 --- a/pynitrokey/nethsm/client/paths/users_user_id/delete.py +++ /dev/null @@ -1,311 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 - -from pynitrokey.nethsm.client import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from pynitrokey.nethsm.client import schemas # noqa: F401 - -from . import path - -# Path params -UserIDSchema = schemas.StrSchema -RequestRequiredPathParams = typing_extensions.TypedDict( - 'RequestRequiredPathParams', - { - 'UserID': typing.Union[UserIDSchema, str, ], - } -) -RequestOptionalPathParams = typing_extensions.TypedDict( - 'RequestOptionalPathParams', - { - }, - total=False -) - - -class RequestPathParams(RequestRequiredPathParams, RequestOptionalPathParams): - pass - - -request_path_user_id = api_client.PathParameter( - name="UserID", - style=api_client.ParameterStyle.SIMPLE, - schema=UserIDSchema, - required=True, -) -_auth = [ - 'basic', -] - - -@dataclass -class ApiResponseFor204(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_204 = api_client.OpenApiResponse( - response_cls=ApiResponseFor204, -) - - -@dataclass -class ApiResponseFor401(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_401 = api_client.OpenApiResponse( - response_cls=ApiResponseFor401, -) - - -@dataclass -class ApiResponseFor403(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_403 = api_client.OpenApiResponse( - response_cls=ApiResponseFor403, -) - - -@dataclass -class ApiResponseFor404(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_404 = api_client.OpenApiResponse( - response_cls=ApiResponseFor404, -) - - -@dataclass -class ApiResponseFor412(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_412 = api_client.OpenApiResponse( - response_cls=ApiResponseFor412, -) -_status_code_to_response = { - '204': _response_for_204, - '401': _response_for_401, - '403': _response_for_403, - '404': _response_for_404, - '412': _response_for_412, -} - - -class BaseApi(api_client.Api): - @typing.overload - def _users_user_id_delete_oapg( - self, - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor204, - ]: ... - - @typing.overload - def _users_user_id_delete_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _users_user_id_delete_oapg( - self, - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor204, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _users_user_id_delete_oapg( - self, - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :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 - """ - self._verify_typed_dict_inputs_oapg(RequestPathParams, path_params) - used_path = path.value - - _path_params = {} - for parameter in ( - request_path_user_id, - ): - parameter_data = path_params.get(parameter.name, schemas.unset) - if parameter_data is schemas.unset: - continue - serialized_data = parameter.serialize(parameter_data) - _path_params.update(serialized_data) - - for k, v in _path_params.items(): - used_path = used_path.replace('{%s}' % k, v) - # TODO add cookie handling - - response = self.api_client.call_api( - resource_path=used_path, - method='delete'.upper(), - auth_settings=_auth, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class UsersUserIdDelete(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def users_user_id_delete( - self, - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor204, - ]: ... - - @typing.overload - def users_user_id_delete( - self, - skip_deserialization: typing_extensions.Literal[True], - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def users_user_id_delete( - self, - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor204, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def users_user_id_delete( - self, - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._users_user_id_delete_oapg( - path_params=path_params, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiFordelete(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def delete( - self, - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor204, - ]: ... - - @typing.overload - def delete( - self, - skip_deserialization: typing_extensions.Literal[True], - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def delete( - self, - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor204, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def delete( - self, - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._users_user_id_delete_oapg( - path_params=path_params, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/pynitrokey/nethsm/client/paths/users_user_id/delete.pyi b/pynitrokey/nethsm/client/paths/users_user_id/delete.pyi deleted file mode 100644 index e61c61c0..00000000 --- a/pynitrokey/nethsm/client/paths/users_user_id/delete.pyi +++ /dev/null @@ -1,299 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 - -from pynitrokey.nethsm.client import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from pynitrokey.nethsm.client import schemas # noqa: F401 - -# Path params -UserIDSchema = schemas.StrSchema -RequestRequiredPathParams = typing_extensions.TypedDict( - 'RequestRequiredPathParams', - { - 'UserID': typing.Union[UserIDSchema, str, ], - } -) -RequestOptionalPathParams = typing_extensions.TypedDict( - 'RequestOptionalPathParams', - { - }, - total=False -) - - -class RequestPathParams(RequestRequiredPathParams, RequestOptionalPathParams): - pass - - -request_path_user_id = api_client.PathParameter( - name="UserID", - style=api_client.ParameterStyle.SIMPLE, - schema=UserIDSchema, - required=True, -) - - -@dataclass -class ApiResponseFor204(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_204 = api_client.OpenApiResponse( - response_cls=ApiResponseFor204, -) - - -@dataclass -class ApiResponseFor401(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_401 = api_client.OpenApiResponse( - response_cls=ApiResponseFor401, -) - - -@dataclass -class ApiResponseFor403(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_403 = api_client.OpenApiResponse( - response_cls=ApiResponseFor403, -) - - -@dataclass -class ApiResponseFor404(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_404 = api_client.OpenApiResponse( - response_cls=ApiResponseFor404, -) - - -@dataclass -class ApiResponseFor412(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_412 = api_client.OpenApiResponse( - response_cls=ApiResponseFor412, -) - - -class BaseApi(api_client.Api): - @typing.overload - def _users_user_id_delete_oapg( - self, - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor204, - ]: ... - - @typing.overload - def _users_user_id_delete_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _users_user_id_delete_oapg( - self, - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor204, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _users_user_id_delete_oapg( - self, - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :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 - """ - self._verify_typed_dict_inputs_oapg(RequestPathParams, path_params) - used_path = path.value - - _path_params = {} - for parameter in ( - request_path_user_id, - ): - parameter_data = path_params.get(parameter.name, schemas.unset) - if parameter_data is schemas.unset: - continue - serialized_data = parameter.serialize(parameter_data) - _path_params.update(serialized_data) - - for k, v in _path_params.items(): - used_path = used_path.replace('{%s}' % k, v) - # TODO add cookie handling - - response = self.api_client.call_api( - resource_path=used_path, - method='delete'.upper(), - auth_settings=_auth, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class UsersUserIdDelete(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def users_user_id_delete( - self, - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor204, - ]: ... - - @typing.overload - def users_user_id_delete( - self, - skip_deserialization: typing_extensions.Literal[True], - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def users_user_id_delete( - self, - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor204, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def users_user_id_delete( - self, - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._users_user_id_delete_oapg( - path_params=path_params, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiFordelete(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def delete( - self, - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor204, - ]: ... - - @typing.overload - def delete( - self, - skip_deserialization: typing_extensions.Literal[True], - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def delete( - self, - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor204, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def delete( - self, - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._users_user_id_delete_oapg( - path_params=path_params, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/pynitrokey/nethsm/client/paths/users_user_id/delete/__init__.py b/pynitrokey/nethsm/client/paths/users_user_id/delete/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/pynitrokey/nethsm/client/paths/users_user_id/delete/operation.py b/pynitrokey/nethsm/client/paths/users_user_id/delete/operation.py new file mode 100644 index 00000000..381b40fa --- /dev/null +++ b/pynitrokey/nethsm/client/paths/users_user_id/delete/operation.py @@ -0,0 +1,183 @@ +# 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 new file mode 100644 index 00000000..e69de29b 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 new file mode 100644 index 00000000..bba16eb3 --- /dev/null +++ b/pynitrokey/nethsm/client/paths/users_user_id/delete/parameters/parameter_0/__init__.py @@ -0,0 +1,16 @@ +# 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 new file mode 100644 index 00000000..951e9038 --- /dev/null +++ b/pynitrokey/nethsm/client/paths/users_user_id/delete/parameters/parameter_0/schema.py @@ -0,0 +1,13 @@ +# 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 new file mode 100644 index 00000000..02a071af --- /dev/null +++ b/pynitrokey/nethsm/client/paths/users_user_id/delete/path_parameters.py @@ -0,0 +1,100 @@ +# 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 new file mode 100644 index 00000000..e69de29b 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 new file mode 100644 index 00000000..8e822e77 --- /dev/null +++ b/pynitrokey/nethsm/client/paths/users_user_id/delete/responses/response_204/__init__.py @@ -0,0 +1,20 @@ +# coding: utf-8 + +""" + Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator +""" + +from pynitrokey.nethsm.client.shared_imports.response_imports import * # 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 new file mode 100644 index 00000000..cee35061 --- /dev/null +++ b/pynitrokey/nethsm/client/paths/users_user_id/delete/responses/response_401/__init__.py @@ -0,0 +1,20 @@ +# coding: utf-8 + +""" + Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator +""" + +from pynitrokey.nethsm.client.shared_imports.response_imports import * # 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 new file mode 100644 index 00000000..7bc0249d --- /dev/null +++ b/pynitrokey/nethsm/client/paths/users_user_id/delete/responses/response_403/__init__.py @@ -0,0 +1,20 @@ +# coding: utf-8 + +""" + Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator +""" + +from pynitrokey.nethsm.client.shared_imports.response_imports import * # 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 new file mode 100644 index 00000000..e43c74d8 --- /dev/null +++ b/pynitrokey/nethsm/client/paths/users_user_id/delete/responses/response_404/__init__.py @@ -0,0 +1,20 @@ +# coding: utf-8 + +""" + Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator +""" + +from pynitrokey.nethsm.client.shared_imports.response_imports import * # 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 new file mode 100644 index 00000000..088c436c --- /dev/null +++ b/pynitrokey/nethsm/client/paths/users_user_id/delete/responses/response_406/__init__.py @@ -0,0 +1,20 @@ +# coding: utf-8 + +""" + Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator +""" + +from pynitrokey.nethsm.client.shared_imports.response_imports import * # 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 new file mode 100644 index 00000000..50b6212f --- /dev/null +++ b/pynitrokey/nethsm/client/paths/users_user_id/delete/responses/response_412/__init__.py @@ -0,0 +1,20 @@ +# coding: utf-8 + +""" + Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator +""" + +from pynitrokey.nethsm.client.shared_imports.response_imports import * # 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 new file mode 100644 index 00000000..e69de29b 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 new file mode 100644 index 00000000..f3b60942 --- /dev/null +++ b/pynitrokey/nethsm/client/paths/users_user_id/delete/security/security_requirement_object_0.py @@ -0,0 +1,11 @@ +# 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.py b/pynitrokey/nethsm/client/paths/users_user_id/get.py deleted file mode 100644 index ed7c5e1d..00000000 --- a/pynitrokey/nethsm/client/paths/users_user_id/get.py +++ /dev/null @@ -1,344 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from pynitrokey.nethsm.client import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from pynitrokey.nethsm.client import schemas # noqa: F401 - -from pynitrokey.nethsm.client.model.user_data import UserData - -from . import path - -# Path params -UserIDSchema = schemas.StrSchema -RequestRequiredPathParams = typing_extensions.TypedDict( - 'RequestRequiredPathParams', - { - 'UserID': typing.Union[UserIDSchema, str, ], - } -) -RequestOptionalPathParams = typing_extensions.TypedDict( - 'RequestOptionalPathParams', - { - }, - total=False -) - - -class RequestPathParams(RequestRequiredPathParams, RequestOptionalPathParams): - pass - - -request_path_user_id = api_client.PathParameter( - name="UserID", - style=api_client.ParameterStyle.SIMPLE, - schema=UserIDSchema, - required=True, -) -_auth = [ - 'basic', -] -SchemaFor200ResponseBodyApplicationJson = UserData - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: typing.Union[ - SchemaFor200ResponseBodyApplicationJson, - ] - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, - content={ - 'application/json': api_client.MediaType( - schema=SchemaFor200ResponseBodyApplicationJson), - }, -) - - -@dataclass -class ApiResponseFor401(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_401 = api_client.OpenApiResponse( - response_cls=ApiResponseFor401, -) - - -@dataclass -class ApiResponseFor403(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_403 = api_client.OpenApiResponse( - response_cls=ApiResponseFor403, -) - - -@dataclass -class ApiResponseFor404(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_404 = api_client.OpenApiResponse( - response_cls=ApiResponseFor404, -) - - -@dataclass -class ApiResponseFor412(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_412 = api_client.OpenApiResponse( - response_cls=ApiResponseFor412, -) -_status_code_to_response = { - '200': _response_for_200, - '401': _response_for_401, - '403': _response_for_403, - '404': _response_for_404, - '412': _response_for_412, -} -_all_accept_content_types = ( - 'application/json', -) - - -class BaseApi(api_client.Api): - @typing.overload - def _users_user_id_get_oapg( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _users_user_id_get_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _users_user_id_get_oapg( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _users_user_id_get_oapg( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :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 - """ - self._verify_typed_dict_inputs_oapg(RequestPathParams, path_params) - used_path = path.value - - _path_params = {} - for parameter in ( - request_path_user_id, - ): - parameter_data = path_params.get(parameter.name, schemas.unset) - if parameter_data is schemas.unset: - continue - serialized_data = parameter.serialize(parameter_data) - _path_params.update(serialized_data) - - for k, v in _path_params.items(): - used_path = used_path.replace('{%s}' % k, v) - - _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) - - response = self.api_client.call_api( - resource_path=used_path, - method='get'.upper(), - headers=_headers, - auth_settings=_auth, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class UsersUserIdGet(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def users_user_id_get( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def users_user_id_get( - self, - skip_deserialization: typing_extensions.Literal[True], - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def users_user_id_get( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def users_user_id_get( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._users_user_id_get_oapg( - path_params=path_params, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForget(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def get( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def get( - self, - skip_deserialization: typing_extensions.Literal[True], - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def get( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def get( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._users_user_id_get_oapg( - path_params=path_params, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/pynitrokey/nethsm/client/paths/users_user_id/get.pyi b/pynitrokey/nethsm/client/paths/users_user_id/get.pyi deleted file mode 100644 index 03970112..00000000 --- a/pynitrokey/nethsm/client/paths/users_user_id/get.pyi +++ /dev/null @@ -1,332 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from pynitrokey.nethsm.client import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from pynitrokey.nethsm.client import schemas # noqa: F401 - -from pynitrokey.nethsm.client.model.user_data import UserData - -# Path params -UserIDSchema = schemas.StrSchema -RequestRequiredPathParams = typing_extensions.TypedDict( - 'RequestRequiredPathParams', - { - 'UserID': typing.Union[UserIDSchema, str, ], - } -) -RequestOptionalPathParams = typing_extensions.TypedDict( - 'RequestOptionalPathParams', - { - }, - total=False -) - - -class RequestPathParams(RequestRequiredPathParams, RequestOptionalPathParams): - pass - - -request_path_user_id = api_client.PathParameter( - name="UserID", - style=api_client.ParameterStyle.SIMPLE, - schema=UserIDSchema, - required=True, -) -SchemaFor200ResponseBodyApplicationJson = UserData - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: typing.Union[ - SchemaFor200ResponseBodyApplicationJson, - ] - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, - content={ - 'application/json': api_client.MediaType( - schema=SchemaFor200ResponseBodyApplicationJson), - }, -) - - -@dataclass -class ApiResponseFor401(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_401 = api_client.OpenApiResponse( - response_cls=ApiResponseFor401, -) - - -@dataclass -class ApiResponseFor403(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_403 = api_client.OpenApiResponse( - response_cls=ApiResponseFor403, -) - - -@dataclass -class ApiResponseFor404(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_404 = api_client.OpenApiResponse( - response_cls=ApiResponseFor404, -) - - -@dataclass -class ApiResponseFor412(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_412 = api_client.OpenApiResponse( - response_cls=ApiResponseFor412, -) -_all_accept_content_types = ( - 'application/json', -) - - -class BaseApi(api_client.Api): - @typing.overload - def _users_user_id_get_oapg( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _users_user_id_get_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _users_user_id_get_oapg( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _users_user_id_get_oapg( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :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 - """ - self._verify_typed_dict_inputs_oapg(RequestPathParams, path_params) - used_path = path.value - - _path_params = {} - for parameter in ( - request_path_user_id, - ): - parameter_data = path_params.get(parameter.name, schemas.unset) - if parameter_data is schemas.unset: - continue - serialized_data = parameter.serialize(parameter_data) - _path_params.update(serialized_data) - - for k, v in _path_params.items(): - used_path = used_path.replace('{%s}' % k, v) - - _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) - - response = self.api_client.call_api( - resource_path=used_path, - method='get'.upper(), - headers=_headers, - auth_settings=_auth, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class UsersUserIdGet(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def users_user_id_get( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def users_user_id_get( - self, - skip_deserialization: typing_extensions.Literal[True], - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def users_user_id_get( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def users_user_id_get( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._users_user_id_get_oapg( - path_params=path_params, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForget(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def get( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def get( - self, - skip_deserialization: typing_extensions.Literal[True], - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def get( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def get( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._users_user_id_get_oapg( - path_params=path_params, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/pynitrokey/nethsm/client/paths/users_user_id/get/__init__.py b/pynitrokey/nethsm/client/paths/users_user_id/get/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/pynitrokey/nethsm/client/paths/users_user_id/get/operation.py b/pynitrokey/nethsm/client/paths/users_user_id/get/operation.py new file mode 100644 index 00000000..773a6ddf --- /dev/null +++ b/pynitrokey/nethsm/client/paths/users_user_id/get/operation.py @@ -0,0 +1,197 @@ +# 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 new file mode 100644 index 00000000..e69de29b 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 new file mode 100644 index 00000000..bba16eb3 --- /dev/null +++ b/pynitrokey/nethsm/client/paths/users_user_id/get/parameters/parameter_0/__init__.py @@ -0,0 +1,16 @@ +# 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 new file mode 100644 index 00000000..951e9038 --- /dev/null +++ b/pynitrokey/nethsm/client/paths/users_user_id/get/parameters/parameter_0/schema.py @@ -0,0 +1,13 @@ +# 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 new file mode 100644 index 00000000..7bb59cf9 --- /dev/null +++ b/pynitrokey/nethsm/client/paths/users_user_id/get/path_parameters.py @@ -0,0 +1,100 @@ +# 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 new file mode 100644 index 00000000..e69de29b 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 new file mode 100644 index 00000000..60b2f7a5 --- /dev/null +++ b/pynitrokey/nethsm/client/paths/users_user_id/get/responses/response_200/__init__.py @@ -0,0 +1,29 @@ +# coding: utf-8 + +""" + Generated 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 new file mode 100644 index 00000000..e69de29b 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 new file mode 100644 index 00000000..e69de29b 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 new file mode 100644 index 00000000..a08695a4 --- /dev/null +++ b/pynitrokey/nethsm/client/paths/users_user_id/get/responses/response_200/content/application_json/schema.py @@ -0,0 +1,13 @@ +# 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 new file mode 100644 index 00000000..0458793b --- /dev/null +++ b/pynitrokey/nethsm/client/paths/users_user_id/get/responses/response_400/__init__.py @@ -0,0 +1,20 @@ +# coding: utf-8 + +""" + Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator +""" + +from pynitrokey.nethsm.client.shared_imports.response_imports import * # 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 new file mode 100644 index 00000000..cee35061 --- /dev/null +++ b/pynitrokey/nethsm/client/paths/users_user_id/get/responses/response_401/__init__.py @@ -0,0 +1,20 @@ +# coding: utf-8 + +""" + Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator +""" + +from pynitrokey.nethsm.client.shared_imports.response_imports import * # 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 new file mode 100644 index 00000000..7bc0249d --- /dev/null +++ b/pynitrokey/nethsm/client/paths/users_user_id/get/responses/response_403/__init__.py @@ -0,0 +1,20 @@ +# coding: utf-8 + +""" + Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator +""" + +from pynitrokey.nethsm.client.shared_imports.response_imports import * # 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 new file mode 100644 index 00000000..e43c74d8 --- /dev/null +++ b/pynitrokey/nethsm/client/paths/users_user_id/get/responses/response_404/__init__.py @@ -0,0 +1,20 @@ +# coding: utf-8 + +""" + Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator +""" + +from pynitrokey.nethsm.client.shared_imports.response_imports import * # 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 new file mode 100644 index 00000000..088c436c --- /dev/null +++ b/pynitrokey/nethsm/client/paths/users_user_id/get/responses/response_406/__init__.py @@ -0,0 +1,20 @@ +# coding: utf-8 + +""" + Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator +""" + +from pynitrokey.nethsm.client.shared_imports.response_imports import * # 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 new file mode 100644 index 00000000..50b6212f --- /dev/null +++ b/pynitrokey/nethsm/client/paths/users_user_id/get/responses/response_412/__init__.py @@ -0,0 +1,20 @@ +# coding: utf-8 + +""" + Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator +""" + +from pynitrokey.nethsm.client.shared_imports.response_imports import * # 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 new file mode 100644 index 00000000..e69de29b 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 new file mode 100644 index 00000000..f3b60942 --- /dev/null +++ b/pynitrokey/nethsm/client/paths/users_user_id/get/security/security_requirement_object_0.py @@ -0,0 +1,11 @@ +# 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.py b/pynitrokey/nethsm/client/paths/users_user_id/put.py deleted file mode 100644 index 113552cb..00000000 --- a/pynitrokey/nethsm/client/paths/users_user_id/put.py +++ /dev/null @@ -1,424 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from pynitrokey.nethsm.client import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from pynitrokey.nethsm.client import schemas # noqa: F401 - -from pynitrokey.nethsm.client.model.user_post_data import UserPostData - -from . import path - -# Path params -UserIDSchema = schemas.StrSchema -RequestRequiredPathParams = typing_extensions.TypedDict( - 'RequestRequiredPathParams', - { - 'UserID': typing.Union[UserIDSchema, str, ], - } -) -RequestOptionalPathParams = typing_extensions.TypedDict( - 'RequestOptionalPathParams', - { - }, - total=False -) - - -class RequestPathParams(RequestRequiredPathParams, RequestOptionalPathParams): - pass - - -request_path_user_id = api_client.PathParameter( - name="UserID", - style=api_client.ParameterStyle.SIMPLE, - schema=UserIDSchema, - required=True, -) -# body param -SchemaForRequestBodyApplicationJson = UserPostData - - -request_body_user_post_data = api_client.RequestBody( - content={ - 'application/json': api_client.MediaType( - schema=SchemaForRequestBodyApplicationJson), - }, - required=True, -) -_auth = [ - 'basic', -] - - -@dataclass -class ApiResponseFor201(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_201 = api_client.OpenApiResponse( - response_cls=ApiResponseFor201, -) - - -@dataclass -class ApiResponseFor400(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_400 = api_client.OpenApiResponse( - response_cls=ApiResponseFor400, -) - - -@dataclass -class ApiResponseFor401(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_401 = api_client.OpenApiResponse( - response_cls=ApiResponseFor401, -) - - -@dataclass -class ApiResponseFor403(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_403 = api_client.OpenApiResponse( - response_cls=ApiResponseFor403, -) - - -@dataclass -class ApiResponseFor409(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_409 = api_client.OpenApiResponse( - response_cls=ApiResponseFor409, -) - - -@dataclass -class ApiResponseFor412(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_412 = api_client.OpenApiResponse( - response_cls=ApiResponseFor412, -) -_status_code_to_response = { - '201': _response_for_201, - '400': _response_for_400, - '401': _response_for_401, - '403': _response_for_403, - '409': _response_for_409, - '412': _response_for_412, -} - - -class BaseApi(api_client.Api): - @typing.overload - def _users_user_id_put_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor201, - ]: ... - - @typing.overload - def _users_user_id_put_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor201, - ]: ... - - - @typing.overload - def _users_user_id_put_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _users_user_id_put_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor201, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _users_user_id_put_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :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 - """ - self._verify_typed_dict_inputs_oapg(RequestPathParams, path_params) - used_path = path.value - - _path_params = {} - for parameter in ( - request_path_user_id, - ): - parameter_data = path_params.get(parameter.name, schemas.unset) - if parameter_data is schemas.unset: - continue - serialized_data = parameter.serialize(parameter_data) - _path_params.update(serialized_data) - - for k, v in _path_params.items(): - used_path = used_path.replace('{%s}' % k, v) - - _headers = HTTPHeaderDict() - # TODO add cookie handling - - if body is schemas.unset: - raise exceptions.ApiValueError( - 'The required body parameter has an invalid value of: unset. Set a valid value instead') - _fields = None - _body = None - serialized_data = request_body_user_post_data.serialize(body, content_type) - _headers.add('Content-Type', content_type) - if 'fields' in serialized_data: - _fields = serialized_data['fields'] - elif 'body' in serialized_data: - _body = serialized_data['body'] - response = self.api_client.call_api( - resource_path=used_path, - method='put'.upper(), - headers=_headers, - fields=_fields, - body=_body, - auth_settings=_auth, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class UsersUserIdPut(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def users_user_id_put( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor201, - ]: ... - - @typing.overload - def users_user_id_put( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor201, - ]: ... - - - @typing.overload - def users_user_id_put( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def users_user_id_put( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor201, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def users_user_id_put( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._users_user_id_put_oapg( - body=body, - path_params=path_params, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForput(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def put( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor201, - ]: ... - - @typing.overload - def put( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor201, - ]: ... - - - @typing.overload - def put( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def put( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor201, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def put( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._users_user_id_put_oapg( - body=body, - path_params=path_params, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/pynitrokey/nethsm/client/paths/users_user_id/put.pyi b/pynitrokey/nethsm/client/paths/users_user_id/put.pyi deleted file mode 100644 index 6d4a13e1..00000000 --- a/pynitrokey/nethsm/client/paths/users_user_id/put.pyi +++ /dev/null @@ -1,411 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from pynitrokey.nethsm.client import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from pynitrokey.nethsm.client import schemas # noqa: F401 - -from pynitrokey.nethsm.client.model.user_post_data import UserPostData - -# Path params -UserIDSchema = schemas.StrSchema -RequestRequiredPathParams = typing_extensions.TypedDict( - 'RequestRequiredPathParams', - { - 'UserID': typing.Union[UserIDSchema, str, ], - } -) -RequestOptionalPathParams = typing_extensions.TypedDict( - 'RequestOptionalPathParams', - { - }, - total=False -) - - -class RequestPathParams(RequestRequiredPathParams, RequestOptionalPathParams): - pass - - -request_path_user_id = api_client.PathParameter( - name="UserID", - style=api_client.ParameterStyle.SIMPLE, - schema=UserIDSchema, - required=True, -) -# body param -SchemaForRequestBodyApplicationJson = UserPostData - - -request_body_user_post_data = api_client.RequestBody( - content={ - 'application/json': api_client.MediaType( - schema=SchemaForRequestBodyApplicationJson), - }, - required=True, -) - - -@dataclass -class ApiResponseFor201(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_201 = api_client.OpenApiResponse( - response_cls=ApiResponseFor201, -) - - -@dataclass -class ApiResponseFor400(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_400 = api_client.OpenApiResponse( - response_cls=ApiResponseFor400, -) - - -@dataclass -class ApiResponseFor401(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_401 = api_client.OpenApiResponse( - response_cls=ApiResponseFor401, -) - - -@dataclass -class ApiResponseFor403(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_403 = api_client.OpenApiResponse( - response_cls=ApiResponseFor403, -) - - -@dataclass -class ApiResponseFor409(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_409 = api_client.OpenApiResponse( - response_cls=ApiResponseFor409, -) - - -@dataclass -class ApiResponseFor412(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_412 = api_client.OpenApiResponse( - response_cls=ApiResponseFor412, -) - - -class BaseApi(api_client.Api): - @typing.overload - def _users_user_id_put_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor201, - ]: ... - - @typing.overload - def _users_user_id_put_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor201, - ]: ... - - - @typing.overload - def _users_user_id_put_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _users_user_id_put_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor201, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _users_user_id_put_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :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 - """ - self._verify_typed_dict_inputs_oapg(RequestPathParams, path_params) - used_path = path.value - - _path_params = {} - for parameter in ( - request_path_user_id, - ): - parameter_data = path_params.get(parameter.name, schemas.unset) - if parameter_data is schemas.unset: - continue - serialized_data = parameter.serialize(parameter_data) - _path_params.update(serialized_data) - - for k, v in _path_params.items(): - used_path = used_path.replace('{%s}' % k, v) - - _headers = HTTPHeaderDict() - # TODO add cookie handling - - if body is schemas.unset: - raise exceptions.ApiValueError( - 'The required body parameter has an invalid value of: unset. Set a valid value instead') - _fields = None - _body = None - serialized_data = request_body_user_post_data.serialize(body, content_type) - _headers.add('Content-Type', content_type) - if 'fields' in serialized_data: - _fields = serialized_data['fields'] - elif 'body' in serialized_data: - _body = serialized_data['body'] - response = self.api_client.call_api( - resource_path=used_path, - method='put'.upper(), - headers=_headers, - fields=_fields, - body=_body, - auth_settings=_auth, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class UsersUserIdPut(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def users_user_id_put( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor201, - ]: ... - - @typing.overload - def users_user_id_put( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor201, - ]: ... - - - @typing.overload - def users_user_id_put( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def users_user_id_put( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor201, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def users_user_id_put( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._users_user_id_put_oapg( - body=body, - path_params=path_params, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForput(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def put( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor201, - ]: ... - - @typing.overload - def put( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor201, - ]: ... - - - @typing.overload - def put( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def put( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor201, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def put( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._users_user_id_put_oapg( - body=body, - path_params=path_params, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/pynitrokey/nethsm/client/paths/users_user_id/put/__init__.py b/pynitrokey/nethsm/client/paths/users_user_id/put/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/pynitrokey/nethsm/client/paths/users_user_id/put/operation.py b/pynitrokey/nethsm/client/paths/users_user_id/put/operation.py new file mode 100644 index 00000000..6a08d1fe --- /dev/null +++ b/pynitrokey/nethsm/client/paths/users_user_id/put/operation.py @@ -0,0 +1,216 @@ +# 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 new file mode 100644 index 00000000..e69de29b 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 new file mode 100644 index 00000000..bba16eb3 --- /dev/null +++ b/pynitrokey/nethsm/client/paths/users_user_id/put/parameters/parameter_0/__init__.py @@ -0,0 +1,16 @@ +# 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 new file mode 100644 index 00000000..951e9038 --- /dev/null +++ b/pynitrokey/nethsm/client/paths/users_user_id/put/parameters/parameter_0/schema.py @@ -0,0 +1,13 @@ +# 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 new file mode 100644 index 00000000..2a9b2a85 --- /dev/null +++ b/pynitrokey/nethsm/client/paths/users_user_id/put/path_parameters.py @@ -0,0 +1,100 @@ +# 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 new file mode 100644 index 00000000..ad29c4a8 --- /dev/null +++ b/pynitrokey/nethsm/client/paths/users_user_id/put/request_body/__init__.py @@ -0,0 +1,20 @@ +# 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 new file mode 100644 index 00000000..e69de29b 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 new file mode 100644 index 00000000..e69de29b 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 new file mode 100644 index 00000000..a532c81f --- /dev/null +++ b/pynitrokey/nethsm/client/paths/users_user_id/put/request_body/content/application_json/schema.py @@ -0,0 +1,13 @@ +# 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 new file mode 100644 index 00000000..e69de29b 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 new file mode 100644 index 00000000..dca4edc5 --- /dev/null +++ b/pynitrokey/nethsm/client/paths/users_user_id/put/responses/response_201/__init__.py @@ -0,0 +1,20 @@ +# coding: utf-8 + +""" + Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator +""" + +from pynitrokey.nethsm.client.shared_imports.response_imports import * # 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 new file mode 100644 index 00000000..0458793b --- /dev/null +++ b/pynitrokey/nethsm/client/paths/users_user_id/put/responses/response_400/__init__.py @@ -0,0 +1,20 @@ +# coding: utf-8 + +""" + Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator +""" + +from pynitrokey.nethsm.client.shared_imports.response_imports import * # 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 new file mode 100644 index 00000000..cee35061 --- /dev/null +++ b/pynitrokey/nethsm/client/paths/users_user_id/put/responses/response_401/__init__.py @@ -0,0 +1,20 @@ +# coding: utf-8 + +""" + Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator +""" + +from pynitrokey.nethsm.client.shared_imports.response_imports import * # 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 new file mode 100644 index 00000000..7bc0249d --- /dev/null +++ b/pynitrokey/nethsm/client/paths/users_user_id/put/responses/response_403/__init__.py @@ -0,0 +1,20 @@ +# coding: utf-8 + +""" + Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator +""" + +from pynitrokey.nethsm.client.shared_imports.response_imports import * # 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 new file mode 100644 index 00000000..088c436c --- /dev/null +++ b/pynitrokey/nethsm/client/paths/users_user_id/put/responses/response_406/__init__.py @@ -0,0 +1,20 @@ +# coding: utf-8 + +""" + Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator +""" + +from pynitrokey.nethsm.client.shared_imports.response_imports import * # 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 new file mode 100644 index 00000000..ce260df9 --- /dev/null +++ b/pynitrokey/nethsm/client/paths/users_user_id/put/responses/response_409/__init__.py @@ -0,0 +1,20 @@ +# coding: utf-8 + +""" + Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator +""" + +from pynitrokey.nethsm.client.shared_imports.response_imports import * # 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 new file mode 100644 index 00000000..50b6212f --- /dev/null +++ b/pynitrokey/nethsm/client/paths/users_user_id/put/responses/response_412/__init__.py @@ -0,0 +1,20 @@ +# coding: utf-8 + +""" + Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator +""" + +from pynitrokey.nethsm.client.shared_imports.response_imports import * # 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 new file mode 100644 index 00000000..e69de29b 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 new file mode 100644 index 00000000..f3b60942 --- /dev/null +++ b/pynitrokey/nethsm/client/paths/users_user_id/put/security/security_requirement_object_0.py @@ -0,0 +1,11 @@ +# 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 index 2eee02c5..54c98289 100644 --- a/pynitrokey/nethsm/client/paths/users_user_id_passphrase/__init__.py +++ b/pynitrokey/nethsm/client/paths/users_user_id_passphrase/__init__.py @@ -1,7 +1,5 @@ # 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.paths.users_user_id_passphrase import Api +# from pynitrokey.nethsm.client.apis.paths.users_user_id_passphrase import UsersUserIDPassphrase -from pynitrokey.nethsm.client.paths import PathValues - -path = PathValues.USERS_USER_ID_PASSPHRASE \ No newline at end of file +path = "/users/{UserID}/passphrase" \ No newline at end of file diff --git a/pynitrokey/nethsm/client/paths/users_user_id_passphrase/post.py b/pynitrokey/nethsm/client/paths/users_user_id_passphrase/post.py deleted file mode 100644 index 9e7c6413..00000000 --- a/pynitrokey/nethsm/client/paths/users_user_id_passphrase/post.py +++ /dev/null @@ -1,424 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from pynitrokey.nethsm.client import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from pynitrokey.nethsm.client import schemas # noqa: F401 - -from pynitrokey.nethsm.client.model.user_passphrase_post_data import UserPassphrasePostData - -from . import path - -# Path params -UserIDSchema = schemas.StrSchema -RequestRequiredPathParams = typing_extensions.TypedDict( - 'RequestRequiredPathParams', - { - 'UserID': typing.Union[UserIDSchema, str, ], - } -) -RequestOptionalPathParams = typing_extensions.TypedDict( - 'RequestOptionalPathParams', - { - }, - total=False -) - - -class RequestPathParams(RequestRequiredPathParams, RequestOptionalPathParams): - pass - - -request_path_user_id = api_client.PathParameter( - name="UserID", - style=api_client.ParameterStyle.SIMPLE, - schema=UserIDSchema, - required=True, -) -# body param -SchemaForRequestBodyApplicationJson = UserPassphrasePostData - - -request_body_user_passphrase_post_data = api_client.RequestBody( - content={ - 'application/json': api_client.MediaType( - schema=SchemaForRequestBodyApplicationJson), - }, - required=True, -) -_auth = [ - 'basic', -] - - -@dataclass -class ApiResponseFor204(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_204 = api_client.OpenApiResponse( - response_cls=ApiResponseFor204, -) - - -@dataclass -class ApiResponseFor400(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_400 = api_client.OpenApiResponse( - response_cls=ApiResponseFor400, -) - - -@dataclass -class ApiResponseFor401(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_401 = api_client.OpenApiResponse( - response_cls=ApiResponseFor401, -) - - -@dataclass -class ApiResponseFor403(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_403 = api_client.OpenApiResponse( - response_cls=ApiResponseFor403, -) - - -@dataclass -class ApiResponseFor404(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_404 = api_client.OpenApiResponse( - response_cls=ApiResponseFor404, -) - - -@dataclass -class ApiResponseFor412(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_412 = api_client.OpenApiResponse( - response_cls=ApiResponseFor412, -) -_status_code_to_response = { - '204': _response_for_204, - '400': _response_for_400, - '401': _response_for_401, - '403': _response_for_403, - '404': _response_for_404, - '412': _response_for_412, -} - - -class BaseApi(api_client.Api): - @typing.overload - def _users_user_id_passphrase_post_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor204, - ]: ... - - @typing.overload - def _users_user_id_passphrase_post_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor204, - ]: ... - - - @typing.overload - def _users_user_id_passphrase_post_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _users_user_id_passphrase_post_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor204, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _users_user_id_passphrase_post_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :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 - """ - self._verify_typed_dict_inputs_oapg(RequestPathParams, path_params) - used_path = path.value - - _path_params = {} - for parameter in ( - request_path_user_id, - ): - parameter_data = path_params.get(parameter.name, schemas.unset) - if parameter_data is schemas.unset: - continue - serialized_data = parameter.serialize(parameter_data) - _path_params.update(serialized_data) - - for k, v in _path_params.items(): - used_path = used_path.replace('{%s}' % k, v) - - _headers = HTTPHeaderDict() - # TODO add cookie handling - - if body is schemas.unset: - raise exceptions.ApiValueError( - 'The required body parameter has an invalid value of: unset. Set a valid value instead') - _fields = None - _body = None - serialized_data = request_body_user_passphrase_post_data.serialize(body, content_type) - _headers.add('Content-Type', content_type) - if 'fields' in serialized_data: - _fields = serialized_data['fields'] - elif 'body' in serialized_data: - _body = serialized_data['body'] - response = self.api_client.call_api( - resource_path=used_path, - method='post'.upper(), - headers=_headers, - fields=_fields, - body=_body, - auth_settings=_auth, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class UsersUserIdPassphrasePost(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def users_user_id_passphrase_post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor204, - ]: ... - - @typing.overload - def users_user_id_passphrase_post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor204, - ]: ... - - - @typing.overload - def users_user_id_passphrase_post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def users_user_id_passphrase_post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor204, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def users_user_id_passphrase_post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._users_user_id_passphrase_post_oapg( - body=body, - path_params=path_params, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForpost(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor204, - ]: ... - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor204, - ]: ... - - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor204, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._users_user_id_passphrase_post_oapg( - body=body, - path_params=path_params, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/pynitrokey/nethsm/client/paths/users_user_id_passphrase/post.pyi b/pynitrokey/nethsm/client/paths/users_user_id_passphrase/post.pyi deleted file mode 100644 index 7185f604..00000000 --- a/pynitrokey/nethsm/client/paths/users_user_id_passphrase/post.pyi +++ /dev/null @@ -1,411 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from pynitrokey.nethsm.client import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from pynitrokey.nethsm.client import schemas # noqa: F401 - -from pynitrokey.nethsm.client.model.user_passphrase_post_data import UserPassphrasePostData - -# Path params -UserIDSchema = schemas.StrSchema -RequestRequiredPathParams = typing_extensions.TypedDict( - 'RequestRequiredPathParams', - { - 'UserID': typing.Union[UserIDSchema, str, ], - } -) -RequestOptionalPathParams = typing_extensions.TypedDict( - 'RequestOptionalPathParams', - { - }, - total=False -) - - -class RequestPathParams(RequestRequiredPathParams, RequestOptionalPathParams): - pass - - -request_path_user_id = api_client.PathParameter( - name="UserID", - style=api_client.ParameterStyle.SIMPLE, - schema=UserIDSchema, - required=True, -) -# body param -SchemaForRequestBodyApplicationJson = UserPassphrasePostData - - -request_body_user_passphrase_post_data = api_client.RequestBody( - content={ - 'application/json': api_client.MediaType( - schema=SchemaForRequestBodyApplicationJson), - }, - required=True, -) - - -@dataclass -class ApiResponseFor204(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_204 = api_client.OpenApiResponse( - response_cls=ApiResponseFor204, -) - - -@dataclass -class ApiResponseFor400(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_400 = api_client.OpenApiResponse( - response_cls=ApiResponseFor400, -) - - -@dataclass -class ApiResponseFor401(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_401 = api_client.OpenApiResponse( - response_cls=ApiResponseFor401, -) - - -@dataclass -class ApiResponseFor403(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_403 = api_client.OpenApiResponse( - response_cls=ApiResponseFor403, -) - - -@dataclass -class ApiResponseFor404(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_404 = api_client.OpenApiResponse( - response_cls=ApiResponseFor404, -) - - -@dataclass -class ApiResponseFor412(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_412 = api_client.OpenApiResponse( - response_cls=ApiResponseFor412, -) - - -class BaseApi(api_client.Api): - @typing.overload - def _users_user_id_passphrase_post_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor204, - ]: ... - - @typing.overload - def _users_user_id_passphrase_post_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor204, - ]: ... - - - @typing.overload - def _users_user_id_passphrase_post_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _users_user_id_passphrase_post_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor204, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _users_user_id_passphrase_post_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :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 - """ - self._verify_typed_dict_inputs_oapg(RequestPathParams, path_params) - used_path = path.value - - _path_params = {} - for parameter in ( - request_path_user_id, - ): - parameter_data = path_params.get(parameter.name, schemas.unset) - if parameter_data is schemas.unset: - continue - serialized_data = parameter.serialize(parameter_data) - _path_params.update(serialized_data) - - for k, v in _path_params.items(): - used_path = used_path.replace('{%s}' % k, v) - - _headers = HTTPHeaderDict() - # TODO add cookie handling - - if body is schemas.unset: - raise exceptions.ApiValueError( - 'The required body parameter has an invalid value of: unset. Set a valid value instead') - _fields = None - _body = None - serialized_data = request_body_user_passphrase_post_data.serialize(body, content_type) - _headers.add('Content-Type', content_type) - if 'fields' in serialized_data: - _fields = serialized_data['fields'] - elif 'body' in serialized_data: - _body = serialized_data['body'] - response = self.api_client.call_api( - resource_path=used_path, - method='post'.upper(), - headers=_headers, - fields=_fields, - body=_body, - auth_settings=_auth, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class UsersUserIdPassphrasePost(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def users_user_id_passphrase_post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor204, - ]: ... - - @typing.overload - def users_user_id_passphrase_post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor204, - ]: ... - - - @typing.overload - def users_user_id_passphrase_post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def users_user_id_passphrase_post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor204, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def users_user_id_passphrase_post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._users_user_id_passphrase_post_oapg( - body=body, - path_params=path_params, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForpost(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor204, - ]: ... - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor204, - ]: ... - - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor204, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def post( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._users_user_id_passphrase_post_oapg( - body=body, - path_params=path_params, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - 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 new file mode 100644 index 00000000..e69de29b 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 new file mode 100644 index 00000000..fd676435 --- /dev/null +++ b/pynitrokey/nethsm/client/paths/users_user_id_passphrase/post/operation.py @@ -0,0 +1,216 @@ +# 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 new file mode 100644 index 00000000..e69de29b 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 new file mode 100644 index 00000000..bba16eb3 --- /dev/null +++ b/pynitrokey/nethsm/client/paths/users_user_id_passphrase/post/parameters/parameter_0/__init__.py @@ -0,0 +1,16 @@ +# 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 new file mode 100644 index 00000000..951e9038 --- /dev/null +++ b/pynitrokey/nethsm/client/paths/users_user_id_passphrase/post/parameters/parameter_0/schema.py @@ -0,0 +1,13 @@ +# 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 new file mode 100644 index 00000000..0e5c38ed --- /dev/null +++ b/pynitrokey/nethsm/client/paths/users_user_id_passphrase/post/path_parameters.py @@ -0,0 +1,100 @@ +# 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 new file mode 100644 index 00000000..ad29c4a8 --- /dev/null +++ b/pynitrokey/nethsm/client/paths/users_user_id_passphrase/post/request_body/__init__.py @@ -0,0 +1,20 @@ +# 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 new file mode 100644 index 00000000..e69de29b 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 new file mode 100644 index 00000000..e69de29b 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 new file mode 100644 index 00000000..5121d31c --- /dev/null +++ b/pynitrokey/nethsm/client/paths/users_user_id_passphrase/post/request_body/content/application_json/schema.py @@ -0,0 +1,13 @@ +# 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 new file mode 100644 index 00000000..e69de29b 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 new file mode 100644 index 00000000..8e822e77 --- /dev/null +++ b/pynitrokey/nethsm/client/paths/users_user_id_passphrase/post/responses/response_204/__init__.py @@ -0,0 +1,20 @@ +# coding: utf-8 + +""" + Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator +""" + +from pynitrokey.nethsm.client.shared_imports.response_imports import * # 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 new file mode 100644 index 00000000..0458793b --- /dev/null +++ b/pynitrokey/nethsm/client/paths/users_user_id_passphrase/post/responses/response_400/__init__.py @@ -0,0 +1,20 @@ +# coding: utf-8 + +""" + Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator +""" + +from pynitrokey.nethsm.client.shared_imports.response_imports import * # 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 new file mode 100644 index 00000000..cee35061 --- /dev/null +++ b/pynitrokey/nethsm/client/paths/users_user_id_passphrase/post/responses/response_401/__init__.py @@ -0,0 +1,20 @@ +# coding: utf-8 + +""" + Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator +""" + +from pynitrokey.nethsm.client.shared_imports.response_imports import * # 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 new file mode 100644 index 00000000..7bc0249d --- /dev/null +++ b/pynitrokey/nethsm/client/paths/users_user_id_passphrase/post/responses/response_403/__init__.py @@ -0,0 +1,20 @@ +# coding: utf-8 + +""" + Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator +""" + +from pynitrokey.nethsm.client.shared_imports.response_imports import * # 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 new file mode 100644 index 00000000..e43c74d8 --- /dev/null +++ b/pynitrokey/nethsm/client/paths/users_user_id_passphrase/post/responses/response_404/__init__.py @@ -0,0 +1,20 @@ +# coding: utf-8 + +""" + Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator +""" + +from pynitrokey.nethsm.client.shared_imports.response_imports import * # 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 new file mode 100644 index 00000000..088c436c --- /dev/null +++ b/pynitrokey/nethsm/client/paths/users_user_id_passphrase/post/responses/response_406/__init__.py @@ -0,0 +1,20 @@ +# coding: utf-8 + +""" + Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator +""" + +from pynitrokey.nethsm.client.shared_imports.response_imports import * # 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 new file mode 100644 index 00000000..50b6212f --- /dev/null +++ b/pynitrokey/nethsm/client/paths/users_user_id_passphrase/post/responses/response_412/__init__.py @@ -0,0 +1,20 @@ +# coding: utf-8 + +""" + Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator +""" + +from pynitrokey.nethsm.client.shared_imports.response_imports import * # 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 new file mode 100644 index 00000000..e69de29b 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 new file mode 100644 index 00000000..f3b60942 --- /dev/null +++ b/pynitrokey/nethsm/client/paths/users_user_id_passphrase/post/security/security_requirement_object_0.py @@ -0,0 +1,11 @@ +# 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 index 798d384c..ad90ff4f 100644 --- a/pynitrokey/nethsm/client/paths/users_user_id_tags/__init__.py +++ b/pynitrokey/nethsm/client/paths/users_user_id_tags/__init__.py @@ -1,7 +1,5 @@ # 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.paths.users_user_id_tags import Api +# from pynitrokey.nethsm.client.apis.paths.users_user_id_tags import UsersUserIDTags -from pynitrokey.nethsm.client.paths import PathValues - -path = PathValues.USERS_USER_ID_TAGS \ No newline at end of file +path = "/users/{UserID}/tags" \ No newline at end of file diff --git a/pynitrokey/nethsm/client/paths/users_user_id_tags/get.py b/pynitrokey/nethsm/client/paths/users_user_id_tags/get.py deleted file mode 100644 index 543c727a..00000000 --- a/pynitrokey/nethsm/client/paths/users_user_id_tags/get.py +++ /dev/null @@ -1,344 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from pynitrokey.nethsm.client import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from pynitrokey.nethsm.client import schemas # noqa: F401 - -from pynitrokey.nethsm.client.model.tag_list import TagList - -from . import path - -# Path params -UserIDSchema = schemas.StrSchema -RequestRequiredPathParams = typing_extensions.TypedDict( - 'RequestRequiredPathParams', - { - 'UserID': typing.Union[UserIDSchema, str, ], - } -) -RequestOptionalPathParams = typing_extensions.TypedDict( - 'RequestOptionalPathParams', - { - }, - total=False -) - - -class RequestPathParams(RequestRequiredPathParams, RequestOptionalPathParams): - pass - - -request_path_user_id = api_client.PathParameter( - name="UserID", - style=api_client.ParameterStyle.SIMPLE, - schema=UserIDSchema, - required=True, -) -_auth = [ - 'basic', -] -SchemaFor200ResponseBodyApplicationJson = TagList - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: typing.Union[ - SchemaFor200ResponseBodyApplicationJson, - ] - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, - content={ - 'application/json': api_client.MediaType( - schema=SchemaFor200ResponseBodyApplicationJson), - }, -) - - -@dataclass -class ApiResponseFor401(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_401 = api_client.OpenApiResponse( - response_cls=ApiResponseFor401, -) - - -@dataclass -class ApiResponseFor403(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_403 = api_client.OpenApiResponse( - response_cls=ApiResponseFor403, -) - - -@dataclass -class ApiResponseFor404(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_404 = api_client.OpenApiResponse( - response_cls=ApiResponseFor404, -) - - -@dataclass -class ApiResponseFor412(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_412 = api_client.OpenApiResponse( - response_cls=ApiResponseFor412, -) -_status_code_to_response = { - '200': _response_for_200, - '401': _response_for_401, - '403': _response_for_403, - '404': _response_for_404, - '412': _response_for_412, -} -_all_accept_content_types = ( - 'application/json', -) - - -class BaseApi(api_client.Api): - @typing.overload - def _users_user_id_tags_get_oapg( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _users_user_id_tags_get_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _users_user_id_tags_get_oapg( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _users_user_id_tags_get_oapg( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :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 - """ - self._verify_typed_dict_inputs_oapg(RequestPathParams, path_params) - used_path = path.value - - _path_params = {} - for parameter in ( - request_path_user_id, - ): - parameter_data = path_params.get(parameter.name, schemas.unset) - if parameter_data is schemas.unset: - continue - serialized_data = parameter.serialize(parameter_data) - _path_params.update(serialized_data) - - for k, v in _path_params.items(): - used_path = used_path.replace('{%s}' % k, v) - - _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) - - response = self.api_client.call_api( - resource_path=used_path, - method='get'.upper(), - headers=_headers, - auth_settings=_auth, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class UsersUserIdTagsGet(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def users_user_id_tags_get( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def users_user_id_tags_get( - self, - skip_deserialization: typing_extensions.Literal[True], - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def users_user_id_tags_get( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def users_user_id_tags_get( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._users_user_id_tags_get_oapg( - path_params=path_params, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForget(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def get( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def get( - self, - skip_deserialization: typing_extensions.Literal[True], - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def get( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def get( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._users_user_id_tags_get_oapg( - path_params=path_params, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/pynitrokey/nethsm/client/paths/users_user_id_tags/get.pyi b/pynitrokey/nethsm/client/paths/users_user_id_tags/get.pyi deleted file mode 100644 index 35cc73c0..00000000 --- a/pynitrokey/nethsm/client/paths/users_user_id_tags/get.pyi +++ /dev/null @@ -1,332 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from pynitrokey.nethsm.client import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from pynitrokey.nethsm.client import schemas # noqa: F401 - -from pynitrokey.nethsm.client.model.tag_list import TagList - -# Path params -UserIDSchema = schemas.StrSchema -RequestRequiredPathParams = typing_extensions.TypedDict( - 'RequestRequiredPathParams', - { - 'UserID': typing.Union[UserIDSchema, str, ], - } -) -RequestOptionalPathParams = typing_extensions.TypedDict( - 'RequestOptionalPathParams', - { - }, - total=False -) - - -class RequestPathParams(RequestRequiredPathParams, RequestOptionalPathParams): - pass - - -request_path_user_id = api_client.PathParameter( - name="UserID", - style=api_client.ParameterStyle.SIMPLE, - schema=UserIDSchema, - required=True, -) -SchemaFor200ResponseBodyApplicationJson = TagList - - -@dataclass -class ApiResponseFor200(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: typing.Union[ - SchemaFor200ResponseBodyApplicationJson, - ] - headers: schemas.Unset = schemas.unset - - -_response_for_200 = api_client.OpenApiResponse( - response_cls=ApiResponseFor200, - content={ - 'application/json': api_client.MediaType( - schema=SchemaFor200ResponseBodyApplicationJson), - }, -) - - -@dataclass -class ApiResponseFor401(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_401 = api_client.OpenApiResponse( - response_cls=ApiResponseFor401, -) - - -@dataclass -class ApiResponseFor403(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_403 = api_client.OpenApiResponse( - response_cls=ApiResponseFor403, -) - - -@dataclass -class ApiResponseFor404(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_404 = api_client.OpenApiResponse( - response_cls=ApiResponseFor404, -) - - -@dataclass -class ApiResponseFor412(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_412 = api_client.OpenApiResponse( - response_cls=ApiResponseFor412, -) -_all_accept_content_types = ( - 'application/json', -) - - -class BaseApi(api_client.Api): - @typing.overload - def _users_user_id_tags_get_oapg( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _users_user_id_tags_get_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _users_user_id_tags_get_oapg( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _users_user_id_tags_get_oapg( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :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 - """ - self._verify_typed_dict_inputs_oapg(RequestPathParams, path_params) - used_path = path.value - - _path_params = {} - for parameter in ( - request_path_user_id, - ): - parameter_data = path_params.get(parameter.name, schemas.unset) - if parameter_data is schemas.unset: - continue - serialized_data = parameter.serialize(parameter_data) - _path_params.update(serialized_data) - - for k, v in _path_params.items(): - used_path = used_path.replace('{%s}' % k, v) - - _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) - - response = self.api_client.call_api( - resource_path=used_path, - method='get'.upper(), - headers=_headers, - auth_settings=_auth, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class UsersUserIdTagsGet(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def users_user_id_tags_get( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def users_user_id_tags_get( - self, - skip_deserialization: typing_extensions.Literal[True], - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def users_user_id_tags_get( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def users_user_id_tags_get( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._users_user_id_tags_get_oapg( - path_params=path_params, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForget(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def get( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def get( - self, - skip_deserialization: typing_extensions.Literal[True], - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def get( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def get( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._users_user_id_tags_get_oapg( - path_params=path_params, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - 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 new file mode 100644 index 00000000..e69de29b 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 new file mode 100644 index 00000000..f212dcf1 --- /dev/null +++ b/pynitrokey/nethsm/client/paths/users_user_id_tags/get/operation.py @@ -0,0 +1,197 @@ +# 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 new file mode 100644 index 00000000..e69de29b 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 new file mode 100644 index 00000000..bba16eb3 --- /dev/null +++ b/pynitrokey/nethsm/client/paths/users_user_id_tags/get/parameters/parameter_0/__init__.py @@ -0,0 +1,16 @@ +# 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 new file mode 100644 index 00000000..951e9038 --- /dev/null +++ b/pynitrokey/nethsm/client/paths/users_user_id_tags/get/parameters/parameter_0/schema.py @@ -0,0 +1,13 @@ +# 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 new file mode 100644 index 00000000..27609661 --- /dev/null +++ b/pynitrokey/nethsm/client/paths/users_user_id_tags/get/path_parameters.py @@ -0,0 +1,100 @@ +# 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 new file mode 100644 index 00000000..e69de29b 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 new file mode 100644 index 00000000..02c74bb4 --- /dev/null +++ b/pynitrokey/nethsm/client/paths/users_user_id_tags/get/responses/response_200/__init__.py @@ -0,0 +1,29 @@ +# coding: utf-8 + +""" + Generated 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 new file mode 100644 index 00000000..e69de29b 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 new file mode 100644 index 00000000..e69de29b 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 new file mode 100644 index 00000000..9086ed6f --- /dev/null +++ b/pynitrokey/nethsm/client/paths/users_user_id_tags/get/responses/response_200/content/application_json/schema.py @@ -0,0 +1,13 @@ +# 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 new file mode 100644 index 00000000..0458793b --- /dev/null +++ b/pynitrokey/nethsm/client/paths/users_user_id_tags/get/responses/response_400/__init__.py @@ -0,0 +1,20 @@ +# coding: utf-8 + +""" + Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator +""" + +from pynitrokey.nethsm.client.shared_imports.response_imports import * # 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 new file mode 100644 index 00000000..cee35061 --- /dev/null +++ b/pynitrokey/nethsm/client/paths/users_user_id_tags/get/responses/response_401/__init__.py @@ -0,0 +1,20 @@ +# coding: utf-8 + +""" + Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator +""" + +from pynitrokey.nethsm.client.shared_imports.response_imports import * # 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 new file mode 100644 index 00000000..7bc0249d --- /dev/null +++ b/pynitrokey/nethsm/client/paths/users_user_id_tags/get/responses/response_403/__init__.py @@ -0,0 +1,20 @@ +# coding: utf-8 + +""" + Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator +""" + +from pynitrokey.nethsm.client.shared_imports.response_imports import * # 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 new file mode 100644 index 00000000..e43c74d8 --- /dev/null +++ b/pynitrokey/nethsm/client/paths/users_user_id_tags/get/responses/response_404/__init__.py @@ -0,0 +1,20 @@ +# coding: utf-8 + +""" + Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator +""" + +from pynitrokey.nethsm.client.shared_imports.response_imports import * # 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 new file mode 100644 index 00000000..088c436c --- /dev/null +++ b/pynitrokey/nethsm/client/paths/users_user_id_tags/get/responses/response_406/__init__.py @@ -0,0 +1,20 @@ +# coding: utf-8 + +""" + Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator +""" + +from pynitrokey.nethsm.client.shared_imports.response_imports import * # 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 new file mode 100644 index 00000000..50b6212f --- /dev/null +++ b/pynitrokey/nethsm/client/paths/users_user_id_tags/get/responses/response_412/__init__.py @@ -0,0 +1,20 @@ +# coding: utf-8 + +""" + Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator +""" + +from pynitrokey.nethsm.client.shared_imports.response_imports import * # 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 new file mode 100644 index 00000000..e69de29b 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 new file mode 100644 index 00000000..f3b60942 --- /dev/null +++ b/pynitrokey/nethsm/client/paths/users_user_id_tags/get/security/security_requirement_object_0.py @@ -0,0 +1,11 @@ +# 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 index c9f0f635..fa912c1a 100644 --- a/pynitrokey/nethsm/client/paths/users_user_id_tags_tag/__init__.py +++ b/pynitrokey/nethsm/client/paths/users_user_id_tags_tag/__init__.py @@ -1,7 +1,5 @@ # 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.paths.users_user_id_tags_tag import Api +# from pynitrokey.nethsm.client.apis.paths.users_user_id_tags_tag import UsersUserIDTagsTag -from pynitrokey.nethsm.client.paths import PathValues - -path = PathValues.USERS_USER_ID_TAGS_TAG \ No newline at end of file +path = "/users/{UserID}/tags/{Tag}" \ No newline at end of file diff --git a/pynitrokey/nethsm/client/paths/users_user_id_tags_tag/delete.py b/pynitrokey/nethsm/client/paths/users_user_id_tags_tag/delete.py deleted file mode 100644 index 56e52889..00000000 --- a/pynitrokey/nethsm/client/paths/users_user_id_tags_tag/delete.py +++ /dev/null @@ -1,320 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 - -from pynitrokey.nethsm.client import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from pynitrokey.nethsm.client import schemas # noqa: F401 - -from . import path - -# Path params -UserIDSchema = schemas.StrSchema -TagSchema = schemas.StrSchema -RequestRequiredPathParams = typing_extensions.TypedDict( - 'RequestRequiredPathParams', - { - 'UserID': typing.Union[UserIDSchema, str, ], - 'Tag': typing.Union[TagSchema, str, ], - } -) -RequestOptionalPathParams = typing_extensions.TypedDict( - 'RequestOptionalPathParams', - { - }, - total=False -) - - -class RequestPathParams(RequestRequiredPathParams, RequestOptionalPathParams): - pass - - -request_path_user_id = api_client.PathParameter( - name="UserID", - style=api_client.ParameterStyle.SIMPLE, - schema=UserIDSchema, - required=True, -) -request_path_tag = api_client.PathParameter( - name="Tag", - style=api_client.ParameterStyle.SIMPLE, - schema=TagSchema, - required=True, -) -_auth = [ - 'basic', -] - - -@dataclass -class ApiResponseFor204(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_204 = api_client.OpenApiResponse( - response_cls=ApiResponseFor204, -) - - -@dataclass -class ApiResponseFor401(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_401 = api_client.OpenApiResponse( - response_cls=ApiResponseFor401, -) - - -@dataclass -class ApiResponseFor403(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_403 = api_client.OpenApiResponse( - response_cls=ApiResponseFor403, -) - - -@dataclass -class ApiResponseFor404(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_404 = api_client.OpenApiResponse( - response_cls=ApiResponseFor404, -) - - -@dataclass -class ApiResponseFor412(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_412 = api_client.OpenApiResponse( - response_cls=ApiResponseFor412, -) -_status_code_to_response = { - '204': _response_for_204, - '401': _response_for_401, - '403': _response_for_403, - '404': _response_for_404, - '412': _response_for_412, -} - - -class BaseApi(api_client.Api): - @typing.overload - def _users_user_id_tags_tag_delete_oapg( - self, - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor204, - ]: ... - - @typing.overload - def _users_user_id_tags_tag_delete_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _users_user_id_tags_tag_delete_oapg( - self, - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor204, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _users_user_id_tags_tag_delete_oapg( - self, - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :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 - """ - self._verify_typed_dict_inputs_oapg(RequestPathParams, path_params) - used_path = path.value - - _path_params = {} - for parameter in ( - request_path_user_id, - request_path_tag, - ): - parameter_data = path_params.get(parameter.name, schemas.unset) - if parameter_data is schemas.unset: - continue - serialized_data = parameter.serialize(parameter_data) - _path_params.update(serialized_data) - - for k, v in _path_params.items(): - used_path = used_path.replace('{%s}' % k, v) - # TODO add cookie handling - - response = self.api_client.call_api( - resource_path=used_path, - method='delete'.upper(), - auth_settings=_auth, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class UsersUserIdTagsTagDelete(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def users_user_id_tags_tag_delete( - self, - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor204, - ]: ... - - @typing.overload - def users_user_id_tags_tag_delete( - self, - skip_deserialization: typing_extensions.Literal[True], - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def users_user_id_tags_tag_delete( - self, - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor204, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def users_user_id_tags_tag_delete( - self, - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._users_user_id_tags_tag_delete_oapg( - path_params=path_params, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiFordelete(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def delete( - self, - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor204, - ]: ... - - @typing.overload - def delete( - self, - skip_deserialization: typing_extensions.Literal[True], - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def delete( - self, - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor204, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def delete( - self, - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._users_user_id_tags_tag_delete_oapg( - path_params=path_params, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/pynitrokey/nethsm/client/paths/users_user_id_tags_tag/delete.pyi b/pynitrokey/nethsm/client/paths/users_user_id_tags_tag/delete.pyi deleted file mode 100644 index c79c3b4d..00000000 --- a/pynitrokey/nethsm/client/paths/users_user_id_tags_tag/delete.pyi +++ /dev/null @@ -1,308 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 - -from pynitrokey.nethsm.client import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from pynitrokey.nethsm.client import schemas # noqa: F401 - -# Path params -UserIDSchema = schemas.StrSchema -TagSchema = schemas.StrSchema -RequestRequiredPathParams = typing_extensions.TypedDict( - 'RequestRequiredPathParams', - { - 'UserID': typing.Union[UserIDSchema, str, ], - 'Tag': typing.Union[TagSchema, str, ], - } -) -RequestOptionalPathParams = typing_extensions.TypedDict( - 'RequestOptionalPathParams', - { - }, - total=False -) - - -class RequestPathParams(RequestRequiredPathParams, RequestOptionalPathParams): - pass - - -request_path_user_id = api_client.PathParameter( - name="UserID", - style=api_client.ParameterStyle.SIMPLE, - schema=UserIDSchema, - required=True, -) -request_path_tag = api_client.PathParameter( - name="Tag", - style=api_client.ParameterStyle.SIMPLE, - schema=TagSchema, - required=True, -) - - -@dataclass -class ApiResponseFor204(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_204 = api_client.OpenApiResponse( - response_cls=ApiResponseFor204, -) - - -@dataclass -class ApiResponseFor401(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_401 = api_client.OpenApiResponse( - response_cls=ApiResponseFor401, -) - - -@dataclass -class ApiResponseFor403(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_403 = api_client.OpenApiResponse( - response_cls=ApiResponseFor403, -) - - -@dataclass -class ApiResponseFor404(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_404 = api_client.OpenApiResponse( - response_cls=ApiResponseFor404, -) - - -@dataclass -class ApiResponseFor412(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_412 = api_client.OpenApiResponse( - response_cls=ApiResponseFor412, -) - - -class BaseApi(api_client.Api): - @typing.overload - def _users_user_id_tags_tag_delete_oapg( - self, - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor204, - ]: ... - - @typing.overload - def _users_user_id_tags_tag_delete_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _users_user_id_tags_tag_delete_oapg( - self, - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor204, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _users_user_id_tags_tag_delete_oapg( - self, - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :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 - """ - self._verify_typed_dict_inputs_oapg(RequestPathParams, path_params) - used_path = path.value - - _path_params = {} - for parameter in ( - request_path_user_id, - request_path_tag, - ): - parameter_data = path_params.get(parameter.name, schemas.unset) - if parameter_data is schemas.unset: - continue - serialized_data = parameter.serialize(parameter_data) - _path_params.update(serialized_data) - - for k, v in _path_params.items(): - used_path = used_path.replace('{%s}' % k, v) - # TODO add cookie handling - - response = self.api_client.call_api( - resource_path=used_path, - method='delete'.upper(), - auth_settings=_auth, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class UsersUserIdTagsTagDelete(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def users_user_id_tags_tag_delete( - self, - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor204, - ]: ... - - @typing.overload - def users_user_id_tags_tag_delete( - self, - skip_deserialization: typing_extensions.Literal[True], - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def users_user_id_tags_tag_delete( - self, - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor204, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def users_user_id_tags_tag_delete( - self, - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._users_user_id_tags_tag_delete_oapg( - path_params=path_params, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiFordelete(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def delete( - self, - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor204, - ]: ... - - @typing.overload - def delete( - self, - skip_deserialization: typing_extensions.Literal[True], - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def delete( - self, - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor204, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def delete( - self, - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._users_user_id_tags_tag_delete_oapg( - path_params=path_params, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - 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 new file mode 100644 index 00000000..e69de29b 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 new file mode 100644 index 00000000..398ceab5 --- /dev/null +++ b/pynitrokey/nethsm/client/paths/users_user_id_tags_tag/delete/operation.py @@ -0,0 +1,187 @@ +# 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 new file mode 100644 index 00000000..e69de29b 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 new file mode 100644 index 00000000..bba16eb3 --- /dev/null +++ b/pynitrokey/nethsm/client/paths/users_user_id_tags_tag/delete/parameters/parameter_0/__init__.py @@ -0,0 +1,16 @@ +# 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 new file mode 100644 index 00000000..951e9038 --- /dev/null +++ b/pynitrokey/nethsm/client/paths/users_user_id_tags_tag/delete/parameters/parameter_0/schema.py @@ -0,0 +1,13 @@ +# 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 new file mode 100644 index 00000000..818efeef --- /dev/null +++ b/pynitrokey/nethsm/client/paths/users_user_id_tags_tag/delete/parameters/parameter_1/__init__.py @@ -0,0 +1,16 @@ +# 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 new file mode 100644 index 00000000..951e9038 --- /dev/null +++ b/pynitrokey/nethsm/client/paths/users_user_id_tags_tag/delete/parameters/parameter_1/schema.py @@ -0,0 +1,13 @@ +# 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 new file mode 100644 index 00000000..402ac9f4 --- /dev/null +++ b/pynitrokey/nethsm/client/paths/users_user_id_tags_tag/delete/path_parameters.py @@ -0,0 +1,113 @@ +# 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 new file mode 100644 index 00000000..e69de29b 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 new file mode 100644 index 00000000..8e822e77 --- /dev/null +++ b/pynitrokey/nethsm/client/paths/users_user_id_tags_tag/delete/responses/response_204/__init__.py @@ -0,0 +1,20 @@ +# coding: utf-8 + +""" + Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator +""" + +from pynitrokey.nethsm.client.shared_imports.response_imports import * # 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 new file mode 100644 index 00000000..cee35061 --- /dev/null +++ b/pynitrokey/nethsm/client/paths/users_user_id_tags_tag/delete/responses/response_401/__init__.py @@ -0,0 +1,20 @@ +# coding: utf-8 + +""" + Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator +""" + +from pynitrokey.nethsm.client.shared_imports.response_imports import * # 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 new file mode 100644 index 00000000..7bc0249d --- /dev/null +++ b/pynitrokey/nethsm/client/paths/users_user_id_tags_tag/delete/responses/response_403/__init__.py @@ -0,0 +1,20 @@ +# coding: utf-8 + +""" + Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator +""" + +from pynitrokey.nethsm.client.shared_imports.response_imports import * # 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 new file mode 100644 index 00000000..e43c74d8 --- /dev/null +++ b/pynitrokey/nethsm/client/paths/users_user_id_tags_tag/delete/responses/response_404/__init__.py @@ -0,0 +1,20 @@ +# coding: utf-8 + +""" + Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator +""" + +from pynitrokey.nethsm.client.shared_imports.response_imports import * # 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 new file mode 100644 index 00000000..088c436c --- /dev/null +++ b/pynitrokey/nethsm/client/paths/users_user_id_tags_tag/delete/responses/response_406/__init__.py @@ -0,0 +1,20 @@ +# coding: utf-8 + +""" + Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator +""" + +from pynitrokey.nethsm.client.shared_imports.response_imports import * # 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 new file mode 100644 index 00000000..50b6212f --- /dev/null +++ b/pynitrokey/nethsm/client/paths/users_user_id_tags_tag/delete/responses/response_412/__init__.py @@ -0,0 +1,20 @@ +# coding: utf-8 + +""" + Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator +""" + +from pynitrokey.nethsm.client.shared_imports.response_imports import * # 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 new file mode 100644 index 00000000..e69de29b 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 new file mode 100644 index 00000000..f3b60942 --- /dev/null +++ b/pynitrokey/nethsm/client/paths/users_user_id_tags_tag/delete/security/security_requirement_object_0.py @@ -0,0 +1,11 @@ +# 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.py b/pynitrokey/nethsm/client/paths/users_user_id_tags_tag/put.py deleted file mode 100644 index b2322d88..00000000 --- a/pynitrokey/nethsm/client/paths/users_user_id_tags_tag/put.py +++ /dev/null @@ -1,346 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 - -from pynitrokey.nethsm.client import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from pynitrokey.nethsm.client import schemas # noqa: F401 - -from . import path - -# Path params -UserIDSchema = schemas.StrSchema -TagSchema = schemas.StrSchema -RequestRequiredPathParams = typing_extensions.TypedDict( - 'RequestRequiredPathParams', - { - 'UserID': typing.Union[UserIDSchema, str, ], - 'Tag': typing.Union[TagSchema, str, ], - } -) -RequestOptionalPathParams = typing_extensions.TypedDict( - 'RequestOptionalPathParams', - { - }, - total=False -) - - -class RequestPathParams(RequestRequiredPathParams, RequestOptionalPathParams): - pass - - -request_path_user_id = api_client.PathParameter( - name="UserID", - style=api_client.ParameterStyle.SIMPLE, - schema=UserIDSchema, - required=True, -) -request_path_tag = api_client.PathParameter( - name="Tag", - style=api_client.ParameterStyle.SIMPLE, - schema=TagSchema, - required=True, -) -_auth = [ - 'basic', -] - - -@dataclass -class ApiResponseFor204(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_204 = api_client.OpenApiResponse( - response_cls=ApiResponseFor204, -) - - -@dataclass -class ApiResponseFor304(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_304 = api_client.OpenApiResponse( - response_cls=ApiResponseFor304, -) - - -@dataclass -class ApiResponseFor400(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_400 = api_client.OpenApiResponse( - response_cls=ApiResponseFor400, -) - - -@dataclass -class ApiResponseFor401(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_401 = api_client.OpenApiResponse( - response_cls=ApiResponseFor401, -) - - -@dataclass -class ApiResponseFor403(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_403 = api_client.OpenApiResponse( - response_cls=ApiResponseFor403, -) - - -@dataclass -class ApiResponseFor404(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_404 = api_client.OpenApiResponse( - response_cls=ApiResponseFor404, -) - - -@dataclass -class ApiResponseFor412(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_412 = api_client.OpenApiResponse( - response_cls=ApiResponseFor412, -) -_status_code_to_response = { - '204': _response_for_204, - '304': _response_for_304, - '400': _response_for_400, - '401': _response_for_401, - '403': _response_for_403, - '404': _response_for_404, - '412': _response_for_412, -} - - -class BaseApi(api_client.Api): - @typing.overload - def _users_user_id_tags_tag_put_oapg( - self, - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor204, - ]: ... - - @typing.overload - def _users_user_id_tags_tag_put_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _users_user_id_tags_tag_put_oapg( - self, - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor204, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _users_user_id_tags_tag_put_oapg( - self, - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :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 - """ - self._verify_typed_dict_inputs_oapg(RequestPathParams, path_params) - used_path = path.value - - _path_params = {} - for parameter in ( - request_path_user_id, - request_path_tag, - ): - parameter_data = path_params.get(parameter.name, schemas.unset) - if parameter_data is schemas.unset: - continue - serialized_data = parameter.serialize(parameter_data) - _path_params.update(serialized_data) - - for k, v in _path_params.items(): - used_path = used_path.replace('{%s}' % k, v) - # TODO add cookie handling - - response = self.api_client.call_api( - resource_path=used_path, - method='put'.upper(), - auth_settings=_auth, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class UsersUserIdTagsTagPut(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def users_user_id_tags_tag_put( - self, - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor204, - ]: ... - - @typing.overload - def users_user_id_tags_tag_put( - self, - skip_deserialization: typing_extensions.Literal[True], - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def users_user_id_tags_tag_put( - self, - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor204, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def users_user_id_tags_tag_put( - self, - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._users_user_id_tags_tag_put_oapg( - path_params=path_params, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForput(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def put( - self, - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor204, - ]: ... - - @typing.overload - def put( - self, - skip_deserialization: typing_extensions.Literal[True], - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def put( - self, - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor204, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def put( - self, - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._users_user_id_tags_tag_put_oapg( - path_params=path_params, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - diff --git a/pynitrokey/nethsm/client/paths/users_user_id_tags_tag/put.pyi b/pynitrokey/nethsm/client/paths/users_user_id_tags_tag/put.pyi deleted file mode 100644 index b52dcab0..00000000 --- a/pynitrokey/nethsm/client/paths/users_user_id_tags_tag/put.pyi +++ /dev/null @@ -1,332 +0,0 @@ -# coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - -from dataclasses import dataclass -import typing_extensions -import urllib3 - -from pynitrokey.nethsm.client import api_client, exceptions -from datetime import date, datetime # noqa: F401 -import decimal # noqa: F401 -import functools # noqa: F401 -import io # noqa: F401 -import re # noqa: F401 -import typing # noqa: F401 -import typing_extensions # noqa: F401 -import uuid # noqa: F401 - -import frozendict # noqa: F401 - -from pynitrokey.nethsm.client import schemas # noqa: F401 - -# Path params -UserIDSchema = schemas.StrSchema -TagSchema = schemas.StrSchema -RequestRequiredPathParams = typing_extensions.TypedDict( - 'RequestRequiredPathParams', - { - 'UserID': typing.Union[UserIDSchema, str, ], - 'Tag': typing.Union[TagSchema, str, ], - } -) -RequestOptionalPathParams = typing_extensions.TypedDict( - 'RequestOptionalPathParams', - { - }, - total=False -) - - -class RequestPathParams(RequestRequiredPathParams, RequestOptionalPathParams): - pass - - -request_path_user_id = api_client.PathParameter( - name="UserID", - style=api_client.ParameterStyle.SIMPLE, - schema=UserIDSchema, - required=True, -) -request_path_tag = api_client.PathParameter( - name="Tag", - style=api_client.ParameterStyle.SIMPLE, - schema=TagSchema, - required=True, -) - - -@dataclass -class ApiResponseFor204(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_204 = api_client.OpenApiResponse( - response_cls=ApiResponseFor204, -) - - -@dataclass -class ApiResponseFor304(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_304 = api_client.OpenApiResponse( - response_cls=ApiResponseFor304, -) - - -@dataclass -class ApiResponseFor400(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_400 = api_client.OpenApiResponse( - response_cls=ApiResponseFor400, -) - - -@dataclass -class ApiResponseFor401(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_401 = api_client.OpenApiResponse( - response_cls=ApiResponseFor401, -) - - -@dataclass -class ApiResponseFor403(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_403 = api_client.OpenApiResponse( - response_cls=ApiResponseFor403, -) - - -@dataclass -class ApiResponseFor404(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_404 = api_client.OpenApiResponse( - response_cls=ApiResponseFor404, -) - - -@dataclass -class ApiResponseFor412(api_client.ApiResponse): - response: urllib3.HTTPResponse - body: schemas.Unset = schemas.unset - headers: schemas.Unset = schemas.unset - - -_response_for_412 = api_client.OpenApiResponse( - response_cls=ApiResponseFor412, -) - - -class BaseApi(api_client.Api): - @typing.overload - def _users_user_id_tags_tag_put_oapg( - self, - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor204, - ]: ... - - @typing.overload - def _users_user_id_tags_tag_put_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _users_user_id_tags_tag_put_oapg( - self, - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor204, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _users_user_id_tags_tag_put_oapg( - self, - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - """ - :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 - """ - self._verify_typed_dict_inputs_oapg(RequestPathParams, path_params) - used_path = path.value - - _path_params = {} - for parameter in ( - request_path_user_id, - request_path_tag, - ): - parameter_data = path_params.get(parameter.name, schemas.unset) - if parameter_data is schemas.unset: - continue - serialized_data = parameter.serialize(parameter_data) - _path_params.update(serialized_data) - - for k, v in _path_params.items(): - used_path = used_path.replace('{%s}' % k, v) - # TODO add cookie handling - - response = self.api_client.call_api( - resource_path=used_path, - method='put'.upper(), - auth_settings=_auth, - stream=stream, - timeout=timeout, - ) - - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) - - if not 200 <= response.status <= 299: - raise exceptions.ApiException(api_response=api_response) - - return api_response - - -class UsersUserIdTagsTagPut(BaseApi): - # this class is used by api classes that refer to endpoints with operationId fn names - - @typing.overload - def users_user_id_tags_tag_put( - self, - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor204, - ]: ... - - @typing.overload - def users_user_id_tags_tag_put( - self, - skip_deserialization: typing_extensions.Literal[True], - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def users_user_id_tags_tag_put( - self, - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor204, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def users_user_id_tags_tag_put( - self, - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._users_user_id_tags_tag_put_oapg( - path_params=path_params, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - -class ApiForput(BaseApi): - # this class is used by api classes that refer to endpoints by path and http method names - - @typing.overload - def put( - self, - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor204, - ]: ... - - @typing.overload - def put( - self, - skip_deserialization: typing_extensions.Literal[True], - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def put( - self, - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor204, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def put( - self, - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._users_user_id_tags_tag_put_oapg( - path_params=path_params, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) - - 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 new file mode 100644 index 00000000..e69de29b 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 new file mode 100644 index 00000000..1784d1ea --- /dev/null +++ b/pynitrokey/nethsm/client/paths/users_user_id_tags_tag/put/operation.py @@ -0,0 +1,200 @@ +# 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 new file mode 100644 index 00000000..e69de29b 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 new file mode 100644 index 00000000..bba16eb3 --- /dev/null +++ b/pynitrokey/nethsm/client/paths/users_user_id_tags_tag/put/parameters/parameter_0/__init__.py @@ -0,0 +1,16 @@ +# 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 new file mode 100644 index 00000000..951e9038 --- /dev/null +++ b/pynitrokey/nethsm/client/paths/users_user_id_tags_tag/put/parameters/parameter_0/schema.py @@ -0,0 +1,13 @@ +# 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 new file mode 100644 index 00000000..818efeef --- /dev/null +++ b/pynitrokey/nethsm/client/paths/users_user_id_tags_tag/put/parameters/parameter_1/__init__.py @@ -0,0 +1,16 @@ +# 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 new file mode 100644 index 00000000..951e9038 --- /dev/null +++ b/pynitrokey/nethsm/client/paths/users_user_id_tags_tag/put/parameters/parameter_1/schema.py @@ -0,0 +1,13 @@ +# 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 new file mode 100644 index 00000000..4eeef40e --- /dev/null +++ b/pynitrokey/nethsm/client/paths/users_user_id_tags_tag/put/path_parameters.py @@ -0,0 +1,113 @@ +# 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 new file mode 100644 index 00000000..e69de29b 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 new file mode 100644 index 00000000..8e822e77 --- /dev/null +++ b/pynitrokey/nethsm/client/paths/users_user_id_tags_tag/put/responses/response_204/__init__.py @@ -0,0 +1,20 @@ +# coding: utf-8 + +""" + Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator +""" + +from pynitrokey.nethsm.client.shared_imports.response_imports import * # 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 new file mode 100644 index 00000000..287e3265 --- /dev/null +++ b/pynitrokey/nethsm/client/paths/users_user_id_tags_tag/put/responses/response_304/__init__.py @@ -0,0 +1,20 @@ +# coding: utf-8 + +""" + Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator +""" + +from pynitrokey.nethsm.client.shared_imports.response_imports import * # 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 new file mode 100644 index 00000000..0458793b --- /dev/null +++ b/pynitrokey/nethsm/client/paths/users_user_id_tags_tag/put/responses/response_400/__init__.py @@ -0,0 +1,20 @@ +# coding: utf-8 + +""" + Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator +""" + +from pynitrokey.nethsm.client.shared_imports.response_imports import * # 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 new file mode 100644 index 00000000..cee35061 --- /dev/null +++ b/pynitrokey/nethsm/client/paths/users_user_id_tags_tag/put/responses/response_401/__init__.py @@ -0,0 +1,20 @@ +# coding: utf-8 + +""" + Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator +""" + +from pynitrokey.nethsm.client.shared_imports.response_imports import * # 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 new file mode 100644 index 00000000..7bc0249d --- /dev/null +++ b/pynitrokey/nethsm/client/paths/users_user_id_tags_tag/put/responses/response_403/__init__.py @@ -0,0 +1,20 @@ +# coding: utf-8 + +""" + Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator +""" + +from pynitrokey.nethsm.client.shared_imports.response_imports import * # 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 new file mode 100644 index 00000000..e43c74d8 --- /dev/null +++ b/pynitrokey/nethsm/client/paths/users_user_id_tags_tag/put/responses/response_404/__init__.py @@ -0,0 +1,20 @@ +# coding: utf-8 + +""" + Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator +""" + +from pynitrokey.nethsm.client.shared_imports.response_imports import * # 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 new file mode 100644 index 00000000..088c436c --- /dev/null +++ b/pynitrokey/nethsm/client/paths/users_user_id_tags_tag/put/responses/response_406/__init__.py @@ -0,0 +1,20 @@ +# coding: utf-8 + +""" + Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator +""" + +from pynitrokey.nethsm.client.shared_imports.response_imports import * # 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 new file mode 100644 index 00000000..50b6212f --- /dev/null +++ b/pynitrokey/nethsm/client/paths/users_user_id_tags_tag/put/responses/response_412/__init__.py @@ -0,0 +1,20 @@ +# coding: utf-8 + +""" + Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator +""" + +from pynitrokey.nethsm.client.shared_imports.response_imports import * # 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 new file mode 100644 index 00000000..e69de29b 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 new file mode 100644 index 00000000..f3b60942 --- /dev/null +++ b/pynitrokey/nethsm/client/paths/users_user_id_tags_tag/put/security/security_requirement_object_0.py @@ -0,0 +1,11 @@ +# 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 new file mode 100644 index 00000000..e69de29b diff --git a/pynitrokey/nethsm/client/rest.py b/pynitrokey/nethsm/client/rest.py index 3273be51..fb4ce1ff 100644 --- a/pynitrokey/nethsm/client/rest.py +++ b/pynitrokey/nethsm/client/rest.py @@ -2,11 +2,9 @@ """ 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 encoded values are Big Endian. # noqa: E501 - + 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://openapi-generator.tech + Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator """ import logging @@ -14,14 +12,34 @@ from urllib.parse import urlencode import typing -import certifi +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.exceptions import ApiException, ApiValueError +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): @@ -91,10 +109,10 @@ def request( method: str, url: str, headers: typing.Optional[HTTPHeaderDict] = None, - fields: typing.Optional[typing.Tuple[typing.Tuple[str, typing.Any], ...]] = 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, typing.Tuple]] = None, + timeout: typing.Optional[typing.Union[int, float, typing.Tuple]] = None, ) -> urllib3.HTTPResponse: """Perform requests. @@ -113,44 +131,42 @@ def request( timeout. It can also be a pair (tuple) of (connection, read) timeouts. """ - method = method.upper() assert method in ['GET', 'HEAD', 'DELETE', 'POST', 'PUT', 'PATCH', 'OPTIONS'] if fields and body: - raise ApiValueError( + raise exceptions.ApiValueError( "body parameter cannot be used with fields parameter." ) - fields = fields or {} - headers = headers or {} + headers = headers or HTTPHeaderDict() + used_timeout: typing.Optional[urllib3.Timeout] = None if timeout: - if isinstance(timeout, (int, float)): # noqa: E501,F821 - timeout = urllib3.Timeout(total=timeout) + if isinstance(timeout, (int, float)): + used_timeout = urllib3.Timeout(total=timeout) elif (isinstance(timeout, tuple) and len(timeout) == 2): - timeout = urllib3.Timeout(connect=timeout[0], read=timeout[1]) + 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 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=timeout, + 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, - fields=fields, encode_multipart=False, preload_content=not stream, - timeout=timeout, + timeout=used_timeout, headers=headers) elif headers['Content-Type'] == 'multipart/form-data': # must del headers['Content-Type'], or the correct @@ -162,7 +178,7 @@ def request( fields=fields, encode_multipart=True, preload_content=not stream, - timeout=timeout, + timeout=used_timeout, headers=headers) # Pass a `string` parameter directly in the body to support # other content types than Json when `body` argument is @@ -173,23 +189,23 @@ def request( method, url, body=request_body, preload_content=not stream, - timeout=timeout, + 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 ApiException(status=0, reason=msg) + raise exceptions.ApiException(status=0, reason=msg) # For `GET`, `HEAD` else: r = self.pool_manager.request(method, url, preload_content=not stream, - timeout=timeout, + timeout=used_timeout, headers=headers) - except urllib3.exceptions.SSLError as e: + except urllib3_exceptions.SSLError as e: msg = "{0}\n{1}".format(type(e).__name__, str(e)) - raise ApiException(status=0, reason=msg) + raise exceptions.ApiException(status=0, reason=msg) if not stream: # log response body @@ -197,7 +213,7 @@ def request( return r - def GET(self, url, headers=None, stream=False, + def get(self, url, headers=None, stream=False, timeout=None, fields=None) -> urllib3.HTTPResponse: return self.request("GET", url, headers=headers, @@ -205,7 +221,7 @@ def GET(self, url, headers=None, stream=False, timeout=timeout, fields=fields) - def HEAD(self, url, headers=None, stream=False, + def head(self, url, headers=None, stream=False, timeout=None, fields=None) -> urllib3.HTTPResponse: return self.request("HEAD", url, headers=headers, @@ -213,7 +229,7 @@ def HEAD(self, url, headers=None, stream=False, timeout=timeout, fields=fields) - def OPTIONS(self, url, headers=None, + def options(self, url, headers=None, body=None, stream=False, timeout=None, fields=None) -> urllib3.HTTPResponse: return self.request("OPTIONS", url, headers=headers, @@ -221,7 +237,7 @@ def OPTIONS(self, url, headers=None, timeout=timeout, body=body, fields=fields) - def DELETE(self, url, headers=None, body=None, + def delete(self, url, headers=None, body=None, stream=False, timeout=None, fields=None) -> urllib3.HTTPResponse: return self.request("DELETE", url, headers=headers, @@ -229,7 +245,7 @@ def DELETE(self, url, headers=None, body=None, timeout=timeout, body=body, fields=fields) - def POST(self, url, headers=None, + def post(self, url, headers=None, body=None, stream=False, timeout=None, fields=None) -> urllib3.HTTPResponse: return self.request("POST", url, headers=headers, @@ -237,7 +253,7 @@ def POST(self, url, headers=None, timeout=timeout, body=body, fields=fields) - def PUT(self, url, headers=None, + def put(self, url, headers=None, body=None, stream=False, timeout=None, fields=None) -> urllib3.HTTPResponse: return self.request("PUT", url, headers=headers, @@ -245,7 +261,7 @@ def PUT(self, url, headers=None, timeout=timeout, body=body, fields=fields) - def PATCH(self, url, headers=None, + def patch(self, url, headers=None, body=None, stream=False, timeout=None, fields=None) -> urllib3.HTTPResponse: return self.request("PATCH", url, headers=headers, diff --git a/pynitrokey/nethsm/client/schemas.py b/pynitrokey/nethsm/client/schemas.py deleted file mode 100644 index 40edf583..00000000 --- a/pynitrokey/nethsm/client/schemas.py +++ /dev/null @@ -1,2462 +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 encoded values are Big Endian. # noqa: E501 - - The version of the OpenAPI document: v1 - Generated by: https://openapi-generator.tech -""" - -from collections import defaultdict -from datetime import date, datetime, timedelta # noqa: F401 -import functools -import decimal -import io -import re -import types -import typing -import uuid - -from dateutil.parser.isoparser import isoparser, _takes_ascii -import frozendict - -from pynitrokey.nethsm.client.exceptions import ( - ApiTypeError, - ApiValueError, -) -from pynitrokey.nethsm.client.configuration import ( - Configuration, -) - - -class Unset(object): - """ - 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() - -none_type = type(None) -file_type = io.IOBase - - -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 ApiValueError('Invalid file state; file is closed and must be open') - arg.close() - inst = super(FileIO, cls).__new__(cls, arg.name) - super(FileIO, inst).__init__(arg.name) - return inst - raise ApiValueError('FileIO must be passed arg which contains the open file') - - def __init__(self, arg: typing.Union[io.FileIO, io.BufferedReader]): - pass - - -def update(d: dict, u: dict): - """ - Adds u to d - Where each dict is defaultdict(set) - """ - if not u: - return d - for k, v in u.items(): - if k not in d: - d[k] = v - else: - d[k] = d[k] | v - - -class ValidationMetadata(frozendict.frozendict): - """ - A class storing metadata that is needed to validate OpenApi Schema payloads - """ - def __new__( - cls, - path_to_item: typing.Tuple[typing.Union[str, int], ...] = tuple(['args[0]']), - from_server: bool = False, - configuration: typing.Optional[Configuration] = None, - seen_classes: typing.FrozenSet[typing.Type] = frozenset(), - validated_path_to_schemas: typing.Dict[typing.Tuple[typing.Union[str, int], ...], typing.Set[typing.Type]] = frozendict.frozendict() - ): - """ - Args: - path_to_item: the path to the current data being instantiated. - For {'a': [1]} if the code is handling, 1, then the path is ('args[0]', 'a', 0) - This changes from location to location - from_server: whether or not this data came form the server - True when receiving server data - False when instantiating model with client side data not form the server - This does not change from location to location - configuration: the Configuration instance to use - This is needed because in Configuration: - - one can disable validation checking - This does not change from location to location - seen_classes: when deserializing data that matches multiple schemas, this is used to store - the schemas that have been traversed. This is used to stop processing when a cycle is seen. - This changes from location to location - validated_path_to_schemas: stores the already validated schema classes for a given path location - This does not change from location to location - """ - return super().__new__( - cls, - path_to_item=path_to_item, - from_server=from_server, - configuration=configuration, - seen_classes=seen_classes, - validated_path_to_schemas=validated_path_to_schemas - ) - - def validation_ran_earlier(self, cls: type) -> bool: - validated_schemas = self.validated_path_to_schemas.get(self.path_to_item, set()) - validation_ran_earlier = validated_schemas and cls in validated_schemas - if validation_ran_earlier: - return True - if cls in self.seen_classes: - return True - return False - - @property - def path_to_item(self) -> typing.Tuple[typing.Union[str, int], ...]: - return self.get('path_to_item') - - @property - def from_server(self) -> bool: - return self.get('from_server') - - @property - def configuration(self) -> typing.Optional[Configuration]: - return self.get('configuration') - - @property - def seen_classes(self) -> typing.FrozenSet[typing.Type]: - return self.get('seen_classes') - - @property - def validated_path_to_schemas(self) -> typing.Dict[typing.Tuple[typing.Union[str, int], ...], typing.Set[typing.Type]]: - return self.get('validated_path_to_schemas') - - -class Singleton: - """ - Enums and singletons are the same - The same instance is returned for a given key of (cls, arg) - """ - _instances = {} - - def __new__(cls, arg: typing.Any, **kwargs): - """ - 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, str(arg)) - if key not in cls._instances: - if isinstance(arg, (none_type, bool, BoolClass, NoneClass)): - inst = super().__new__(cls) - cls._instances[key] = inst - else: - cls._instances[key] = super().__new__(cls, arg) - return cls._instances[key] - - def __repr__(self): - if isinstance(self, NoneClass): - return f'<{self.__class__.__name__}: None>' - elif isinstance(self, BoolClass): - if bool(self): - return f'<{self.__class__.__name__}: True>' - return f'<{self.__class__.__name__}: False>' - return f'<{self.__class__.__name__}: {super().__repr__()}>' - - -class classproperty: - - def __init__(self, fget): - self.fget = fget - - def __get__(self, owner_self, owner_cls): - return self.fget(owner_cls) - - -class NoneClass(Singleton): - @classproperty - def NONE(cls): - return cls(None) - - def __bool__(self) -> bool: - return False - - -class BoolClass(Singleton): - @classproperty - def TRUE(cls): - return cls(True) - - @classproperty - def FALSE(cls): - return cls(False) - - @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') - - -class MetaOapgTyped: - exclusive_maximum: typing.Union[int, float] - inclusive_maximum: typing.Union[int, float] - exclusive_minimum: typing.Union[int, float] - inclusive_minimum: typing.Union[int, float] - max_items: int - min_items: int - discriminator: typing.Dict[str, typing.Dict[str, typing.Type['Schema']]] - - - class properties: - # to hold object properties - pass - - additional_properties: typing.Optional[typing.Type['Schema']] - max_properties: int - min_properties: int - all_of: typing.List[typing.Type['Schema']] - one_of: typing.List[typing.Type['Schema']] - any_of: typing.List[typing.Type['Schema']] - not_schema: typing.Type['Schema'] - max_length: int - min_length: int - items: typing.Type['Schema'] - - -class Schema: - """ - the base class of all swagger/openapi schemas/models - """ - __inheritable_primitive_types_set = {decimal.Decimal, str, tuple, frozendict.frozendict, FileIO, bytes, BoolClass, NoneClass} - _types: typing.Set[typing.Type] - MetaOapg = MetaOapgTyped - - @staticmethod - 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)) - - @staticmethod - def _get_class_oapg(item_cls: typing.Union[types.FunctionType, staticmethod, typing.Type['Schema']]) -> typing.Type['Schema']: - if isinstance(item_cls, types.FunctionType): - # referenced schema - return item_cls() - elif isinstance(item_cls, staticmethod): - # referenced schema - return item_cls.__func__() - return item_cls - - @classmethod - def __type_error_message( - cls, 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 = cls.__get_valid_classes_phrase(valid_classes) - msg = "Invalid type. Required {1} type {2} and " "passed type was {3}".format( - var_name, - key_or_value, - valid_classes_phrase, - type(var_value).__name__, - ) - return msg - - @classmethod - def __get_type_error(cls, var_value, path_to_item, valid_classes, key_type=False): - error_msg = cls.__type_error_message( - var_name=path_to_item[-1], - var_value=var_value, - valid_classes=valid_classes, - key_type=key_type, - ) - return ApiTypeError( - error_msg, - path_to_item=path_to_item, - valid_classes=valid_classes, - key_type=key_type, - ) - - @classmethod - def _validate_oapg( - cls, - arg, - validation_metadata: ValidationMetadata, - ) -> typing.Dict[typing.Tuple[typing.Union[str, int], ...], typing.Set[typing.Union['Schema', str, decimal.Decimal, BoolClass, NoneClass, frozendict.frozendict, tuple]]]: - """ - Schema _validate_oapg - 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 - - Returns: - path_to_schemas: a map of path to schemas - - Raises: - ApiValueError: when a string can't be converted into a date or datetime and it must be one of those classes - ApiTypeError: when the input type is not in the list of allowed spec types - """ - base_class = type(arg) - if base_class not in cls._types: - raise cls.__get_type_error( - arg, - validation_metadata.path_to_item, - cls._types, - key_type=False, - ) - - path_to_schemas = {validation_metadata.path_to_item: set()} - path_to_schemas[validation_metadata.path_to_item].add(cls) - path_to_schemas[validation_metadata.path_to_item].add(base_class) - return path_to_schemas - - @staticmethod - def _process_schema_classes_oapg( - schema_classes: typing.Set[typing.Union['Schema', str, decimal.Decimal, BoolClass, NoneClass, frozendict.frozendict, tuple]] - ): - """ - Processes and mutates schema_classes - If a SomeSchema is a subclass of DictSchema then remove DictSchema because it is already included - """ - if len(schema_classes) < 2: - return - if len(schema_classes) > 2 and UnsetAnyTypeSchema in schema_classes: - schema_classes.remove(UnsetAnyTypeSchema) - x_schema = schema_type_classes & schema_classes - if not x_schema: - return - x_schema = x_schema.pop() - if any(c is not x_schema and issubclass(c, x_schema) for c in schema_classes): - # needed to not have a mro error in get_new_class - schema_classes.remove(x_schema) - - @classmethod - def __get_new_cls( - cls, - arg, - validation_metadata: ValidationMetadata - ) -> typing.Dict[typing.Tuple[typing.Union[str, int], ...], typing.Type['Schema']]: - """ - Make a new dynamic class and return an instance of that class - We are making an instance of cls, but instead of making cls - make a new class, new_cls - which includes dynamic bases including cls - return an instance of that new class - - Dict property + List Item Assignment Use cases: - 1. value is NOT an instance of the required schema class - the value is validated by _validate_oapg - _validate_oapg returns a key value pair - where the key is the path to the item, and the value will be the required manufactured class - made out of the matching schemas - 2. value is an instance of the the correct schema type - the value is NOT validated by _validate_oapg, _validate_oapg only checks that the instance is of the correct schema type - for this value, _validate_oapg does NOT return an entry for it in _path_to_schemas - and in list/dict _get_items_oapg,_get_properties_oapg the value will be directly assigned - because value is of the correct type, and validation was run earlier when the instance was created - """ - _path_to_schemas = {} - if validation_metadata.validated_path_to_schemas: - update(_path_to_schemas, validation_metadata.validated_path_to_schemas) - if not validation_metadata.validation_ran_earlier(cls): - other_path_to_schemas = cls._validate_oapg(arg, validation_metadata=validation_metadata) - 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 = {} - for path, schema_classes in _path_to_schemas.items(): - """ - Use cases - 1. N number of schema classes + enum + type != bool/None, classes in path_to_schemas: tuple/frozendict.frozendict/str/Decimal/bytes/FileIo - needs Singleton added - 2. N number of schema classes + enum + type == bool/None, classes in path_to_schemas: BoolClass/NoneClass - Singleton already added - 3. N number of schema classes, classes in path_to_schemas: BoolClass/NoneClass/tuple/frozendict.frozendict/str/Decimal/bytes/FileIo - """ - cls._process_schema_classes_oapg(schema_classes) - enum_schema = any( - issubclass(this_cls, EnumBase) for this_cls in schema_classes) - inheritable_primitive_type = schema_classes.intersection(cls.__inheritable_primitive_types_set) - chosen_schema_classes = schema_classes - inheritable_primitive_type - suffix = tuple(inheritable_primitive_type) - if enum_schema and suffix[0] not in {NoneClass, BoolClass}: - suffix = (Singleton,) + suffix - - used_classes = tuple(sorted(chosen_schema_classes, key=lambda a_cls: a_cls.__name__)) + suffix - mfg_cls = get_new_class(class_name='DynamicSchema', bases=used_classes) - path_to_schemas[path] = mfg_cls - - return path_to_schemas - - @classmethod - def _get_new_instance_without_conversion_oapg( - cls, - arg: 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']] - ): - # We have a Dynamic class and we are making an instance of it - if issubclass(cls, frozendict.frozendict) and issubclass(cls, DictBase): - properties = cls._get_properties_oapg(arg, path_to_item, path_to_schemas) - return super(Schema, cls).__new__(cls, properties) - elif issubclass(cls, tuple) and issubclass(cls, ListBase): - items = cls._get_items_oapg(arg, path_to_item, path_to_schemas) - return super(Schema, cls).__new__(cls, items) - """ - str = openapi str, date, and datetime - decimal.Decimal = openapi int and float - FileIO = openapi binary type and the user inputs a file - bytes = openapi binary type and the user inputs bytes - """ - return super(Schema, cls).__new__(cls, arg) - - @classmethod - def from_openapi_data_oapg( - cls, - arg: typing.Union[ - str, - date, - datetime, - int, - float, - decimal.Decimal, - bool, - None, - 'Schema', - dict, - frozendict.frozendict, - tuple, - list, - io.FileIO, - io.BufferedReader, - bytes - ], - _configuration: typing.Optional[Configuration] - ): - """ - Schema from_openapi_data_oapg - """ - from_server = True - validated_path_to_schemas = {} - arg = cast_to_allowed_types(arg, from_server, validated_path_to_schemas) - validation_metadata = ValidationMetadata( - from_server=from_server, configuration=_configuration, validated_path_to_schemas=validated_path_to_schemas) - path_to_schemas = cls.__get_new_cls(arg, validation_metadata) - new_cls = path_to_schemas[validation_metadata.path_to_item] - new_inst = new_cls._get_new_instance_without_conversion_oapg( - arg, - validation_metadata.path_to_item, - path_to_schemas - ) - return new_inst - - @staticmethod - def __get_input_dict(*args, **kwargs) -> frozendict.frozendict: - input_dict = {} - if args and isinstance(args[0], (dict, frozendict.frozendict)): - input_dict.update(args[0]) - if kwargs: - input_dict.update(kwargs) - return frozendict.frozendict(input_dict) - - @staticmethod - def __remove_unsets(kwargs): - return {key: val for key, val in kwargs.items() if val is not unset} - - def __new__(cls, *args: typing.Union[dict, frozendict.frozendict, list, tuple, decimal.Decimal, float, int, str, date, datetime, bool, None, 'Schema'], _configuration: typing.Optional[Configuration] = None, **kwargs: typing.Union[dict, frozendict.frozendict, list, tuple, decimal.Decimal, float, int, str, date, datetime, bool, None, 'Schema', Unset]): - """ - Schema __new__ - - Args: - args (int/float/decimal.Decimal/str/list/tuple/dict/frozendict.frozendict/bool/None): the value - kwargs (str, int/float/decimal.Decimal/str/list/tuple/dict/frozendict.frozendict/bool/None): dict values - _configuration: contains the Configuration that enables json schema validation keywords - like minItems, minLength etc - - Note: double underscores are used here because pycharm thinks that these variables - are instance properties if they are named normally :( - """ - __kwargs = cls.__remove_unsets(kwargs) - if not args and not __kwargs: - raise TypeError( - 'No input given. args or kwargs must be given.' - ) - if not __kwargs and args and not isinstance(args[0], dict): - __arg = args[0] - else: - __arg = cls.__get_input_dict(*args, **__kwargs) - __from_server = False - __validated_path_to_schemas = {} - __arg = cast_to_allowed_types( - __arg, __from_server, __validated_path_to_schemas) - __validation_metadata = ValidationMetadata( - configuration=_configuration, from_server=__from_server, validated_path_to_schemas=__validated_path_to_schemas) - __path_to_schemas = cls.__get_new_cls(__arg, __validation_metadata) - __new_cls = __path_to_schemas[__validation_metadata.path_to_item] - return __new_cls._get_new_instance_without_conversion_oapg( - __arg, - __validation_metadata.path_to_item, - __path_to_schemas - ) - - def __init__( - self, - *args: typing.Union[ - dict, frozendict.frozendict, list, tuple, decimal.Decimal, float, int, str, date, datetime, bool, None, 'Schema'], - _configuration: typing.Optional[Configuration] = None, - **kwargs: typing.Union[ - dict, frozendict.frozendict, list, tuple, decimal.Decimal, float, int, str, date, datetime, bool, None, 'Schema', Unset - ] - ): - """ - this is needed to fix 'Unexpected argument' warning in pycharm - this code does nothing because all Schema instances are immutable - this means that all input data is passed into and used in new, and after the new instance is made - no new attributes are assigned and init is not used - """ - pass - -""" -import itertools -data_types = ('None', 'FrozenDict', 'Tuple', 'Str', 'Decimal', 'Bool') -type_to_cls = { - 'None': 'NoneClass', - 'FrozenDict': 'frozendict.frozendict', - 'Tuple': 'tuple', - 'Str': 'str', - 'Decimal': 'decimal.Decimal', - 'Bool': 'BoolClass' -} -cls_tuples = [v for v in itertools.combinations(data_types, 5)] -typed_classes = [f"class {''.join(cls_tuple)}Mixin({', '.join(type_to_cls[typ] for typ in cls_tuple)}):\n pass" for cls_tuple in cls_tuples] -for cls in typed_classes: - print(cls) -object_classes = [f"{''.join(cls_tuple)}Mixin = object" for cls_tuple in cls_tuples] -for cls in object_classes: - print(cls) -""" -if typing.TYPE_CHECKING: - # qty 1 - NoneMixin = NoneClass - FrozenDictMixin = frozendict.frozendict - TupleMixin = tuple - StrMixin = str - DecimalMixin = decimal.Decimal - BoolMixin = BoolClass - BytesMixin = bytes - FileMixin = FileIO - # qty 2 - class BinaryMixin(bytes, FileIO): - pass - class NoneFrozenDictMixin(NoneClass, frozendict.frozendict): - pass - class NoneTupleMixin(NoneClass, tuple): - pass - class NoneStrMixin(NoneClass, str): - pass - class NoneDecimalMixin(NoneClass, decimal.Decimal): - pass - class NoneBoolMixin(NoneClass, BoolClass): - pass - class FrozenDictTupleMixin(frozendict.frozendict, tuple): - pass - class FrozenDictStrMixin(frozendict.frozendict, str): - pass - class FrozenDictDecimalMixin(frozendict.frozendict, decimal.Decimal): - pass - class FrozenDictBoolMixin(frozendict.frozendict, BoolClass): - pass - class TupleStrMixin(tuple, str): - pass - class TupleDecimalMixin(tuple, decimal.Decimal): - pass - class TupleBoolMixin(tuple, BoolClass): - pass - class StrDecimalMixin(str, decimal.Decimal): - pass - class StrBoolMixin(str, BoolClass): - pass - class DecimalBoolMixin(decimal.Decimal, BoolClass): - pass - # qty 3 - class NoneFrozenDictTupleMixin(NoneClass, frozendict.frozendict, tuple): - pass - class NoneFrozenDictStrMixin(NoneClass, frozendict.frozendict, str): - pass - class NoneFrozenDictDecimalMixin(NoneClass, frozendict.frozendict, decimal.Decimal): - pass - class NoneFrozenDictBoolMixin(NoneClass, frozendict.frozendict, BoolClass): - pass - class NoneTupleStrMixin(NoneClass, tuple, str): - pass - class NoneTupleDecimalMixin(NoneClass, tuple, decimal.Decimal): - pass - class NoneTupleBoolMixin(NoneClass, tuple, BoolClass): - pass - class NoneStrDecimalMixin(NoneClass, str, decimal.Decimal): - pass - class NoneStrBoolMixin(NoneClass, str, BoolClass): - pass - class NoneDecimalBoolMixin(NoneClass, decimal.Decimal, BoolClass): - pass - class FrozenDictTupleStrMixin(frozendict.frozendict, tuple, str): - pass - class FrozenDictTupleDecimalMixin(frozendict.frozendict, tuple, decimal.Decimal): - pass - class FrozenDictTupleBoolMixin(frozendict.frozendict, tuple, BoolClass): - pass - class FrozenDictStrDecimalMixin(frozendict.frozendict, str, decimal.Decimal): - pass - class FrozenDictStrBoolMixin(frozendict.frozendict, str, BoolClass): - pass - class FrozenDictDecimalBoolMixin(frozendict.frozendict, decimal.Decimal, BoolClass): - pass - class TupleStrDecimalMixin(tuple, str, decimal.Decimal): - pass - class TupleStrBoolMixin(tuple, str, BoolClass): - pass - class TupleDecimalBoolMixin(tuple, decimal.Decimal, BoolClass): - pass - class StrDecimalBoolMixin(str, decimal.Decimal, BoolClass): - pass - # qty 4 - class NoneFrozenDictTupleStrMixin(NoneClass, frozendict.frozendict, tuple, str): - pass - class NoneFrozenDictTupleDecimalMixin(NoneClass, frozendict.frozendict, tuple, decimal.Decimal): - pass - class NoneFrozenDictTupleBoolMixin(NoneClass, frozendict.frozendict, tuple, BoolClass): - pass - class NoneFrozenDictStrDecimalMixin(NoneClass, frozendict.frozendict, str, decimal.Decimal): - pass - class NoneFrozenDictStrBoolMixin(NoneClass, frozendict.frozendict, str, BoolClass): - pass - class NoneFrozenDictDecimalBoolMixin(NoneClass, frozendict.frozendict, decimal.Decimal, BoolClass): - pass - class NoneTupleStrDecimalMixin(NoneClass, tuple, str, decimal.Decimal): - pass - class NoneTupleStrBoolMixin(NoneClass, tuple, str, BoolClass): - pass - class NoneTupleDecimalBoolMixin(NoneClass, tuple, decimal.Decimal, BoolClass): - pass - class NoneStrDecimalBoolMixin(NoneClass, str, decimal.Decimal, BoolClass): - pass - class FrozenDictTupleStrDecimalMixin(frozendict.frozendict, tuple, str, decimal.Decimal): - pass - class FrozenDictTupleStrBoolMixin(frozendict.frozendict, tuple, str, BoolClass): - pass - class FrozenDictTupleDecimalBoolMixin(frozendict.frozendict, tuple, decimal.Decimal, BoolClass): - pass - class FrozenDictStrDecimalBoolMixin(frozendict.frozendict, str, decimal.Decimal, BoolClass): - pass - class TupleStrDecimalBoolMixin(tuple, str, decimal.Decimal, BoolClass): - pass - # qty 5 - class NoneFrozenDictTupleStrDecimalMixin(NoneClass, frozendict.frozendict, tuple, str, decimal.Decimal): - pass - class NoneFrozenDictTupleStrBoolMixin(NoneClass, frozendict.frozendict, tuple, str, BoolClass): - pass - class NoneFrozenDictTupleDecimalBoolMixin(NoneClass, frozendict.frozendict, tuple, decimal.Decimal, BoolClass): - pass - class NoneFrozenDictStrDecimalBoolMixin(NoneClass, frozendict.frozendict, str, decimal.Decimal, BoolClass): - pass - class NoneTupleStrDecimalBoolMixin(NoneClass, tuple, str, decimal.Decimal, BoolClass): - pass - class FrozenDictTupleStrDecimalBoolMixin(frozendict.frozendict, tuple, str, decimal.Decimal, BoolClass): - pass - # qty 6 - class NoneFrozenDictTupleStrDecimalBoolMixin(NoneClass, frozendict.frozendict, tuple, str, decimal.Decimal, BoolClass): - pass - # qty 8 - class NoneFrozenDictTupleStrDecimalBoolFileBytesMixin(NoneClass, frozendict.frozendict, tuple, str, decimal.Decimal, BoolClass, FileIO, bytes): - pass -else: - # qty 1 - class NoneMixin: - _types = {NoneClass} - class FrozenDictMixin: - _types = {frozendict.frozendict} - class TupleMixin: - _types = {tuple} - class StrMixin: - _types = {str} - class DecimalMixin: - _types = {decimal.Decimal} - class BoolMixin: - _types = {BoolClass} - class BytesMixin: - _types = {bytes} - class FileMixin: - _types = {FileIO} - # qty 2 - class BinaryMixin: - _types = {bytes, FileIO} - class NoneFrozenDictMixin: - _types = {NoneClass, frozendict.frozendict} - class NoneTupleMixin: - _types = {NoneClass, tuple} - class NoneStrMixin: - _types = {NoneClass, str} - class NoneDecimalMixin: - _types = {NoneClass, decimal.Decimal} - class NoneBoolMixin: - _types = {NoneClass, BoolClass} - class FrozenDictTupleMixin: - _types = {frozendict.frozendict, tuple} - class FrozenDictStrMixin: - _types = {frozendict.frozendict, str} - class FrozenDictDecimalMixin: - _types = {frozendict.frozendict, decimal.Decimal} - class FrozenDictBoolMixin: - _types = {frozendict.frozendict, BoolClass} - class TupleStrMixin: - _types = {tuple, str} - class TupleDecimalMixin: - _types = {tuple, decimal.Decimal} - class TupleBoolMixin: - _types = {tuple, BoolClass} - class StrDecimalMixin: - _types = {str, decimal.Decimal} - class StrBoolMixin: - _types = {str, BoolClass} - class DecimalBoolMixin: - _types = {decimal.Decimal, BoolClass} - # qty 3 - class NoneFrozenDictTupleMixin: - _types = {NoneClass, frozendict.frozendict, tuple} - class NoneFrozenDictStrMixin: - _types = {NoneClass, frozendict.frozendict, str} - class NoneFrozenDictDecimalMixin: - _types = {NoneClass, frozendict.frozendict, decimal.Decimal} - class NoneFrozenDictBoolMixin: - _types = {NoneClass, frozendict.frozendict, BoolClass} - class NoneTupleStrMixin: - _types = {NoneClass, tuple, str} - class NoneTupleDecimalMixin: - _types = {NoneClass, tuple, decimal.Decimal} - class NoneTupleBoolMixin: - _types = {NoneClass, tuple, BoolClass} - class NoneStrDecimalMixin: - _types = {NoneClass, str, decimal.Decimal} - class NoneStrBoolMixin: - _types = {NoneClass, str, BoolClass} - class NoneDecimalBoolMixin: - _types = {NoneClass, decimal.Decimal, BoolClass} - class FrozenDictTupleStrMixin: - _types = {frozendict.frozendict, tuple, str} - class FrozenDictTupleDecimalMixin: - _types = {frozendict.frozendict, tuple, decimal.Decimal} - class FrozenDictTupleBoolMixin: - _types = {frozendict.frozendict, tuple, BoolClass} - class FrozenDictStrDecimalMixin: - _types = {frozendict.frozendict, str, decimal.Decimal} - class FrozenDictStrBoolMixin: - _types = {frozendict.frozendict, str, BoolClass} - class FrozenDictDecimalBoolMixin: - _types = {frozendict.frozendict, decimal.Decimal, BoolClass} - class TupleStrDecimalMixin: - _types = {tuple, str, decimal.Decimal} - class TupleStrBoolMixin: - _types = {tuple, str, BoolClass} - class TupleDecimalBoolMixin: - _types = {tuple, decimal.Decimal, BoolClass} - class StrDecimalBoolMixin: - _types = {str, decimal.Decimal, BoolClass} - # qty 4 - class NoneFrozenDictTupleStrMixin: - _types = {NoneClass, frozendict.frozendict, tuple, str} - class NoneFrozenDictTupleDecimalMixin: - _types = {NoneClass, frozendict.frozendict, tuple, decimal.Decimal} - class NoneFrozenDictTupleBoolMixin: - _types = {NoneClass, frozendict.frozendict, tuple, BoolClass} - class NoneFrozenDictStrDecimalMixin: - _types = {NoneClass, frozendict.frozendict, str, decimal.Decimal} - class NoneFrozenDictStrBoolMixin: - _types = {NoneClass, frozendict.frozendict, str, BoolClass} - class NoneFrozenDictDecimalBoolMixin: - _types = {NoneClass, frozendict.frozendict, decimal.Decimal, BoolClass} - class NoneTupleStrDecimalMixin: - _types = {NoneClass, tuple, str, decimal.Decimal} - class NoneTupleStrBoolMixin: - _types = {NoneClass, tuple, str, BoolClass} - class NoneTupleDecimalBoolMixin: - _types = {NoneClass, tuple, decimal.Decimal, BoolClass} - class NoneStrDecimalBoolMixin: - _types = {NoneClass, str, decimal.Decimal, BoolClass} - class FrozenDictTupleStrDecimalMixin: - _types = {frozendict.frozendict, tuple, str, decimal.Decimal} - class FrozenDictTupleStrBoolMixin: - _types = {frozendict.frozendict, tuple, str, BoolClass} - class FrozenDictTupleDecimalBoolMixin: - _types = {frozendict.frozendict, tuple, decimal.Decimal, BoolClass} - class FrozenDictStrDecimalBoolMixin: - _types = {frozendict.frozendict, str, decimal.Decimal, BoolClass} - class TupleStrDecimalBoolMixin: - _types = {tuple, str, decimal.Decimal, BoolClass} - # qty 5 - class NoneFrozenDictTupleStrDecimalMixin: - _types = {NoneClass, frozendict.frozendict, tuple, str, decimal.Decimal} - class NoneFrozenDictTupleStrBoolMixin: - _types = {NoneClass, frozendict.frozendict, tuple, str, BoolClass} - class NoneFrozenDictTupleDecimalBoolMixin: - _types = {NoneClass, frozendict.frozendict, tuple, decimal.Decimal, BoolClass} - class NoneFrozenDictStrDecimalBoolMixin: - _types = {NoneClass, frozendict.frozendict, str, decimal.Decimal, BoolClass} - class NoneTupleStrDecimalBoolMixin: - _types = {NoneClass, tuple, str, decimal.Decimal, BoolClass} - class FrozenDictTupleStrDecimalBoolMixin: - _types = {frozendict.frozendict, tuple, str, decimal.Decimal, BoolClass} - # qty 6 - class NoneFrozenDictTupleStrDecimalBoolMixin: - _types = {NoneClass, frozendict.frozendict, tuple, str, decimal.Decimal, BoolClass} - # qty 8 - class NoneFrozenDictTupleStrDecimalBoolFileBytesMixin: - _types = {NoneClass, frozendict.frozendict, tuple, str, decimal.Decimal, BoolClass, FileIO, bytes} - - -class ValidatorBase: - @staticmethod - def _is_json_validation_enabled_oapg(schema_keyword, configuration=None): - """Returns true if JSON schema validation is enabled for the specified - validation keyword. This can be used to skip JSON schema structural validation - as requested in the configuration. - Note: the suffix _oapg stands for openapi python (experimental) generator and - it has been added to prevent collisions with other methods and properties - - Args: - schema_keyword (string): the name of a JSON schema validation keyword. - configuration (Configuration): the configuration class. - """ - - return (configuration is None or - not hasattr(configuration, '_disabled_client_side_validations') or - schema_keyword not in configuration._disabled_client_side_validations) - - @staticmethod - def _raise_validation_errror_message_oapg(value, constraint_msg, constraint_value, path_to_item, additional_txt=""): - raise 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 EnumBase: - @classmethod - def _validate_oapg( - cls, - arg, - validation_metadata: ValidationMetadata, - ) -> typing.Dict[typing.Tuple[typing.Union[str, int], ...], typing.Set[typing.Union['Schema', str, decimal.Decimal, BoolClass, NoneClass, frozendict.frozendict, tuple]]]: - """ - EnumBase _validate_oapg - Validates that arg is in the enum's allowed values - """ - try: - cls.MetaOapg.enum_value_to_name[arg] - except KeyError: - raise ApiValueError("Invalid value {} passed in to {}, allowed_values={}".format(arg, cls, cls.MetaOapg.enum_value_to_name.keys())) - return super()._validate_oapg(arg, validation_metadata=validation_metadata) - - -class BoolBase: - def is_true_oapg(self) -> bool: - """ - A replacement for x is True - True if the instance is a BoolClass True Singleton - """ - if not issubclass(self.__class__, BoolClass): - return False - return bool(self) - - def is_false_oapg(self) -> bool: - """ - A replacement for x is False - True if the instance is a BoolClass False Singleton - """ - if not issubclass(self.__class__, BoolClass): - return False - return bool(self) is False - - -class NoneBase: - def is_none_oapg(self) -> bool: - """ - A replacement for x is None - True if the instance is a NoneClass None Singleton - """ - if issubclass(self.__class__, NoneClass): - return True - return False - - -class StrBase(ValidatorBase): - MetaOapg: MetaOapgTyped - - @property - def as_str_oapg(self) -> str: - return self - - @property - def as_date_oapg(self) -> date: - raise Exception('not implemented') - - @property - def as_datetime_oapg(self) -> datetime: - raise Exception('not implemented') - - @property - def as_decimal_oapg(self) -> decimal.Decimal: - raise Exception('not implemented') - - @property - def as_uuid_oapg(self) -> uuid.UUID: - raise Exception('not implemented') - - @classmethod - def __check_str_validations( - cls, - arg: str, - validation_metadata: ValidationMetadata - ): - if not hasattr(cls, 'MetaOapg'): - return - if (cls._is_json_validation_enabled_oapg('maxLength', validation_metadata.configuration) and - hasattr(cls.MetaOapg, 'max_length') and - len(arg) > cls.MetaOapg.max_length): - cls._raise_validation_errror_message_oapg( - value=arg, - constraint_msg="length must be less than or equal to", - constraint_value=cls.MetaOapg.max_length, - path_to_item=validation_metadata.path_to_item - ) - - if (cls._is_json_validation_enabled_oapg('minLength', validation_metadata.configuration) and - hasattr(cls.MetaOapg, 'min_length') and - len(arg) < cls.MetaOapg.min_length): - cls._raise_validation_errror_message_oapg( - value=arg, - constraint_msg="length must be greater than or equal to", - constraint_value=cls.MetaOapg.min_length, - path_to_item=validation_metadata.path_to_item - ) - - if (cls._is_json_validation_enabled_oapg('pattern', validation_metadata.configuration) and - hasattr(cls.MetaOapg, 'regex')): - for regex_dict in cls.MetaOapg.regex: - flags = regex_dict.get('flags', 0) - if not re.search(regex_dict['pattern'], arg, flags=flags): - if flags != 0: - # Don't print the regex flags if the flags are not - # specified in the OAS document. - cls._raise_validation_errror_message_oapg( - value=arg, - constraint_msg="must match regular expression", - constraint_value=regex_dict['pattern'], - path_to_item=validation_metadata.path_to_item, - additional_txt=" with flags=`{}`".format(flags) - ) - cls._raise_validation_errror_message_oapg( - value=arg, - constraint_msg="must match regular expression", - constraint_value=regex_dict['pattern'], - path_to_item=validation_metadata.path_to_item - ) - - @classmethod - def _validate_oapg( - cls, - arg, - validation_metadata: ValidationMetadata, - ) -> typing.Dict[typing.Tuple[typing.Union[str, int], ...], typing.Set[typing.Union['Schema', str, decimal.Decimal, BoolClass, NoneClass, frozendict.frozendict, tuple]]]: - """ - StrBase _validate_oapg - Validates that validations pass - """ - if isinstance(arg, str): - cls.__check_str_validations(arg, validation_metadata) - return super()._validate_oapg(arg, validation_metadata=validation_metadata) - - -class UUIDBase: - @property - @functools.lru_cache() - def as_uuid_oapg(self) -> uuid.UUID: - return uuid.UUID(self) - - @classmethod - def __validate_format(cls, arg: typing.Optional[str], validation_metadata: ValidationMetadata): - if isinstance(arg, str): - try: - uuid.UUID(arg) - return True - except ValueError: - raise ApiValueError( - "Invalid value '{}' for type UUID at {}".format(arg, validation_metadata.path_to_item) - ) - - @classmethod - def _validate_oapg( - cls, - arg, - validation_metadata: typing.Optional[ValidationMetadata] = None, - ): - """ - UUIDBase _validate_oapg - """ - cls.__validate_format(arg, validation_metadata=validation_metadata) - return super()._validate_oapg(arg, validation_metadata=validation_metadata) - - -class CustomIsoparser(isoparser): - - @_takes_ascii - def parse_isodatetime(self, dt_str): - components, pos = self._parse_isodate(dt_str) - if len(dt_str) > pos: - if self._sep is None or dt_str[pos:pos + 1] == self._sep: - components += self._parse_isotime(dt_str[pos + 1:]) - else: - raise ValueError('String contains unknown ISO components') - - if len(components) > 3 and components[3] == 24: - components[3] = 0 - return datetime(*components) + timedelta(days=1) - - if len(components) <= 3: - raise ValueError('Value is not a datetime') - - return datetime(*components) - - @_takes_ascii - def parse_isodate(self, datestr): - 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 date(*components) - - -DEFAULT_ISOPARSER = CustomIsoparser() - - -class DateBase: - @property - @functools.lru_cache() - def as_date_oapg(self) -> date: - return DEFAULT_ISOPARSER.parse_isodate(self) - - @classmethod - def __validate_format(cls, arg: typing.Optional[str], validation_metadata: ValidationMetadata): - if isinstance(arg, str): - try: - DEFAULT_ISOPARSER.parse_isodate(arg) - return True - except ValueError: - raise 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) - ) - - @classmethod - def _validate_oapg( - cls, - arg, - validation_metadata: typing.Optional[ValidationMetadata] = None, - ): - """ - DateBase _validate_oapg - """ - cls.__validate_format(arg, validation_metadata=validation_metadata) - return super()._validate_oapg(arg, validation_metadata=validation_metadata) - - -class DateTimeBase: - @property - @functools.lru_cache() - def as_datetime_oapg(self) -> datetime: - return DEFAULT_ISOPARSER.parse_isodatetime(self) - - @classmethod - def __validate_format(cls, arg: typing.Optional[str], validation_metadata: ValidationMetadata): - if isinstance(arg, str): - try: - DEFAULT_ISOPARSER.parse_isodatetime(arg) - return True - except ValueError: - raise 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) - ) - - @classmethod - def _validate_oapg( - cls, - arg, - validation_metadata: ValidationMetadata, - ): - """ - DateTimeBase _validate_oapg - """ - cls.__validate_format(arg, validation_metadata=validation_metadata) - return super()._validate_oapg(arg, validation_metadata=validation_metadata) - - -class DecimalBase: - """ - A class for storing decimals that are sent over the wire as strings - These schemas must remain based on StrBase rather than NumberBase - because picking base classes must be deterministic - """ - - @property - @functools.lru_cache() - def as_decimal_oapg(self) -> decimal.Decimal: - return decimal.Decimal(self) - - @classmethod - def __validate_format(cls, arg: typing.Optional[str], validation_metadata: ValidationMetadata): - if isinstance(arg, str): - try: - decimal.Decimal(arg) - return True - except decimal.InvalidOperation: - raise ApiValueError( - "Value cannot be converted to a decimal. " - "Invalid value '{}' for type decimal at {}".format(arg, validation_metadata.path_to_item) - ) - - @classmethod - def _validate_oapg( - cls, - arg, - validation_metadata: ValidationMetadata, - ): - """ - DecimalBase _validate_oapg - """ - cls.__validate_format(arg, validation_metadata=validation_metadata) - return super()._validate_oapg(arg, validation_metadata=validation_metadata) - - -class NumberBase(ValidatorBase): - MetaOapg: MetaOapgTyped - - @property - def as_int_oapg(self) -> int: - try: - return self._as_int - except AttributeError: - """ - Note: for some numbers like 9.0 they could be represented as an - integer but our code chooses to store them as - >>> Decimal('9.0').as_tuple() - DecimalTuple(sign=0, digits=(9, 0), exponent=-1) - so we can tell that the value came from a float and convert it back to a float - during later serialization - """ - if self.as_tuple().exponent < 0: - # this could be represented as an integer but should be represented as a float - # because that's what it was serialized from - raise ApiValueError(f'{self} is not an integer') - self._as_int = int(self) - return self._as_int - - @property - def as_float_oapg(self) -> float: - try: - return self._as_float - except AttributeError: - if self.as_tuple().exponent >= 0: - raise ApiValueError(f'{self} is not an float') - self._as_float = float(self) - return self._as_float - - @classmethod - def __check_numeric_validations( - cls, - arg, - validation_metadata: ValidationMetadata - ): - if not hasattr(cls, 'MetaOapg'): - return - if cls._is_json_validation_enabled_oapg('multipleOf', - validation_metadata.configuration) and hasattr(cls.MetaOapg, 'multiple_of'): - multiple_of_value = cls.MetaOapg.multiple_of - if (not (float(arg) / multiple_of_value).is_integer()): - # Note 'multipleOf' will be as good as the floating point arithmetic. - cls._raise_validation_errror_message_oapg( - value=arg, - constraint_msg="value must be a multiple of", - constraint_value=multiple_of_value, - path_to_item=validation_metadata.path_to_item - ) - - checking_max_or_min_values = any( - hasattr(cls.MetaOapg, validation_key) for validation_key in { - 'exclusive_maximum', - 'inclusive_maximum', - 'exclusive_minimum', - 'inclusive_minimum', - } - ) - if not checking_max_or_min_values: - return - - if (cls._is_json_validation_enabled_oapg('exclusiveMaximum', validation_metadata.configuration) and - hasattr(cls.MetaOapg, 'exclusive_maximum') and - arg >= cls.MetaOapg.exclusive_maximum): - cls._raise_validation_errror_message_oapg( - value=arg, - constraint_msg="must be a value less than", - constraint_value=cls.MetaOapg.exclusive_maximum, - path_to_item=validation_metadata.path_to_item - ) - - if (cls._is_json_validation_enabled_oapg('maximum', validation_metadata.configuration) and - hasattr(cls.MetaOapg, 'inclusive_maximum') and - arg > cls.MetaOapg.inclusive_maximum): - cls._raise_validation_errror_message_oapg( - value=arg, - constraint_msg="must be a value less than or equal to", - constraint_value=cls.MetaOapg.inclusive_maximum, - path_to_item=validation_metadata.path_to_item - ) - - if (cls._is_json_validation_enabled_oapg('exclusiveMinimum', validation_metadata.configuration) and - hasattr(cls.MetaOapg, 'exclusive_minimum') and - arg <= cls.MetaOapg.exclusive_minimum): - cls._raise_validation_errror_message_oapg( - value=arg, - constraint_msg="must be a value greater than", - constraint_value=cls.MetaOapg.exclusive_maximum, - path_to_item=validation_metadata.path_to_item - ) - - if (cls._is_json_validation_enabled_oapg('minimum', validation_metadata.configuration) and - hasattr(cls.MetaOapg, 'inclusive_minimum') and - arg < cls.MetaOapg.inclusive_minimum): - cls._raise_validation_errror_message_oapg( - value=arg, - constraint_msg="must be a value greater than or equal to", - constraint_value=cls.MetaOapg.inclusive_minimum, - path_to_item=validation_metadata.path_to_item - ) - - @classmethod - def _validate_oapg( - cls, - arg, - validation_metadata: ValidationMetadata, - ) -> typing.Dict[typing.Tuple[typing.Union[str, int], ...], typing.Set[typing.Union['Schema', str, decimal.Decimal, BoolClass, NoneClass, frozendict.frozendict, tuple]]]: - """ - NumberBase _validate_oapg - Validates that validations pass - """ - if isinstance(arg, decimal.Decimal): - cls.__check_numeric_validations(arg, validation_metadata) - return super()._validate_oapg(arg, validation_metadata=validation_metadata) - - -class ListBase(ValidatorBase): - MetaOapg: MetaOapgTyped - - @classmethod - def __validate_items(cls, list_items, validation_metadata: ValidationMetadata): - """ - Ensures that: - - values passed in for items are valid - Exceptions will be raised if: - - invalid arguments were passed in - - Args: - list_items: the input list of items - - Raises: - ApiTypeError - for missing required arguments, or for invalid properties - """ - - # if we have definitions for an items schema, use it - # otherwise accept anything - item_cls = getattr(cls.MetaOapg, 'items', UnsetAnyTypeSchema) - item_cls = cls._get_class_oapg(item_cls) - path_to_schemas = {} - for i, value in enumerate(list_items): - item_validation_metadata = ValidationMetadata( - from_server=validation_metadata.from_server, - configuration=validation_metadata.configuration, - path_to_item=validation_metadata.path_to_item+(i,), - validated_path_to_schemas=validation_metadata.validated_path_to_schemas - ) - if item_validation_metadata.validation_ran_earlier(item_cls): - continue - other_path_to_schemas = item_cls._validate_oapg( - value, validation_metadata=item_validation_metadata) - update(path_to_schemas, other_path_to_schemas) - return path_to_schemas - - @classmethod - def __check_tuple_validations( - cls, arg, - validation_metadata: ValidationMetadata): - if not hasattr(cls, 'MetaOapg'): - return - if (cls._is_json_validation_enabled_oapg('maxItems', validation_metadata.configuration) and - hasattr(cls.MetaOapg, 'max_items') and - len(arg) > cls.MetaOapg.max_items): - cls._raise_validation_errror_message_oapg( - value=arg, - constraint_msg="number of items must be less than or equal to", - constraint_value=cls.MetaOapg.max_items, - path_to_item=validation_metadata.path_to_item - ) - - if (cls._is_json_validation_enabled_oapg('minItems', validation_metadata.configuration) and - hasattr(cls.MetaOapg, 'min_items') and - len(arg) < cls.MetaOapg.min_items): - cls._raise_validation_errror_message_oapg( - value=arg, - constraint_msg="number of items must be greater than or equal to", - constraint_value=cls.MetaOapg.min_items, - path_to_item=validation_metadata.path_to_item - ) - - if (cls._is_json_validation_enabled_oapg('uniqueItems', validation_metadata.configuration) and - hasattr(cls.MetaOapg, 'unique_items') and cls.MetaOapg.unique_items and arg): - unique_items = set(arg) - if len(arg) > len(unique_items): - cls._raise_validation_errror_message_oapg( - 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 - ) - - @classmethod - def _validate_oapg( - cls, - arg, - validation_metadata: ValidationMetadata, - ): - """ - ListBase _validate_oapg - We return dynamic classes of different bases depending upon the inputs - This makes it so: - - the returned instance is always a subclass of our defining schema - - this allows us to check type based on whether an instance is a subclass of a schema - - the returned instance is a serializable type (except for None, True, and False) which are enums - - Returns: - new_cls (type): the new class - - Raises: - ApiValueError: when a string can't be converted into a date or datetime and it must be one of those classes - ApiTypeError: when the input type is not in the list of allowed spec types - """ - if isinstance(arg, tuple): - cls.__check_tuple_validations(arg, validation_metadata) - _path_to_schemas = super()._validate_oapg(arg, validation_metadata=validation_metadata) - if not isinstance(arg, tuple): - return _path_to_schemas - updated_vm = ValidationMetadata( - configuration=validation_metadata.configuration, - from_server=validation_metadata.from_server, - path_to_item=validation_metadata.path_to_item, - seen_classes=validation_metadata.seen_classes | frozenset({cls}), - validated_path_to_schemas=validation_metadata.validated_path_to_schemas - ) - other_path_to_schemas = cls.__validate_items(arg, validation_metadata=updated_vm) - update(_path_to_schemas, other_path_to_schemas) - return _path_to_schemas - - @classmethod - def _get_items_oapg( - cls: 'Schema', - arg: typing.List[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']] - ): - ''' - ListBase _get_items_oapg - ''' - 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_oapg( - value, - item_path_to_item, - path_to_schemas - ) - cast_items.append(new_value) - - return cast_items - - -class Discriminable: - MetaOapg: MetaOapgTyped - - @classmethod - def _ensure_discriminator_value_present_oapg(cls, disc_property_name: str, validation_metadata: ValidationMetadata, *args): - if not args or args and disc_property_name not in args[0]: - # The input data does not contain the discriminator property - raise 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) - ) - - @classmethod - def get_discriminated_class_oapg(cls, disc_property_name: str, disc_payload_value: str): - """ - Used in schemas with discriminators - """ - if not hasattr(cls.MetaOapg, 'discriminator'): - return None - disc = cls.MetaOapg.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, 'MetaOapg'): - return None - elif not ( - hasattr(cls.MetaOapg, 'all_of') or - hasattr(cls.MetaOapg, 'one_of') or - hasattr(cls.MetaOapg, 'any_of') - ): - return None - # TODO stop traveling if a cycle is hit - if hasattr(cls.MetaOapg, 'all_of'): - for allof_cls in cls.MetaOapg.all_of(): - discriminated_cls = allof_cls.get_discriminated_class_oapg( - disc_property_name=disc_property_name, disc_payload_value=disc_payload_value) - if discriminated_cls is not None: - return discriminated_cls - if hasattr(cls.MetaOapg, 'one_of'): - for oneof_cls in cls.MetaOapg.one_of(): - discriminated_cls = oneof_cls.get_discriminated_class_oapg( - disc_property_name=disc_property_name, disc_payload_value=disc_payload_value) - if discriminated_cls is not None: - return discriminated_cls - if hasattr(cls.MetaOapg, 'any_of'): - for anyof_cls in cls.MetaOapg.any_of(): - discriminated_cls = anyof_cls.get_discriminated_class_oapg( - disc_property_name=disc_property_name, disc_payload_value=disc_payload_value) - if discriminated_cls is not None: - return discriminated_cls - return None - - -class DictBase(Discriminable, ValidatorBase): - - @classmethod - def __validate_arg_presence(cls, arg): - """ - Ensures that: - - all required arguments are passed in - - the input variable names are valid - - present in properties or - - accepted because additionalProperties exists - Exceptions will be raised if: - - invalid arguments were passed in - - a var_name is invalid if additional_properties == NotAnyTypeSchema - and var_name not in properties.__annotations__ - - required properties were not passed in - - Args: - arg: the input dict - - Raises: - ApiTypeError - for missing required arguments, or for invalid properties - """ - seen_required_properties = set() - invalid_arguments = [] - required_property_names = getattr(cls.MetaOapg, 'required', set()) - additional_properties = getattr(cls.MetaOapg, 'additional_properties', UnsetAnyTypeSchema) - properties = getattr(cls.MetaOapg, 'properties', {}) - property_annotations = getattr(properties, '__annotations__', {}) - for property_name in arg: - if property_name in required_property_names: - seen_required_properties.add(property_name) - elif property_name in property_annotations: - continue - elif additional_properties is not NotAnyTypeSchema: - continue - else: - invalid_arguments.append(property_name) - missing_required_arguments = list(required_property_names - seen_required_properties) - if missing_required_arguments: - missing_required_arguments.sort() - raise ApiTypeError( - "{} is missing {} required argument{}: {}".format( - cls.__name__, - len(missing_required_arguments), - "s" if len(missing_required_arguments) > 1 else "", - missing_required_arguments - ) - ) - if invalid_arguments: - invalid_arguments.sort() - raise ApiTypeError( - "{} was passed {} invalid argument{}: {}".format( - cls.__name__, - len(invalid_arguments), - "s" if len(invalid_arguments) > 1 else "", - invalid_arguments - ) - ) - - @classmethod - def __validate_args(cls, arg, validation_metadata: ValidationMetadata): - """ - Ensures that: - - values passed in for properties are valid - Exceptions will be raised if: - - invalid arguments were passed in - - Args: - arg: the input dict - - Raises: - ApiTypeError - for missing required arguments, or for invalid properties - """ - path_to_schemas = {} - additional_properties = getattr(cls.MetaOapg, 'additional_properties', UnsetAnyTypeSchema) - properties = getattr(cls.MetaOapg, 'properties', {}) - property_annotations = getattr(properties, '__annotations__', {}) - for property_name, value in arg.items(): - path_to_item = validation_metadata.path_to_item+(property_name,) - if property_name in property_annotations: - schema = property_annotations[property_name] - elif additional_properties is not NotAnyTypeSchema: - if additional_properties is UnsetAnyTypeSchema: - """ - If additionalProperties is unset and this path_to_item does not yet have - any validations on it, validate it. - If it already has validations on it, skip this validation. - """ - if path_to_item in path_to_schemas: - continue - schema = additional_properties - else: - raise ApiTypeError('Unable to find schema for value={} in class={} at path_to_item={}'.format( - value, cls, validation_metadata.path_to_item+(property_name,) - )) - schema = cls._get_class_oapg(schema) - arg_validation_metadata = ValidationMetadata( - from_server=validation_metadata.from_server, - configuration=validation_metadata.configuration, - path_to_item=path_to_item, - validated_path_to_schemas=validation_metadata.validated_path_to_schemas - ) - if arg_validation_metadata.validation_ran_earlier(schema): - continue - other_path_to_schemas = schema._validate_oapg(value, validation_metadata=arg_validation_metadata) - update(path_to_schemas, other_path_to_schemas) - return path_to_schemas - - @classmethod - def __check_dict_validations( - cls, - arg, - validation_metadata: ValidationMetadata - ): - if not hasattr(cls, 'MetaOapg'): - return - if (cls._is_json_validation_enabled_oapg('maxProperties', validation_metadata.configuration) and - hasattr(cls.MetaOapg, 'max_properties') and - len(arg) > cls.MetaOapg.max_properties): - cls._raise_validation_errror_message_oapg( - value=arg, - constraint_msg="number of properties must be less than or equal to", - constraint_value=cls.MetaOapg.max_properties, - path_to_item=validation_metadata.path_to_item - ) - - if (cls._is_json_validation_enabled_oapg('minProperties', validation_metadata.configuration) and - hasattr(cls.MetaOapg, 'min_properties') and - len(arg) < cls.MetaOapg.min_properties): - cls._raise_validation_errror_message_oapg( - value=arg, - constraint_msg="number of properties must be greater than or equal to", - constraint_value=cls.MetaOapg.min_properties, - path_to_item=validation_metadata.path_to_item - ) - - @classmethod - def _validate_oapg( - cls, - arg, - validation_metadata: ValidationMetadata, - ): - """ - DictBase _validate_oapg - We return dynamic classes of different bases depending upon the inputs - This makes it so: - - the returned instance is always a subclass of our defining schema - - this allows us to check type based on whether an instance is a subclass of a schema - - the returned instance is a serializable type (except for None, True, and False) which are enums - - Returns: - new_cls (type): the new class - - Raises: - ApiValueError: when a string can't be converted into a date or datetime and it must be one of those classes - ApiTypeError: when the input type is not in the list of allowed spec types - """ - if isinstance(arg, frozendict.frozendict): - cls.__check_dict_validations(arg, validation_metadata) - _path_to_schemas = super()._validate_oapg(arg, validation_metadata=validation_metadata) - if not isinstance(arg, frozendict.frozendict): - return _path_to_schemas - cls.__validate_arg_presence(arg) - other_path_to_schemas = cls.__validate_args(arg, validation_metadata=validation_metadata) - update(_path_to_schemas, other_path_to_schemas) - try: - discriminator = cls.MetaOapg.discriminator() - except AttributeError: - return _path_to_schemas - # discriminator exists - disc_prop_name = list(discriminator.keys())[0] - cls._ensure_discriminator_value_present_oapg(disc_prop_name, validation_metadata, arg) - discriminated_cls = cls.get_discriminated_class_oapg( - disc_property_name=disc_prop_name, disc_payload_value=arg[disc_prop_name]) - if discriminated_cls is None: - raise 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,) - ) - ) - updated_vm = ValidationMetadata( - configuration=validation_metadata.configuration, - from_server=validation_metadata.from_server, - path_to_item=validation_metadata.path_to_item, - seen_classes=validation_metadata.seen_classes | frozenset({cls}), - validated_path_to_schemas=validation_metadata.validated_path_to_schemas - ) - if updated_vm.validation_ran_earlier(discriminated_cls): - return _path_to_schemas - other_path_to_schemas = discriminated_cls._validate_oapg(arg, validation_metadata=updated_vm) - update(_path_to_schemas, other_path_to_schemas) - return _path_to_schemas - - @classmethod - def _get_properties_oapg( - cls, - arg: typing.Dict[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']] - ): - """ - DictBase _get_properties_oapg, 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_oapg( - value, - property_path_to_item, - path_to_schemas - ) - dict_items[property_name_js] = new_value - - return dict_items - - def __setattr__(self, name: str, value: typing.Any): - if not isinstance(self, FileIO): - raise AttributeError('property setting not supported on immutable instances') - - def __getattr__(self, name: str): - """ - for instance.name access - Properties are only type hinted for required properties - so that hasattr(instance, 'optionalProp') is False when that key is not present - """ - if not isinstance(self, frozendict.frozendict): - return super().__getattr__(name) - if name not in self.__class__.__annotations__: - raise AttributeError(f"{self} has no attribute '{name}'") - try: - value = self[name] - return value - except KeyError as ex: - raise AttributeError(str(ex)) - - def __getitem__(self, name: str): - """ - dict_instance[name] accessor - key errors thrown - """ - if not isinstance(self, frozendict.frozendict): - return super().__getattr__(name) - return super().__getitem__(name) - - def get_item_oapg(self, name: str) -> typing.Union['AnyTypeSchema', Unset]: - # dict_instance[name] accessor - if not isinstance(self, frozendict.frozendict): - raise NotImplementedError() - try: - return super().__getitem__(name) - except KeyError: - return unset - - -def cast_to_allowed_types( - arg: typing.Union[str, date, datetime, uuid.UUID, decimal.Decimal, int, float, None, dict, frozendict.frozendict, list, tuple, bytes, Schema, io.FileIO, io.BufferedReader], - from_server: bool, - validated_path_to_schemas: typing.Dict[typing.Tuple[typing.Union[str, int], ...], typing.Set[typing.Union['Schema', str, decimal.Decimal, BoolClass, NoneClass, frozendict.frozendict, tuple]]], - path_to_item: typing.Tuple[typing.Union[str, int], ...] = tuple(['args[0]']), -) -> typing.Union[frozendict.frozendict, tuple, decimal.Decimal, str, bytes, BoolClass, NoneClass, 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 - """ - if isinstance(arg, Schema): - # store the already run validations - schema_classes = set() - source_schema_was_unset = len(arg.__class__.__bases__) == 2 and UnsetAnyTypeSchema in arg.__class__.__bases__ - if not source_schema_was_unset: - """ - Do not include UnsetAnyTypeSchema and its base class because - it did not exist in the original spec schema definition - It was added to ensure that all instances are of type Schema and the allowed base types - """ - for cls in arg.__class__.__bases__: - if cls is Singleton: - # Skip Singleton - continue - schema_classes.add(cls) - validated_path_to_schemas[path_to_item] = schema_classes - - type_error = ApiTypeError(f"Invalid type. Required value type is str and passed type was {type(arg)} at {path_to_item}") - if isinstance(arg, str): - return str(arg) - elif isinstance(arg, (dict, frozendict.frozendict)): - return frozendict.frozendict({key: cast_to_allowed_types(val, from_server, validated_path_to_schemas, path_to_item + (key,)) for key, val in arg.items()}) - elif isinstance(arg, (bool, BoolClass)): - """ - this check must come before isinstance(arg, (int, float)) - because isinstance(True, int) is True - """ - if arg: - return BoolClass.TRUE - return BoolClass.FALSE - elif isinstance(arg, int): - return decimal.Decimal(arg) - elif isinstance(arg, float): - decimal_from_float = decimal.Decimal(arg) - if decimal_from_float.as_integer_ratio()[1] == 1: - # 9.0 -> Decimal('9.0') - # 3.4028234663852886e+38 -> Decimal('340282346638528859811704183484516925440.0') - return decimal.Decimal(str(decimal_from_float)+'.0') - return decimal_from_float - elif isinstance(arg, (tuple, list)): - return tuple([cast_to_allowed_types(item, from_server, validated_path_to_schemas, path_to_item + (i,)) for i, item in enumerate(arg)]) - elif isinstance(arg, (none_type, NoneClass)): - return NoneClass.NONE - elif isinstance(arg, (date, datetime)): - if not from_server: - return arg.isoformat() - raise type_error - elif isinstance(arg, uuid.UUID): - if not from_server: - return str(arg) - raise type_error - elif isinstance(arg, decimal.Decimal): - return decimal.Decimal(arg) - elif isinstance(arg, bytes): - return bytes(arg) - elif isinstance(arg, (io.FileIO, io.BufferedReader)): - return FileIO(arg) - raise ValueError('Invalid type passed in got input={} type={}'.format(arg, type(arg))) - - -class ComposedBase(Discriminable): - - @classmethod - def __get_allof_classes(cls, arg, validation_metadata: ValidationMetadata): - path_to_schemas = defaultdict(set) - for allof_cls in cls.MetaOapg.all_of(): - if validation_metadata.validation_ran_earlier(allof_cls): - continue - other_path_to_schemas = allof_cls._validate_oapg(arg, validation_metadata=validation_metadata) - update(path_to_schemas, other_path_to_schemas) - return path_to_schemas - - @classmethod - def __get_oneof_class( - cls, - arg, - discriminated_cls, - validation_metadata: ValidationMetadata, - ): - oneof_classes = [] - path_to_schemas = defaultdict(set) - for oneof_cls in cls.MetaOapg.one_of(): - if oneof_cls in path_to_schemas[validation_metadata.path_to_item]: - oneof_classes.append(oneof_cls) - continue - if validation_metadata.validation_ran_earlier(oneof_cls): - oneof_classes.append(oneof_cls) - continue - try: - path_to_schemas = oneof_cls._validate_oapg(arg, validation_metadata=validation_metadata) - except (ApiValueError, ApiTypeError) as ex: - if discriminated_cls is not None and oneof_cls is discriminated_cls: - raise ex - continue - oneof_classes.append(oneof_cls) - if not oneof_classes: - raise 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 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 - - @classmethod - def __get_anyof_classes( - cls, - arg, - discriminated_cls, - validation_metadata: ValidationMetadata - ): - anyof_classes = [] - path_to_schemas = defaultdict(set) - for anyof_cls in cls.MetaOapg.any_of(): - if validation_metadata.validation_ran_earlier(anyof_cls): - anyof_classes.append(anyof_cls) - continue - - try: - other_path_to_schemas = anyof_cls._validate_oapg(arg, validation_metadata=validation_metadata) - except (ApiValueError, ApiTypeError) as ex: - if discriminated_cls is not None and anyof_cls is discriminated_cls: - raise ex - continue - anyof_classes.append(anyof_cls) - update(path_to_schemas, other_path_to_schemas) - if not anyof_classes: - raise ApiValueError( - "Invalid inputs given to generate an instance of {}. None " - "of the anyOf schemas matched the input data.".format(cls) - ) - return path_to_schemas - - @classmethod - def _validate_oapg( - cls, - arg, - validation_metadata: ValidationMetadata, - ) -> typing.Dict[typing.Tuple[typing.Union[str, int], ...], typing.Set[typing.Union['Schema', str, decimal.Decimal, BoolClass, NoneClass, frozendict.frozendict, tuple]]]: - """ - ComposedBase _validate_oapg - We return dynamic classes of different bases depending upon the inputs - This makes it so: - - the returned instance is always a subclass of our defining schema - - this allows us to check type based on whether an instance is a subclass of a schema - - the returned instance is a serializable type (except for None, True, and False) which are enums - - Returns: - new_cls (type): the new class - - Raises: - ApiValueError: when a string can't be converted into a date or datetime and it must be one of those classes - ApiTypeError: when the input type is not in the list of allowed spec types - """ - # validation checking on types, validations, and enums - path_to_schemas = super()._validate_oapg(arg, validation_metadata=validation_metadata) - - updated_vm = ValidationMetadata( - configuration=validation_metadata.configuration, - from_server=validation_metadata.from_server, - path_to_item=validation_metadata.path_to_item, - seen_classes=validation_metadata.seen_classes | frozenset({cls}), - validated_path_to_schemas=validation_metadata.validated_path_to_schemas - ) - - # process composed schema - discriminator = None - if hasattr(cls, 'MetaOapg') and hasattr(cls.MetaOapg, 'discriminator'): - discriminator = cls.MetaOapg.discriminator() - discriminated_cls = None - if discriminator and arg and isinstance(arg, frozendict.frozendict): - disc_property_name = list(discriminator.keys())[0] - cls._ensure_discriminator_value_present_oapg(disc_property_name, updated_vm, arg) - # get discriminated_cls by looking at the dict in the current class - discriminated_cls = cls.get_discriminated_class_oapg( - disc_property_name=disc_property_name, disc_payload_value=arg[disc_property_name]) - if discriminated_cls is None: - raise ApiValueError( - "Invalid discriminator value '{}' was passed in to {}.{} Only the values {} are allowed at {}".format( - arg[disc_property_name], - cls.__name__, - disc_property_name, - list(discriminator[disc_property_name].keys()), - updated_vm.path_to_item + (disc_property_name,) - ) - ) - - if hasattr(cls, 'MetaOapg') and hasattr(cls.MetaOapg, 'all_of'): - other_path_to_schemas = cls.__get_allof_classes(arg, validation_metadata=updated_vm) - update(path_to_schemas, other_path_to_schemas) - if hasattr(cls, 'MetaOapg') and hasattr(cls.MetaOapg, 'one_of'): - other_path_to_schemas = cls.__get_oneof_class( - arg, - discriminated_cls=discriminated_cls, - validation_metadata=updated_vm - ) - update(path_to_schemas, other_path_to_schemas) - if hasattr(cls, 'MetaOapg') and hasattr(cls.MetaOapg, 'any_of'): - other_path_to_schemas = cls.__get_anyof_classes( - arg, - discriminated_cls=discriminated_cls, - validation_metadata=updated_vm - ) - update(path_to_schemas, other_path_to_schemas) - not_cls = None - if hasattr(cls, 'MetaOapg') and hasattr(cls.MetaOapg, 'not_schema'): - not_cls = cls.MetaOapg.not_schema - not_cls = cls._get_class_oapg(not_cls) - if not_cls: - other_path_to_schemas = None - not_exception = ApiValueError( - "Invalid value '{}' was passed in to {}. Value is invalid because it is disallowed by {}".format( - arg, - cls.__name__, - not_cls.__name__, - ) - ) - if updated_vm.validation_ran_earlier(not_cls): - raise not_exception - - try: - other_path_to_schemas = not_cls._validate_oapg(arg, validation_metadata=updated_vm) - except (ApiValueError, ApiTypeError): - pass - if other_path_to_schemas: - raise not_exception - - if discriminated_cls is not None and not updated_vm.validation_ran_earlier(discriminated_cls): - # TODO use an exception from this package here - assert discriminated_cls in path_to_schemas[updated_vm.path_to_item] - return path_to_schemas - - -# DictBase, ListBase, NumberBase, StrBase, BoolBase, NoneBase -class ComposedSchema( - ComposedBase, - DictBase, - ListBase, - NumberBase, - StrBase, - BoolBase, - NoneBase, - Schema, - NoneFrozenDictTupleStrDecimalBoolMixin -): - @classmethod - def from_openapi_data_oapg(cls, *args: typing.Any, _configuration: typing.Optional[Configuration] = None, **kwargs): - if not args: - if not kwargs: - raise ApiTypeError('{} is missing required input data in args or kwargs'.format(cls.__name__)) - args = (kwargs, ) - return super().from_openapi_data_oapg(args[0], _configuration=_configuration) - - -class ListSchema( - ListBase, - Schema, - TupleMixin -): - - @classmethod - def from_openapi_data_oapg(cls, arg: typing.List[typing.Any], _configuration: typing.Optional[Configuration] = None): - return super().from_openapi_data_oapg(arg, _configuration=_configuration) - - def __new__(cls, arg: typing.Union[typing.List[typing.Any], typing.Tuple[typing.Any]], **kwargs: Configuration): - return super().__new__(cls, arg, **kwargs) - - -class NoneSchema( - NoneBase, - Schema, - NoneMixin -): - - @classmethod - def from_openapi_data_oapg(cls, arg: None, _configuration: typing.Optional[Configuration] = None): - return super().from_openapi_data_oapg(arg, _configuration=_configuration) - - def __new__(cls, arg: None, **kwargs: Configuration): - return super().__new__(cls, arg, **kwargs) - - -class NumberSchema( - NumberBase, - Schema, - DecimalMixin -): - """ - This is used for type: number with no format - Both integers AND floats are accepted - """ - - @classmethod - def from_openapi_data_oapg(cls, arg: typing.Union[int, float], _configuration: typing.Optional[Configuration] = None): - return super().from_openapi_data_oapg(arg, _configuration=_configuration) - - def __new__(cls, arg: typing.Union[decimal.Decimal, int, float], **kwargs: Configuration): - return super().__new__(cls, arg, **kwargs) - - -class IntBase: - @property - def as_int_oapg(self) -> int: - try: - return self._as_int - except AttributeError: - self._as_int = int(self) - return self._as_int - - @classmethod - def __validate_format(cls, arg: typing.Optional[decimal.Decimal], validation_metadata: ValidationMetadata): - if isinstance(arg, decimal.Decimal): - - denominator = arg.as_integer_ratio()[-1] - if denominator != 1: - raise ApiValueError( - "Invalid value '{}' for type integer at {}".format(arg, validation_metadata.path_to_item) - ) - - @classmethod - def _validate_oapg( - cls, - arg, - validation_metadata: ValidationMetadata, - ): - """ - IntBase _validate_oapg - TODO what about types = (int, number) -> IntBase, NumberBase? We could drop int and keep number only - """ - cls.__validate_format(arg, validation_metadata=validation_metadata) - return super()._validate_oapg(arg, validation_metadata=validation_metadata) - - -class IntSchema(IntBase, NumberSchema): - - @classmethod - def from_openapi_data_oapg(cls, arg: int, _configuration: typing.Optional[Configuration] = None): - return super().from_openapi_data_oapg(arg, _configuration=_configuration) - - def __new__(cls, arg: typing.Union[decimal.Decimal, int], **kwargs: Configuration): - return super().__new__(cls, arg, **kwargs) - - -class Int32Base: - __inclusive_minimum = decimal.Decimal(-2147483648) - __inclusive_maximum = decimal.Decimal(2147483647) - - @classmethod - def __validate_format(cls, arg: typing.Optional[decimal.Decimal], validation_metadata: ValidationMetadata): - if isinstance(arg, decimal.Decimal) and arg.as_tuple().exponent == 0: - if not cls.__inclusive_minimum <= arg <= cls.__inclusive_maximum: - raise ApiValueError( - "Invalid value '{}' for type int32 at {}".format(arg, validation_metadata.path_to_item) - ) - - @classmethod - def _validate_oapg( - cls, - arg, - validation_metadata: ValidationMetadata, - ): - """ - Int32Base _validate_oapg - """ - cls.__validate_format(arg, validation_metadata=validation_metadata) - return super()._validate_oapg(arg, validation_metadata=validation_metadata) - - -class Int32Schema( - Int32Base, - IntSchema -): - pass - - -class Int64Base: - __inclusive_minimum = decimal.Decimal(-9223372036854775808) - __inclusive_maximum = decimal.Decimal(9223372036854775807) - - @classmethod - def __validate_format(cls, arg: typing.Optional[decimal.Decimal], validation_metadata: ValidationMetadata): - if isinstance(arg, decimal.Decimal) and arg.as_tuple().exponent == 0: - if not cls.__inclusive_minimum <= arg <= cls.__inclusive_maximum: - raise ApiValueError( - "Invalid value '{}' for type int64 at {}".format(arg, validation_metadata.path_to_item) - ) - - @classmethod - def _validate_oapg( - cls, - arg, - validation_metadata: ValidationMetadata, - ): - """ - Int64Base _validate_oapg - """ - cls.__validate_format(arg, validation_metadata=validation_metadata) - return super()._validate_oapg(arg, validation_metadata=validation_metadata) - - -class Int64Schema( - Int64Base, - IntSchema -): - pass - - -class Float32Base: - __inclusive_minimum = decimal.Decimal(-3.4028234663852886e+38) - __inclusive_maximum = decimal.Decimal(3.4028234663852886e+38) - - @classmethod - def __validate_format(cls, arg: typing.Optional[decimal.Decimal], validation_metadata: ValidationMetadata): - if isinstance(arg, decimal.Decimal): - if not cls.__inclusive_minimum <= arg <= cls.__inclusive_maximum: - raise ApiValueError( - "Invalid value '{}' for type float at {}".format(arg, validation_metadata.path_to_item) - ) - - @classmethod - def _validate_oapg( - cls, - arg, - validation_metadata: ValidationMetadata, - ): - """ - Float32Base _validate_oapg - """ - cls.__validate_format(arg, validation_metadata=validation_metadata) - return super()._validate_oapg(arg, validation_metadata=validation_metadata) - - -class Float32Schema( - Float32Base, - NumberSchema -): - - @classmethod - def from_openapi_data_oapg(cls, arg: float, _configuration: typing.Optional[Configuration] = None): - return super().from_openapi_data_oapg(arg, _configuration=_configuration) - - -class Float64Base: - __inclusive_minimum = decimal.Decimal(-1.7976931348623157E+308) - __inclusive_maximum = decimal.Decimal(1.7976931348623157E+308) - - @classmethod - def __validate_format(cls, arg: typing.Optional[decimal.Decimal], validation_metadata: ValidationMetadata): - if isinstance(arg, decimal.Decimal): - if not cls.__inclusive_minimum <= arg <= cls.__inclusive_maximum: - raise ApiValueError( - "Invalid value '{}' for type double at {}".format(arg, validation_metadata.path_to_item) - ) - - @classmethod - def _validate_oapg( - cls, - arg, - validation_metadata: ValidationMetadata, - ): - """ - Float64Base _validate_oapg - """ - cls.__validate_format(arg, validation_metadata=validation_metadata) - return super()._validate_oapg(arg, validation_metadata=validation_metadata) - -class Float64Schema( - Float64Base, - NumberSchema -): - - @classmethod - def from_openapi_data_oapg(cls, arg: float, _configuration: typing.Optional[Configuration] = None): - # todo check format - return super().from_openapi_data_oapg(arg, _configuration=_configuration) - - -class StrSchema( - StrBase, - Schema, - StrMixin -): - """ - 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 - """ - - @classmethod - def from_openapi_data_oapg(cls, arg: str, _configuration: typing.Optional[Configuration] = None) -> 'StrSchema': - return super().from_openapi_data_oapg(arg, _configuration=_configuration) - - def __new__(cls, arg: typing.Union[str, date, datetime, uuid.UUID], **kwargs: Configuration): - return super().__new__(cls, arg, **kwargs) - - -class UUIDSchema(UUIDBase, StrSchema): - - def __new__(cls, arg: typing.Union[str, uuid.UUID], **kwargs: Configuration): - return super().__new__(cls, arg, **kwargs) - - -class DateSchema(DateBase, StrSchema): - - def __new__(cls, arg: typing.Union[str, date], **kwargs: Configuration): - return super().__new__(cls, arg, **kwargs) - - -class DateTimeSchema(DateTimeBase, StrSchema): - - def __new__(cls, arg: typing.Union[str, datetime], **kwargs: Configuration): - return super().__new__(cls, arg, **kwargs) - - -class DecimalSchema(DecimalBase, StrSchema): - - def __new__(cls, arg: str, **kwargs: Configuration): - """ - 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().__new__(cls, arg, **kwargs) - - -class BytesSchema( - Schema, - BytesMixin -): - """ - this class will subclass bytes and is immutable - """ - def __new__(cls, arg: bytes, **kwargs: Configuration): - return super(Schema, cls).__new__(cls, arg) - - -class FileSchema( - Schema, - FileMixin -): - """ - 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 - """ - - def __new__(cls, arg: typing.Union[io.FileIO, io.BufferedReader], **kwargs: Configuration): - return super(Schema, cls).__new__(cls, arg) - - -class BinaryBase: - pass - - -class BinarySchema( - ComposedBase, - BinaryBase, - Schema, - BinaryMixin -): - class MetaOapg: - @staticmethod - def one_of(): - return [ - BytesSchema, - FileSchema, - ] - - def __new__(cls, arg: typing.Union[io.FileIO, io.BufferedReader, bytes], **kwargs: Configuration): - return super().__new__(cls, arg) - - -class BoolSchema( - BoolBase, - Schema, - BoolMixin -): - - @classmethod - def from_openapi_data_oapg(cls, arg: bool, _configuration: typing.Optional[Configuration] = None): - return super().from_openapi_data_oapg(arg, _configuration=_configuration) - - def __new__(cls, arg: bool, **kwargs: ValidationMetadata): - return super().__new__(cls, arg, **kwargs) - - -class AnyTypeSchema( - DictBase, - ListBase, - NumberBase, - StrBase, - BoolBase, - NoneBase, - Schema, - NoneFrozenDictTupleStrDecimalBoolFileBytesMixin -): - # Python representation of a schema defined as true or {} - pass - - -class UnsetAnyTypeSchema(AnyTypeSchema): - # Used when additionalProperties/items was not explicitly defined and a defining schema is needed - pass - - -class NotAnyTypeSchema( - ComposedSchema, -): - """ - 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 - """ - - class MetaOapg: - not_schema = AnyTypeSchema - - def __new__( - cls, - *args, - _configuration: typing.Optional[Configuration] = None, - ) -> 'NotAnyTypeSchema': - return super().__new__( - cls, - *args, - _configuration=_configuration, - ) - - -class DictSchema( - DictBase, - Schema, - FrozenDictMixin -): - @classmethod - def from_openapi_data_oapg(cls, arg: typing.Dict[str, typing.Any], _configuration: typing.Optional[Configuration] = None): - return super().from_openapi_data_oapg(arg, _configuration=_configuration) - - def __new__(cls, *args: typing.Union[dict, frozendict.frozendict], **kwargs: typing.Union[dict, frozendict.frozendict, list, tuple, decimal.Decimal, float, int, str, date, datetime, bool, None, bytes, Schema, Unset, ValidationMetadata]): - return super().__new__(cls, *args, **kwargs) - - -schema_type_classes = {NoneSchema, DictSchema, ListSchema, NumberSchema, StrSchema, BoolSchema, AnyTypeSchema} - - -@functools.lru_cache() -def get_new_class( - class_name: str, - bases: typing.Tuple[typing.Type[typing.Union[Schema, typing.Any]], ...] -) -> typing.Type[Schema]: - """ - Returns a new class that is made with the subclass bases - """ - new_cls: typing.Type[Schema] = type(class_name, bases, {}) - return new_cls - - -LOG_CACHE_USAGE = False - - -def log_cache_usage(cache_fn): - if LOG_CACHE_USAGE: - print(cache_fn.__name__, cache_fn.cache_info()) diff --git a/pynitrokey/nethsm/client/schemas/__init__.py b/pynitrokey/nethsm/client/schemas/__init__.py new file mode 100644 index 00000000..de2a9b79 --- /dev/null +++ b/pynitrokey/nethsm/client/schemas/__init__.py @@ -0,0 +1,148 @@ +# 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 new file mode 100644 index 00000000..bb614903 --- /dev/null +++ b/pynitrokey/nethsm/client/schemas/format.py @@ -0,0 +1,115 @@ +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 new file mode 100644 index 00000000..3897e140 --- /dev/null +++ b/pynitrokey/nethsm/client/schemas/original_immutabledict.py @@ -0,0 +1,97 @@ +""" +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 new file mode 100644 index 00000000..acce7d2e --- /dev/null +++ b/pynitrokey/nethsm/client/schemas/schema.py @@ -0,0 +1,729 @@ +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 new file mode 100644 index 00000000..c07050e9 --- /dev/null +++ b/pynitrokey/nethsm/client/schemas/schemas.py @@ -0,0 +1,375 @@ +# 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 new file mode 100644 index 00000000..e85ac119 --- /dev/null +++ b/pynitrokey/nethsm/client/schemas/validation.py @@ -0,0 +1,1285 @@ +# 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 new file mode 100644 index 00000000..14965775 --- /dev/null +++ b/pynitrokey/nethsm/client/security_schemes.py @@ -0,0 +1,228 @@ +# 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 new file mode 100644 index 00000000..1c65dde4 --- /dev/null +++ b/pynitrokey/nethsm/client/server.py @@ -0,0 +1,34 @@ +# 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 new file mode 100644 index 00000000..e69de29b diff --git a/pynitrokey/nethsm/client/servers/server_0.py b/pynitrokey/nethsm/client/servers/server_0.py new file mode 100644 index 00000000..057a998e --- /dev/null +++ b/pynitrokey/nethsm/client/servers/server_0.py @@ -0,0 +1,139 @@ +# 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 new file mode 100644 index 00000000..e69de29b diff --git a/pynitrokey/nethsm/client/shared_imports/header_imports.py b/pynitrokey/nethsm/client/shared_imports/header_imports.py new file mode 100644 index 00000000..c338a9b4 --- /dev/null +++ b/pynitrokey/nethsm/client/shared_imports/header_imports.py @@ -0,0 +1,15 @@ +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 new file mode 100644 index 00000000..0043e1e9 --- /dev/null +++ b/pynitrokey/nethsm/client/shared_imports/operation_imports.py @@ -0,0 +1,18 @@ +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 new file mode 100644 index 00000000..648e9781 --- /dev/null +++ b/pynitrokey/nethsm/client/shared_imports/response_imports.py @@ -0,0 +1,25 @@ +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 new file mode 100644 index 00000000..07f06390 --- /dev/null +++ b/pynitrokey/nethsm/client/shared_imports/schema_imports.py @@ -0,0 +1,28 @@ +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 new file mode 100644 index 00000000..9a7cfc62 --- /dev/null +++ b/pynitrokey/nethsm/client/shared_imports/security_scheme_imports.py @@ -0,0 +1,12 @@ +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 new file mode 100644 index 00000000..e69927a9 --- /dev/null +++ b/pynitrokey/nethsm/client/shared_imports/server_imports.py @@ -0,0 +1,13 @@ +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