Skip to content

Commit 7ba3cf0

Browse files
committed
Added example for Update-OciAnnotation to Tutorial
1 parent b0ebe8a commit 7ba3cf0

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

OnCommand-Insight-Tutorial.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,23 @@ Get the previously added annotation
170170
$Annotation = Get-OciAnnotations | ? { $_.Name -eq "Enum test" }
171171
```
172172

173+
#### Update Annotation
174+
175+
The `Update-OciAnnotation` Cmdlet always overwrites all parameters of the annotation, thus it is recommended to get the existing Annotation, modify it and then pass the modified Annotation via the Pipeline to `Update-OciAnnotation`.
176+
177+
Here is an example to update the enum values of a FIXED_ENUM Annotation:
178+
```powershell
179+
$newEnumValues = @(@{name="two";label="two"},@{name="three";label="three"})
180+
181+
foreach ($newEnumValue in $newEnumValues) {
182+
# remove enum with same name as newEnumValue to prevent duplicates
183+
$Annotation.enumValues = $Annotation.enumValues | Where-Object { $_.Name -ne $newEnumValue.Name }
184+
$Annotation.enumValues = @($Annotation.enumValues) + [PSCustomObject]$newEnumValue
185+
}
186+
187+
$Annotation = $Annotation | Update-OciAnnotation -Verbose
188+
```
189+
173190
#### Add an annotation value to an OCI object
174191

175192
Retrieve a volume

0 commit comments

Comments
 (0)