def secret(uuid): conn = libvrt.wvmSecrets() try: conn.delete_secret(uuid) except libvirtError as err: error_msg(err) conn.close()
def secret(uuid, secret: SecretValue): conn = libvrt.wvmSecrets() try: conn.set_secret_value(uuid, secret.value) except libvirtError as err: error_msg(err) conn.close() return secret
def secrets(secret: SecretCreate): conn = libvrt.wvmSecrets() try: conn.create_secret(secret.ephemeral, secret.private, secret.secret_type, secret.data) except libvirtError as err: error_msg(err) conn.close() return secret
def secrets(): secrets_list = [] conn = libvrt.wvmSecrets() for uuid in conn.get_secrets(): secret = conn.get_secret(uuid) secrets_list.append({ 'usage': secret.usageID(), 'uuid': secret.UUIDString(), 'usageType': secret.usageType(), 'value': conn.get_secret_value(uuid) }) conn.close() return {'secrets': secrets_list}
def secret(uuid): conn = libvrt.wvmSecrets() try: secret = conn.get_secret(uuid) except libvirtError as err: error_msg(err) secret = { 'usage': secret.usageID(), 'uuid': secret.UUIDString(), 'usageType': secret.usageType(), 'value': conn.get_secret_value(uuid) } conn.close() return {'secret': secret}