Twingate-Labs / tg-cli

Command Line Interface for Administering Twingate
Apache License 2.0
24 stars 4 forks source link

Bulk update/create Resources from Excel #11

Closed gbern-tg closed 10 months ago

gbern-tg commented 11 months ago

Bulk update/create Resources from Excel

Functionality: a means to allow admins to bulk update/create resources from excel.

Example:

  1. ./tg export - by default, exports the admin's tenant into an xlsx file
  2. The admin can go in and adjust most (see limitations below) cells for bulk configuration changes, and save the file.
  3. ./tg import -f <xlsx-file> - will import the saved configuration changes and attempt to either (a) update the existing resource or (b) create a new resource

Explanation of changes:

TwingateApiClient.mjs:

smallUtilFuncs.mjs:

importCmd.mjs:

exportCmd.mjs:

Instructions/Limitations & FRs needed:

Instructions/Limitations:

FRs needed:

chenbishop commented 10 months ago

@gbern-tg

Hi Grady, I made a commit to fix an issue where the createResource call in different places was not working because the order of the function argument was changed. Please let me know if you are happy with the changes?

I also tried to add the functionality of importing (creating and updating) security policy directly but this is require quite a bit of effort (though we can still change security policy by editing resource during the import), is this needed for your use-case ?

I ran the following tests:

  1. tg resource create, this is working now after the new commit
  2. tg export seems to be working ok
  3. tg import seems to be working ok a. tested resource update and create b. tested resource with updated security policy column change
  4. tg import on security policy does not work at the moment as mentioned previously
    1. we cannot use import to create or update the security policy directly
    2. can change policy of a resource through changing resource

Are there anything else you believe I should be testing in particular and could you let me know what have you tested already please?