eluv-io / elv-live-js

Eluvio Live JavaScript SDK
MIT License
4 stars 3 forks source link

Tenant provisioning updates #185

Open elv-serban opened 1 month ago

elv-serban commented 1 month ago

Summary of Changes:

  1. Command:

     export PRIVATE_KEY=XXX
    ./elv-live tenant_provision <tenant_contract_id> --help
    
    tenant_provision <tenant> [options]
    
    Provisions a new tenant account with standard media libraries and content types. Note this account must be created using
    space_tenant_create.
    
    Positionals:
      tenant  Tenant ID                                                                                  [string] [required]
    
    Options:
          --version      Show version number                                                                       [boolean]
      -v, --verbose      Verbose mode                                                                              [boolean]
          --as_url       Alternate authority service URL (include '/as/' route if necessary)                        [string]
          --help         Show help                                                                                 [boolean]
          --status       Path to the JSON File for existing tenant provision config                                 [string]
          --init_config  Displays the initial provisioning config, which can be used to input existing objects     [boolean]
    
  2. To run the script:

    • To run tenant provision script:

      ./elv-live tenant_provision iten2eQcZKr7y47hJkoS7crja61bf8E9
    • To run tenant provision script with existing objects set in a JSON file:

      ./elv-live tenant_provision iten2eQcZKr7y47hJkoS7crja61bf8E9 --status <json_file>
  3. Config file:

    • To get initial config either from status file (--status ) or empty object :

      ./elv-live tenant_provision iten2eQcZKr7y47hJkoS7crja61bf8E9 --init_config
      
      Tenant Provision
      Tenant ID: iten2eQcZKr7y47hJkoS7crja61bf8E9
      verbose: undefined
      status: undefined
      init-config: true
      kmsId: ikms2CtpuikdJCHgsdA3aYqMvtwt5K8j
      {
      "base": {
        "tenantOpsKey": "",
        "contentOpsKey": "",
        "groups": {
          "tenantAdminGroupAddress": "",
          "contentAdminGroupAddress": ""
        },
        "libraries": {
          "mastersLibraryId": null,
          "mezzanineLibraryId": null,
          "propertiesLibraryId": null
        },
        "tenantTypes": {
          "titleTypeId": null,
          "titleCollectionTypeId": null,
          "masterTypeId": null,
          "permissionsTypeId": null,
          "channelTypeId": null,
          "streamTypeId": null
        }
      },
      "liveStreaming": {
        "siteId": null
      },
      "mediaWallet": {
        "liveTypes": {
          "NFT Collection": null,
          "NFT Template": null,
          "Media Wallet Drop Event Site": null,
          "Media Wallet Marketplace": null,
          "Media Wallet Tenant": null
        },
        "objects": {
          "marketplaceId": "",
          "marketplaceHash": null,
          "dropEventId": null,
          "dropEventHash": null,
          "tenantObjectId": null
        }
      }
      }
    • If a provision object is set to null or an empty string, the script will create a new one. If it's set to "none", no new object will be created.

  4. Provision Methods:

    • Each provision method (base, mediaWallet, liveStreaming) ensures that all required parameters are set. If any dependent parameter is set to "none" or is missing, the script will throw an error.
  5. Final Output:

    • As the objects are created, the results are saved to the ./tenant_status.json file by default.
    • If --status <file> flag is provided, the initial config is saved as backup file in pwd and the new results are saved to the file provided.
elv-preethi commented 1 week ago

@elv-serban Updated the command as per the comments: https://github.com/eluv-io/elv-live-js/pull/185#issue-2462015268