Search icon
Arrow left icon
All Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletters
Free Learning
Arrow right icon
VMware vRealize Orchestrator Cookbook. - Second Edition

You're reading from  VMware vRealize Orchestrator Cookbook. - Second Edition

Product type Book
Published in Nov 2016
Publisher Packt
ISBN-13 9781786462787
Pages 556 pages
Edition 2nd Edition
Languages
Author (1):
Daniel Langenhan Daniel Langenhan
Profile icon Daniel Langenhan

Table of Contents (19) Chapters

VMware vRealize Orchestrator Cookbook Second Edition
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
1. Installing and Configuring Orchestrator 2. Optimizing Orchestrator Configuration 3. Distributed Design 4. Programming Skills 5. Visual Programming 6. Advanced Programming 7. Interacting with Orchestrator 8. Better Workflows and Optimized Working 9. Essential Plugins 10. Built-in Plugins 11. Additional Plugins 12. Working with vSphere 13. Working with vRealize Automation

Turning strings into objects


In this recipe, we will take a quick look at how to turn a string into an Orchestrator object (such as VC:VirtualMachine). This technique is rather important when you use REST to start workflows.

Getting ready

We only need the Orchestrator Client with the right to create a workflow.

How to do it...

In this example, we turn a string into VC:VirtualMachine:

  1. Create a workflow with a string input (vmString) and a VC:VirtualMachine output (vmObject).

  2. Add a scriptable task and connect the in- and output parameter.

  3. In the script, enter the following code:

          query = "xpath:name='" + vmString + "'"; 
          vms=Server.findAllForType("VC:VirtualMachine", query); 
          vmObject=vms[0]; 
    
  4. Run the workflow and enter a Virtual Machine name.

  5. Check the output and logs.

How it works...

The find function looks for all elements of a given type and can be limited using a search function. It's very important to write the correct type and the search string.

The next important...

lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at €14.99/month. Cancel anytime}