Skip to content

Commit f1a99f1

Browse files
committed
Update write-status-to-composite.md
1 parent cf8e2e2 commit f1a99f1

File tree

1 file changed

+12
-6
lines changed

1 file changed

+12
-6
lines changed

content/core-concepts/kcl/write-status-to-composite.md

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,18 +21,24 @@ _metadata = lambda name: str -> any {
2121
}
2222

2323
# Read the desired state for the XR from the pipeline
24-
dxr = option("params").dxr
25-
26-
# Set some new status on the XR
27-
dxr.status.someInformation = "cool-status"
24+
_dxr = option("params").dxr
2825

2926
# Construct a bucket
3027
bucket = v1beta1.Bucket {
3128
metadata: _metadata("my-bucket")
3229
spec.forProvider.region = option("oxr").spec.region
3330
}
34-
# Return the bucket and new status for the XR
35-
items = [bucket, dxr]
31+
32+
# Update the dxr status immutably
33+
_dxr = {
34+
**dxr
35+
status: {
36+
someInformation: "cool-status"
37+
}
38+
}
39+
40+
# Return the bucket and updated status for the XR
41+
items = [bucket, _dxr]
3642
```
3743

3844
Make sure you've described the status fields you write to in your function in the XRD corresponding to the composition.

0 commit comments

Comments
 (0)