Ruby Example of Creating a Tag
This example creates a tag specification and then uses it to create the tag.
The tag specification references the category identifier that was returned from the category create operation. Use the returned tag identifier for subsequent operations on the tag.
This example is based on the information that is provided in Creating a Tag.
Note: For related code
samples, see the
vSphere Automation SDK Ruby
samples at GitHub.
... # Set up a tag create spec. create_spec = Com::Vmware::Cis::Tagging::Tag::CreateSpec.new create_spec.name = 'red' create_spec.description = 'My favorite color' create_spec.category_id = $my_category_id # Create the tag. tag_stub = Com::Vmware::Cis::Tagging::Tag.new $my_stub_config $my_tag_id = tag_stub.create create_spec