Este contenido no está disponible en el idioma seleccionado.

2.11. Modifying Sub-Resources


The following example outlines how to modify sub-resources. In this example, the name of a disk with the name 'test_Disk1' belonging to a virtual machine with the name 'test' is changed to 'test_Disk1_updated'.

Procedure 2.7. Updating a Sub-Resource

  1. Declare an instance of the resource whose sub-resource is to be modified:
    VM vm = api.getVMs().get("test");
  2. Declare an instance of the sub-resource to be modified:
    VMDisk disk = vm.getDisks().get("test_Disk1");
  3. Set the new value of the attribute:
    disk.setAlias("test_Disk1_updated");
  4. Update the sub-resource:
    VMDisk updateDisk = disk.update();
Red Hat logoGithubRedditYoutube

Acerca de la documentación de Red Hat

Ayudamos a los usuarios de Red Hat a innovar y alcanzar sus objetivos con nuestros productos y servicios con contenido en el que pueden confiar.

Hacer que el código abierto sea más inclusivo

Red Hat se compromete a reemplazar el lenguaje problemático en nuestro código, documentación y propiedades web. Para más detalles, consulte el Blog de Red Hat.

Acerca de Red Hat

Ofrecemos soluciones reforzadas que facilitan a las empresas trabajar en plataformas y entornos, desde el centro de datos central hasta el perímetro de la red.

© 2024 Red Hat, Inc.