o |nhm@s4ddlZddlmZddlmZGdddeZdS)N)SystemBackendMixin)ParamValidationErrorc@s6eZdZddZddZ        dddZdS) InitcCsd}|jj|dS)zRead the initialization status of Vault. Supported methods: GET: /sys/init. Produces: 200 application/json :return: The JSON response of the request. :rtype: dict /v1/sys/init)url)_adapterget)selfapi_pathr G/usr/local/lib/python3.10/dist-packages/hvac/api/system_backend/init.pyread_init_statuss zInit.read_init_statuscCs|}|dS)zDetermine is Vault is initialized or not. :return: True if Vault is initialized, False otherwise. :rtype: bool initialized)r )r statusr r r is_initializedszInit.is_initializedNc Cs|dur|durd} tj| tddd}|dur(|dur(d} tj| tddd}|||d} |durD|durDt||kr@td || d <|durX|durX||krTtd || d <|dur|| d <|durr||krnd} t| || d<|durt||krtd|| d<d} |jj| | dS)a Initialize a new Vault. The Vault must not have been previously initialized. The recovery options, as well as the stored shares option, are only available when using Vault HSM. Supported methods: PUT: /sys/init. Produces: 200 application/json :param secret_shares: The number of shares to split the master key into. :type secret_shares: int :param secret_threshold: Specifies the number of shares required to reconstruct the master key. This must be less than or equal secret_shares. If using Vault HSM with auto-unsealing, this value must be the same as secret_shares, or omitted, depending on the version of Vault and the seal type. :type secret_threshold: int :param pgp_keys: List of PGP public keys used to encrypt the output unseal keys. Ordering is preserved. The keys must be base64-encoded from their original binary representation. The size of this array must be the same as secret_shares. :type pgp_keys: list :param root_token_pgp_key: Specifies a PGP public key used to encrypt the initial root token. The key must be base64-encoded from its original binary representation. :type root_token_pgp_key: str | unicode :param stored_shares: Specifies the number of shares that should be encrypted by the HSM and stored for auto-unsealing. Currently must be the same as secret_shares. :type stored_shares: int :param recovery_shares: Specifies the number of shares to split the recovery key into. :type recovery_shares: int :param recovery_threshold: Specifies the number of shares required to reconstruct the recovery key. This must be less than or equal to recovery_shares. :type recovery_threshold: int :param recovery_pgp_keys: Specifies an array of PGP public keys used to encrypt the output recovery keys. Ordering is preserved. The keys must be base64-encoded from their original binary representation. The size of this array must be the same as recovery_shares. :type recovery_pgp_keys: list :return: The JSON response of the request. :rtype: dict NzThe secret_shares parameter will default to None in hvac v3.0.0. To use the old default with no warning, explicitly set this value to 5. See https://github.com/hvac/hvac/issues/1030)messagecategory stacklevelzThe secret_threshold parameter will default to None in hvac v3.0.0. To use the old default with no warning, explicitly set this value to 3. See https://github.com/hvac/hvac/issues/1030) secret_sharessecret_thresholdroot_token_pgp_keyz?length of pgp_keys list argument must equal secret_shares valuepgp_keyszBvalue for stored_shares argument must equal secret_shares argument stored_sharesrecovery_sharesz\value for recovery_threshold argument must be less than or equal to recovery_shares argumentrecovery_thresholdzJlength of recovery_pgp_keys list argument must equal recovery_shares valuerecovery_pgp_keysr)rjson)warningswarnDeprecationWarninglenrrput) r rrrrrrrrmsgparams error_msgr r r r initializesh1  zInit.initialize)NNNNNNNN)__name__ __module__ __qualname__r rr(r r r r rs r)r ,hvac.api.system_backend.system_backend_mixinrhvac.exceptionsrrr r r r s