| 37 | const controlClient = new StorageControlClient(); |
| 38 | |
| 39 | async function callRenameFolder() { |
| 40 | const folderPath = controlClient.folderPath( |
| 41 | '_', |
| 42 | bucketName, |
| 43 | sourceFolderName |
| 44 | ); |
| 45 | |
| 46 | // Create the request |
| 47 | const request = { |
| 48 | name: folderPath, |
| 49 | destinationFolderId: destinationFolderName, |
| 50 | }; |
| 51 | |
| 52 | // Run request |
| 53 | await controlClient.renameFolder(request); |
| 54 | console.log( |
| 55 | `Renamed folder ${sourceFolderName} to ${destinationFolderName}.` |
| 56 | ); |
| 57 | } |
| 58 | |
| 59 | callRenameFolder(); |
| 60 | // [END storage_control_rename_folder] |