VMware Cloud Community
rkuechler
Enthusiast
Enthusiast

Creating a file resource and give it a version number?

Hi

Has anybody an idea how to give a version number to a file resource, which I just created in a vRO workflow element?

Regards
Roman

0 Kudos
3 Replies
eoinbyrne
Expert
Expert

Hi

Script API docs from here - https://www.vroapi.com/Class/Intrinsics/1.0.0/ResourceElement - show only READ access for the version history

eoinbyrne_0-1684336432214.png

I wondered if the Server.createResourceElement script call would handle versioning so  just tried to create the same element twice from an Action in our lab (on vRA 8.10 embedded vRO) - Sadly it fails with an error (which makes sense to be fair)

eoinbyrne_1-1684336696572.png

 

Seems like access to versioning is only accessible via the Orchestrator REST API ?

eoinbyrne_2-1684337054703.png

 

It might be simpler to just version the ResourceElement names? i.e., myResourceElement_v0.1 

bsaxe
VMware Employee
VMware Employee

If you go with the API route then I suggest to use a polyglot action in the language of your choice. The context object in the polyglot containers hold an API and a token to make callbacks to itself. Then you can use the appropriate REST libs for the given language to do what you want. I have a simple action that just returns the url and token that I use in other workflows as needed.


def handler(context, inputs):

    outputs = {

      "vcoUrl": context['vcoUrl'],

      "token": context['getToken']()

    }

    return outputs
rkuechler
Enthusiast
Enthusiast

Does anyone see the possibility of adding a description to the resource file to be created?

Regards

 

Got it:

var resElem = Server.createResourceElement(folder, fileName, resElem);
resElem.description = "your description";