Questo contenuto non è disponibile nella lingua selezionata.

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");
    Copy to Clipboard Toggle word wrap
  2. Declare an instance of the sub-resource to be modified:
    VMDisk disk = vm.getDisks().get("test_Disk1");
    Copy to Clipboard Toggle word wrap
  3. Set the new value of the attribute:
    disk.setAlias("test_Disk1_updated");
    Copy to Clipboard Toggle word wrap
  4. Update the sub-resource:
    VMDisk updateDisk = disk.update();
    Copy to Clipboard Toggle word wrap
Red Hat logoGithubredditYoutubeTwitter

Formazione

Prova, acquista e vendi

Community

Informazioni sulla documentazione di Red Hat

Aiutiamo gli utenti Red Hat a innovarsi e raggiungere i propri obiettivi con i nostri prodotti e servizi grazie a contenuti di cui possono fidarsi. Esplora i nostri ultimi aggiornamenti.

Rendiamo l’open source più inclusivo

Red Hat si impegna a sostituire il linguaggio problematico nel codice, nella documentazione e nelle proprietà web. Per maggiori dettagli, visita il Blog di Red Hat.

Informazioni su Red Hat

Forniamo soluzioni consolidate che rendono più semplice per le aziende lavorare su piattaforme e ambienti diversi, dal datacenter centrale all'edge della rete.

Theme

© 2026 Red Hat
Torna in cima