How to associate a tag with vAPI

Hi guys,.

I'm trying to associate a label vCenter for some virtual machines using the vAPI interface into orchestrator.

I found the object of 'com_vmware_cis_tagging_tag_association' with the attach method. The input to the method parameters are tag_id (String) and object_id (com_vmware_vapi_std_dynamic_id).

I found a way to get the tag_id but I wasn't able to get the object_id. How can I get an object of the type ""com_vmware_vapi_std_dynamic_id "of a VcVirtualMachine? "

Thank you.

Hello

Here is a code example (dynamic creation of ID is on lines 33 to 35). It also shows how you can search a VM using vAPI, if the VC:VirtualMachine object is not available.

// Input parameters
//  endpoint - vAPI endpoint
//  vm - VC:VirtualMachine (optional)

if (endpoint == null) {
  throw "'endpoint' parameter should not be null";
}

var client = endpoint.client();

var vmid;
if (vm != null) {
  // VC:VirtualMachine input parameter is provided; get VM ID from it
  vmid = vm.id;
} else {
  // Find VM by name using vAPI; you can find it also by other properties
  var vmsvc = new com_vmware_vcenter_VM(client);
  var spec = new com_vmware_vcenter_VM_filter__spec();
  spec.names = ["your-vm-name"]; // replace with the name of VM you wan to find
  var found = vmsvc.list(spec);
  if (found == null || found.length == 0) {
    throw "No VM found";
  }
  if (found.length > 1) {
    System.log("Multiple VMs found; will use the first one");
  }
  vmid = found[0].vm;
}

// Attach the tag
var tagsvc = new com_vmware_cis_tagging_tag__association(client);
var tagid = "urn:vmomi:InventoryServiceTag:63c7dd25-af15-4020-9c9a-6490b4c5f40b:GLOBAL"; // replace with your tag ID
var dynid = new com_vmware_vapi_std_dynamic__ID();
dynid.id = vmid;
dynid.type = "VirtualMachine";
tagsvc.attach(tagid, dynid);

Tags: VMware

Similar Questions

  • How to manage the Tags with PowerCli

    Hello

    I'm trying to find examples how to manage Customs 'Tags' in vSphere 5.1. This new feature is only used in the web client.

    I would like to create, delete, and associate tags with PowerCli objects.

    Is someone can tell me the basic commands?

    Thank you.

    Karl


    Currently, there are no PowerCLI cmdlets to manage the tags.

    But take a look at Create/Set TAGs via PowerCLI

  • How to associate an index with a foreign key constraint

    I understand how to associate a primary key constraint or a Unique key constraint index...
    Yet I don't see how to associate the index of a foreign key constraint. Is this possible?

    Thank you
    Bob Larsen

    Hi Bob,

    In Data Modeler, physical model for Oracle primary and unique keys dialog boxes offer an Index field using, which is used to generate the 'using_index_clause' in the DDL for primary and Unique key constraints.
    However the Oracle Database DDL does not have the "using_index_clause" for Foreign Key constraints, thus Data Modeler does not provide this feature for foreign keys.

    So, you will need to create a separate Index that uses the same columns as the foreign key (using the index page of the table properties dialog box in the relational model).

    David

  • How to associate policies crypto with tunnel-group?

    Hi, when I review the configuration of the VPN from point to point, I have a question. The ASA has three peer-to-peer VPN configuration. So, there are also three groups of tunnel in there. My question is how each VPN to ensure encryption policy tunnel-group? In the anther Word, what encryption policy associated with tunnel-group? Thank you.

    This is the phase 1, they work from top to bottom.  When you try to negotiate the tunnel between two counterparts, in the background, they send all of your policies and according to which is first (from top to bottom) is used.

    For example.

    If your counterpart device uses (3des, md5, pre-shared key and group 2), it will not match the policy 1 and the rest of the policy will not be considered.

    Kind regards

    Sandra

  • How to associate a webservice with ADF Model-ViewController App

    Hello

    I have an ADF Model-ViewController application, created in the role of merger Application developers in Jdeveloper.
    Now, I would like to associate this application, an instance of the Web service, which I already have in a jar definition adflib.
    Basically, an instance of this Application that runs on WLS need to have a corresponding web service instance running. (1. 1 relationship)

    Is this possible using the configuration files? Or is it possible to start this web service programmatically?

    I want to use this web service to talk about this application of WLS field side. (by an application that is running on an other WLS)

    I want the definition of the web service in this application.
    And this application will be deployed to Weblogic Server as an ear.

    Thank you
    Jean Claude

    Published by: user10124649 on December 17, 2009 08:29

    You can publish your AM with a web service interface see:
    http://download.Oracle.com/docs/CD/E15523_01/Web.1111/b31974/bcextservices.htm#CJAJGIEB

    If you want to be deployed as a separate application, just create a new application in JDeveloper and bring the same BC ADF Model project that you have in it.

  • How to associate a browser with a new tab. When I click on the new tab, it's a blank page. I would like to a browser to load automatically into a new table.

    When I open a new tab, there is a blank page. I would like to a browser to load into a new tab, instead of having to click a browser after I opened the tab.

    Firefox and IE are web browsers, where Google and Bing are the search engines.

    By default, Firefox has a blank page when you open a new tab, which can be changed with a few different extensions.

    https://addons.Mozilla.org/en-us/Firefox/addon/NewTabURL/

    Place it just to any web page or a page of search engine as you want to see in a new tab.

  • How to associate cluster esx with the data report store

    Hi all

    I'm running a repore that displays data stores less than 50 free concerts. The storage team would like a coloum for esx clusters associated with the LUN. I can't see to find it and what is possible.

    Thanks in advance,

    Scott.

    I would create a WCF function, script type, with a timeRange parameter and a new data store VMWDatastore context parameter, required, not a list.  Set the output in common: string.

    Add the following script:

    QS = server. QueryService

    Query = "!" "VMWCluster where esxServers.datastores.uniqueId = ' ${datastore.uniqueId}"

    cluster = server. QueryService.queryTopologyObjects (query)

    clusterNames = clusters? collect {cluster-> cluster?. name}?. Join(', ')

    return clusterNames

    You can then use this in your report, feeding the entrance of context for the current row data store.

  • How to associate a .fp file with a .lib file?

    Hello

    How to associate a .fp I create in the ICB with a .lib (i.e. not a .c file) file so that I can create a range of service to go with an external library that I can disseminate to third parties through a .dll file?  The help file seems to hint that this is possible, but I don't understand how to do.  Pointers?

    Thank you.

    The association is done automatically: If you have a .lib file with the same name as the file .fp, in the same location as the .fp, CVI will use the .lib file as the program of the .fp file, even if there is also a .c file with the same name.

    You can check what program file is attached to the instrument by selecting Edit tool from the context menu of the instrument in the tree of the Instrument of the workspace window, and then clicking the button information display.

    Luis

  • How to associate with 3 rd-party WEP AP (instead of WPA AP) with the universal client?

    the following example shows how to associate with a WAP to a Cisco router access point:

    ! http://www.Cisco.com/en/us/docs/routers/access/1800/wireless/configuration/guide/s37wep.html#wp1037774
    ! universal client configuration example for encryption of the ARS + TKIP, WPA - PSK:

    dot11 ssid test10
    open authentication
    authentication wpa key management
    WPA - psk ascii 7 11584B5643475D5B5C737B
    output

    interface Dot11Radio0/1/0
    DHCP IP address
    encryption ciphers aes - ccm mode
    SSID test10
    station-role nonroot
    output

    Hello

    If you need instead of WPA WEP... Here is the config...

    dot11 ssid test10
    open authentication
    output

    interface Dot11Radio0/1/0
    DHCP IP address
    mandatory encryption wep mode
    1 size 40-bit encryption key
    SSID test10
    station-role nonroot
    output

    Let me know if that answers your question and please do not forget to note the useful messages!

    Concerning

    Surendra

  • How the elements tag with two tags?

    With the following function I can tag with bold and italic tags xml elements. The problem is, I also need '< b > < i >' for example. Now my question is, how is that possible?

    function tagStyles (myXmlElement) {}

    app.findTextPreferences = app.changeTextPreferences = NothingEnum.nothing;

    app.findChangeTextOptions.caseSensitive = false;

    app.findChangeTextOptions.includeFootnotes = app.findChangeGrepOptions.includeFootnotes = false;

    app.findChangeTextOptions.includeHiddenLayers = false;

    app.findChangeTextOptions.includeLockedLayersForFind = false;

    app.findChangeTextOptions.includeLockedStoriesForFind = false;

    app.findChangeTextOptions.includeMasterPages = false;

    app.findChangeTextOptions.wholeWord = false;

    objectToTag = myXmlElement;

    italic conversion

    need to be developed for other styles

    attention to the problems of nested xml tags

    app.findGrepPreferences = app.changeGrepPreferences = NothingEnum.nothing;

    app.findGrepPreferences.findWhat = '. '. + » ;

    app.findGrepPreferences.fontStyle = "italic";

    var myFindTexts = myXmlElement.findGrep ();

    If (myFindTexts.length > 0) {}

    for (var j = 0; j < myFindTexts.length; j ++) {}

    var myText = myFindTexts [j];

    var myStartIndex = myText.characters [0] .index;

    var = myText.characters [-1] .index myEndIndex;

    objectToTag = objectToTag.xmlElements.add ({markupTag: "i", xmlContent:myText});})

    myShift += 2;

    }

    }

    conversion "BOLD"

    need to be developed for other styles

    attention to the problems of nested xml tags

    app.findGrepPreferences = app.changeGrepPreferences = NothingEnum.nothing;

    app.findGrepPreferences.findWhat = '. '. + » ;

    app.findGrepPreferences.fontStyle = "Bold";

    var myFindTexts = myXmlElement.findGrep ();

    If (myFindTexts.length > 0) {}

    for (var j = 0; j < myFindTexts.length; j ++) {}

    var myText = myFindTexts [j];

    var myStartIndex = myText.characters [0] .index;

    var = myText.characters [-1] .index myEndIndex;

    objectToTag = objectToTag.xmlElements.add ({markupTag: "b", xmlContent:myText});})

    }

    }

    bold italics conversion

    need to be developed for other styles

    attention to the problems of nested xml tags

    app.findGrepPreferences = app.changeGrepPreferences = NothingEnum.nothing;

    app.findGrepPreferences.findWhat = '. '. + » ;

    app.findGrepPreferences.fontStyle = "Bold Italic";

    var myFindTexts = myXmlElement.findGrep ();

    If (myFindTexts.length > 0) {}

    for (var j = 0; j < myFindTexts.length; j ++) {}

    var myText = myFindTexts [j];

    var myStartIndex = myText.characters [0] .index;

    var = myText.characters [-1] .index myEndIndex;

    objectToTag = objectToTag.xmlElements.add ({markupTag: "b", xmlContent:myText});})

    }

    objectToTag = myXmlElement;

    for (var j = 0; j < myFindTexts.length; j ++) {}

    var myText = myFindTexts [j];

    var myStartIndex = myText.characters [0] .index;

    var = myText.characters [-1] .index myEndIndex;

    objectToTag = objectToTag.xmlElements.add ({markupTag: "i", xmlContent:myText});})

    }

    }

    }

    When there is an element with the "Bold Italic" style it looks like this: 'my element with < b > < /b > < i > "BOLD" and the italic text < /i > '. There it looks like this: ' my element with < b > < i > bold and italic < /i > < / b > text.

    Does anyone have an idea on this?

    Thanks in advance!

    Dear Stamm,

    Try this...

    objectToTag = objectToTag.xmlElements.add ({markupTag: "b", xmlContent:myText});})

    App.Select (objectToTag.texts);

    App.Selection [0] .associatedXMLElements [0].xmlElements.Add ("i", app.selection [0]);

    Kind regards

    Bala

  • How can I associate a font with many styles appears as a police

    How can I associate a font with many styles appears as a police? I have quite a few fonts, which, instead of appearing as a police unique with different font styles (bold, bolditalic, medium, light...), each style appears in the dropdown font as a separate policy. Anyway I can fix this?

    Another font question, is possible to group my fonts in the drop down menu under different categories such as "favorite san serif fonts" or "script font"?

    You can not. That's what the creator of police must adjust. If they do not have

    Set it up properly as one family, it will appear as a separate font

    in InDesign.

    What we are talking about the police, incidentally?

  • How can I really associate .as ActionScript with Flash Builder file in Windows 8?

    How can I really associate .as ActionScript with Flash Builder file in Windows 8?

    In Windows 7, you have to go to preferences - Flash Builder - File Associations, etc. There is no file Associations in the Windows 8 version: (see image)

    Adobe made a web page that indicates that you must use Windows Explorer to associate FlashBuilder.exe .as files, but it does not work: http://helpx.Adobe.com/Flash-Builder/KB/unable-set-default-file-associations.html

    FlashBuilder.exe does not support opening a file .as like that. Flash Builder attempts to launch a new process and requires a different workspace to be able to open a Windows file. So either Adobe should add support for binding to the Windows 8 file in Flash Builder, or it must be a setting that prevents the Flash Builder to open a second instance of process.

    Flash Builder Settings.jpg

    I found a solution. I used a Windows 7 machine that is the file association appropriate and observed the key of Windows registry using regedit.exe. I exported the key and made a .reg file and copied on my machine Windows 8. After installing registry keys, the associated file did not immediately because Windows 8 has this key to the user choice that always associates the file .as with Flash Professional. So after installing the underside of the keys, then I used Windows Explorer to associate files with Flash Builder .as and my file associations work as expected. It is an Adobe specific integration problem that must be fixed on the end of Adobe to support file associations in Windows 8.

    Success as follows:

    (1) install the registry keys below

    (2) use the Windows Explorer to always associate FlashBuilder.exe .as files

    ========================================================================================

    copy the below into a file with the .reg extension. Then use the "Merge" command to Windows Explorer to install in the registry

    ========================================================================================

    Windows Registry Editor Version 5.00

    [HKEY_CLASSES_ROOT\.as]

    @= "FlashBuilder.ActionScript".

    [HKEY_CLASSES_ROOT\.as\ShellNew]

    "NullFile"=""

    [HKEY_CLASSES_ROOT\FlashBuilder.ActionScript]

    [HKEY_CLASSES_ROOT\FlashBuilder.ActionScript\DefaultIcon]

    @= "C:\\Program Files\\Adobe\\Adobe Flash Builder 4.7 (64 Bit)\\eclipse\\plugins\\com.adobe.flexbuilder.ui_4.7.0.349722\\icons\\fb_as.ico.

    [HKEY_CLASSES_ROOT\FlashBuilder.ActionScript\Shell]

    [HKEY_CLASSES_ROOT\FlashBuilder.ActionScript\Shell\Open]

    [HKEY_CLASSES_ROOT\FlashBuilder.ActionScript\Shell\Open\Command]

    @= hex (2): 22, 43, 00, 00, 3 a, 00 5 c 00, 50, 00, 72, 00, 6f, 00, 67, 00, 72, 00, 61, 00, 6 d, 00, 20,.

    00,46,00,69,00 6 c 00, 65, 00, 73, 00, 5 c, 00, 41, 00, 64, 00, 6f, 00, 62, 00, 65, 00, 5 c, 00,------.

    41,00,64,00, 6f, 00, 62, 00, 65, 00, 20, 00, 46, 00, 6 c, 00, 61, 00, 73, 00, 68, 00, 20, 00, 42,------.

    00,75,00,69,00 6 c 00, 64, 00, 65, 00, 72, 00, 00, 20, 34, 00, 2nd, 00, 37, 00, 20, 00, 28, 00,------.

    36,00,34,00,20,00,42,00,69,00,74,00,29,00 5 C 00, 46, 00, 6 C, 00, 61, 00, 73, 00, 68,.

    00,42,00,75,00,69,00, 6 c, 00, 64, 00, 65, 00, 72, 00, 2nd, 00, 65, 00, 78, 00, 65, 00, 22, 00,------.

    20.00, 2d, 00, 6F, 00, 61, 00, 6 d, 00, 65, 00, 20, 00, 22, 00, 46, 00, 6 c, 00, 61, 00, 73, 00, 68,.

    00,20,00,42,00,75,00,69,00 6 c 00, 64, 00, 65, 00, 72, 00, 22, 00, 20, 00, 2d, 00, 2d, 00,------.

    6 c, 00, 61, 00, 75, 00, 6F, 00, 63, 00, 68, 00, 65, 00, 72, 00, 2nd, 00, 6f, 00, 00, 65, 70, 00, 6e,------.

    00,46,00,69,00 6 C 00, 65, 00, 20, 00, 22, 00, 25, 00, 31, 00, 22, 00, 00, 00

    [HKEY_LOCAL_MACHINE\SOFTWARE\.as]

    @= "FlashBuilder.ActionScript".

    [HKEY_LOCAL_MACHINE\SOFTWARE\.as\ShellNew]

    "NullFile"=""

    [HKEY_LOCAL_MACHINE\SOFTWARE\FlashBuilder.ActionScript]

    [HKEY_LOCAL_MACHINE\SOFTWARE\FlashBuilder.ActionScript\DefaultIcon]

    @= "C:\\Program Files\\Adobe\\Adobe Flash Builder 4.7 (64 Bit)\\eclipse\\plugins\\com.adobe.flexbuilder.ui_4.7.0.349722\\icons\\fb_as.ico.

    [HKEY_LOCAL_MACHINE\SOFTWARE\FlashBuilder.ActionScript\Shell]

    [HKEY_LOCAL_MACHINE\SOFTWARE\FlashBuilder.ActionScript\Shell\Open]

    [HKEY_LOCAL_MACHINE\SOFTWARE\FlashBuilder.ActionScript\Shell\Open\Command]

    @= hex (2): 22, 43, 00, 00, 3 a, 00 5 c 00, 50, 00, 72, 00, 6f, 00, 67, 00, 72, 00, 61, 00, 6 d, 00, 20,.

    00,46,00,69,00 6 c 00, 65, 00, 73, 00, 5 c, 00, 41, 00, 64, 00, 6f, 00, 62, 00, 65, 00, 5 c, 00,------.

    41,00,64,00, 6f, 00, 62, 00, 65, 00, 20, 00, 46, 00, 6 c, 00, 61, 00, 73, 00, 68, 00, 20, 00, 42,------.

    00,75,00,69,00 6 c 00, 64, 00, 65, 00, 72, 00, 00, 20, 34, 00, 2nd, 00, 37, 00, 20, 00, 28, 00,------.

    36,00,34,00,20,00,42,00,69,00,74,00,29,00 5 C 00, 46, 00, 6 C, 00, 61, 00, 73, 00, 68,.

    00,42,00,75,00,69,00, 6 c, 00, 64, 00, 65, 00, 72, 00, 2nd, 00, 65, 00, 78, 00, 65, 00, 22, 00,------.

    20.00, 2d, 00, 6F, 00, 61, 00, 6 d, 00, 65, 00, 20, 00, 22, 00, 46, 00, 6 c, 00, 61, 00, 73, 00, 68,.

    00,20,00,42,00,75,00,69,00 6 c 00, 64, 00, 65, 00, 72, 00, 22, 00, 20, 00, 2d, 00, 2d, 00,------.

    6 c, 00, 61, 00, 75, 00, 6F, 00, 63, 00, 68, 00, 65, 00, 72, 00, 2nd, 00, 6f, 00, 00, 65, 70, 00, 6e,------.

    00,46,00,69,00 6 C 00, 65, 00, 20, 00, 22, 00, 25, 00, 31, 00, 22, 00, 00, 00

  • How can I associate a button with two slices?

    Hello
    I need help please. How can I associate a button with two slices? or combine the two slices to make one cut or make a form of true polygon on the edges, it will make to the polygon, but it leaves the red lines and I cannot work under this installment... If you understand. Someone help please. Thank you very much.

    Two points.

    First of all, I see that you have forms stars in your image, but that does not mean that you need a star-shaped slice. You can use a little square that is centered on your star. That could make it easier to create your slices. All you have to do is drag lines of leaders in the left seat and superior, two pairs around each star and then drag a slice from one end to the other.

    Noting that brings me to my second point: images must be rectangular. If you want to change the L-shaped area, then you need to swap two images, not one only. This is perhaps why you cannot have the buttons under the threshold of upper sliding of your L shaped section. Because Fireworks needs to make a rectangular image, it is by default in an area that encompasses the range - area you can not the buttons in. It is the lock area non cut which still need to be part of the image, since the part will swap, too.

  • How one manually associate the file with an application types?

    I recently installed the Adobe Digital Editions software to download an e-book I bought. It will not open in ADE, and the manual of the ADE advises me to "manually associate the" types with the application of the EPUB files and the subsidies agreement. 'See the instructions for your operating system for associating file types'. I can't find the instructions for it anywhere. HELP, please.

    Support cat either does not!

    Click context (right click) on the file and the menu should give you one option 'Open with' - at the end of which is 'Other' - which should allow you to engage in the type of file you want

  • How to associate the same contact with two different accounts to import

    Hello

    (1) I want to associate the same contact (ex: person) to two different accounts (account A and account B) import.

    I tried with the Unique ID from outside Contact but it is accidental and in the end, I am able to associate this Contact with a single account.



    (2) I also can't records to import custom object with the same name through the import process.



    Could someone advice on the same.

    With regard to your questions:

    (1) currently, it is not possible using the Import Wizard. However, it could be done using web services.
    (2) the name must be different.

Maybe you are looking for