So if the multivalue is driven from user input or an input file and will
vary in what regions are to be used, how can that be dynamic?

On Wed, May 8, 2019, 4:55 PM Matt Martz <[email protected]> wrote:

> The `body` is typically easiest represented as a YAML representation of
> the JSON data format.  So in your case, this should be what you need:
>
> - uri:
>     url:
> https://fsunix005.pne.ven.veritas.com/netbackup/config/snapshotproviders/configuredplugins/aws/instances
>     method: POST
>     body_format: json
>     body:
>       data:
>         attributes:
>           configurationAttributes:
>             - name: accesskey
>               singlevalue: key1
>             - name: secretkey
>               singlevalue: skey2
>             - multivalue:
>                 - us-east-1
>                 - us-east-2
>                 - us-west-1
>                 - us-west-2
>               name: regions
>         id: someid
>         type: plugininstance
>
> On Wed, May 8, 2019 at 4:50 PM Nicholas Britton <
> [email protected]> wrote:
>
>> I am looking to use the uri module and have been sucessfull with simpler
>> calls, but i am unsure how to get something like the following to work
>> correctly.    I have been provided what the json should look like but i am
>> unsure how to build that out via the uri module in the body syntax.
>>
>> I have also struggled to find how ansible handles nested levels in the
>> body.  from examples it looks like its just the indents.   But i am not
>> sure, if someone can help shed some light for me it would be much
>> appreciated.
>>
>> Here is what the json should look like when sent as the payload:
>>
>> POST https:
>> //fsunix005.pne.ven.veritas.com/netbackup/config/snapshotproviders/configuredplugins/aws/instances
>>
>>
>>
>> {
>>
>>   "data": {
>>
>>     "id": "someid",
>>
>>     "type": "plugininstance",
>>
>>     "attributes": {
>>
>>       "configurationAttributes": [
>>
>>         {
>>
>>           "name": "accesskey",
>>
>>           "singlevalue": "key1"
>>
>>         },
>>
>>         {
>>
>>           "name": "secretkey",
>>
>>           "singlevalue": "skey2"
>>
>>         },
>>
>>         {
>>
>>           "name": "regions",
>>
>>           "multivalue": [
>>
>>             "us-east-1",
>>
>>             "us-east-2",
>>
>>             "us-west-1",
>>
>>             "us-west-2"
>>
>>           ]
>>
>>         }
>>
>>       ]
>>
>>     }
>>
>>   }
>>
>> }
>>
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Ansible Project" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to [email protected].
>> To post to this group, send email to [email protected].
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/ansible-project/dcea4d04-b6c7-4db9-98e7-b5d13c30b908%40googlegroups.com
>> <https://groups.google.com/d/msgid/ansible-project/dcea4d04-b6c7-4db9-98e7-b5d13c30b908%40googlegroups.com?utm_medium=email&utm_source=footer>
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>
> --
> Matt Martz
> @sivel
> sivel.net
>
> --
> You received this message because you are subscribed to the Google Groups
> "Ansible Project" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To post to this group, send email to [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/ansible-project/CAD8N0v-fPFcd-OpYNjWdQAn%3Dju23nXrAwO-3hWbLyJhSPv29eQ%40mail.gmail.com
> <https://groups.google.com/d/msgid/ansible-project/CAD8N0v-fPFcd-OpYNjWdQAn%3Dju23nXrAwO-3hWbLyJhSPv29eQ%40mail.gmail.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/CAN946jSvSo6FN%2BDBrh561ZGMEA8pdfBEaHRSCT1eaXtvSOMv2A%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to