Well, this is *kinda* supported in ARIA right now. It *is* supported via the Python API: you can create an instance of any function class (such as GetProperty) and it will be serialized the storage and evaluated upon retrieval.
But it is *not* supported via ctx in Bash. If we want to support this, we would also need to find a syntax for doing so (ctx right now would have no idea if you mean to use a plain string or mean to instantiate a function). If you feel this is a useful feature, feel free to open a JIRA for it. Please describe it in as much detail as possible and perhaps add some practical use cases for the feature. (By the way, I don't see this as an issue of programming languages moving from structs to accessors, but an issue of functional programming. Functional programming languages treat functions as "first-class citizens", so that they can be passed around by value. The TOSCA spec has nothing to say about this, but it is something we can support quite easily because we built ARIA in Python, which does have this functional aspect.) On Thu, Nov 16, 2017 at 2:21 PM, DeWayne Filppi <dewa...@cloudify.co> wrote: > Yes. Permit a function to be an attribute value. This would apply to both > context and intrinsic evaluation. > > On Thu, Nov 16, 2017 at 12:18 PM, Tal Liron <t...@cloudify.co> wrote: > > > I'm not entirely sure what you are saying here. My guess is that you mean > > something like this: > > > > When setting an attribute value via ctx, you want ARIA to be able to set > > function values. For example, this is just a regular value: > > > > ctx set my_attribute "plain string value" > > > > You are saying that we should also support this: > > > > ctx set my_attribute "{ get_property: [ SELF, property_name ] }" > > > > In which case you expect ARIA to actually evaluate the function when you > > retrieve the value of my_attribute. Am I understanding you correctly? > > > > > > On Thu, Nov 16, 2017 at 1:55 PM, DeWayne Filppi <dewa...@cloudify.co> > > wrote: > > > > > What I'm talking about has nothing to do with TOSCA. It only has to do > > > with the orchestrator. Accessing an attribute has nothing to do with > > > operations. > > > > > > On Thu, Nov 16, 2017 at 11:46 AM, Tal Liron <t...@cloudify.co> wrote: > > > > > > > DeWayne, what you asking for might be achievable via the > > > > "get_operation_output" function. This function is not very well > defined > > > in > > > > TOSCA, but it seems that the expectation is that every operation can > > > return > > > > an untyped key-value dict. This has nothing to do with attributes per > > se, > > > > but behind the scenes works quite similarly. > > > > > > > > But, if you really you want something more dynamic ("call to the > cloud" > > > as > > > > you say), that doesn't exist in TOSCA right now. It could be possible > > to > > > > add such a feature to ARIA, but it would not be portable. > > > > > > > > Steve, seems that you understand it correctly. > > > > > > > > > > > > > > > > > > > > > > > > On Thu, Nov 16, 2017 at 1:25 PM, Steve Baillargeon < > > > > steve.baillarg...@ericsson.com> wrote: > > > > > > > > > Hi > > > > > A follow-up question. > > > > > I am trying to understand the meaning of "function" here. > > > > > > > > > > Is the solution as simple as defining an attribute (say of type > > > string), > > > > > skip the attribute assignment in the template and let the plugin > > > decides > > > > > the "value" for the attribute which can be a calculated value or > any > > > > > function implemented by the plugin? Yes I agree this is not > portable. > > > > > Did I miss something? > > > > > > > > > > -Steve > > > > > > > > > > -----Original Message----- > > > > > From: Tal Liron [mailto:t...@cloudify.co] > > > > > Sent: Wednesday, November 15, 2017 4:24 PM > > > > > To: dev@ariatosca.incubator.apache.org > > > > > Subject: Re: attributes > > > > > > > > > > Well, this is a bit complex. > > > > > > > > > > Attributes are ostensibly filled during runtime by other systems, > for > > > > > example during the install workflow an ip_address would get its > real > > > > value. > > > > > It's not really clear how another system would be able to insert a > > > > > function here, but it's not impossible. In ARIA's case, functions > are > > > > > implemented as pickled Python classes, so it would be possible to > do > > > > this, > > > > > however obviously it would not be portable. > > > > > > > > > > But, you can also give attributes default values. For default > values, > > > > > obviously you can use functions. > > > > > > > > > > On Wed, Nov 15, 2017 at 2:51 PM, DeWayne Filppi < > dewa...@cloudify.co > > > > > > > > wrote: > > > > > > > > > > > General TOSCA question. Is there anything in the spec that > > requires > > > > > > attributes to be values rather than functions? IOW, is there > > > anything > > > > > > in there that prevents an orchestrator from representing an > > attribute > > > > > > read as more of a "getter", rather than a database fetch? I ask > > > > > > because I've run across a case where I'd prefer an attribute > > > reference > > > > > > to return a calculated value. Seems more flexible if allowed, > and > > if > > > > > > not allowed, it should be allowed. > > > > > > > > > > > > DeWayne > > > > > > > > > > > > > > > > > > > > >