@@ -60,8 +60,6 @@ func defaultSupportedManagementPolicies() []sets.Set[xpv1.ManagementAction] {
6060 sets.New [xpv1.ManagementAction ](xpv1 .ManagementActionAll ),
6161 // All actions explicitly set, the same as default.
6262 sets .New [xpv1.ManagementAction ](xpv1 .ManagementActionObserve , xpv1 .ManagementActionCreate , xpv1 .ManagementActionUpdate , xpv1 .ManagementActionLateInitialize , xpv1 .ManagementActionDelete ),
63- // All actions explicitly set with MustCreate instead of Create.
64- sets .New [xpv1.ManagementAction ](xpv1 .ManagementActionObserve , xpv1 .ManagementActionMustCreate , xpv1 .ManagementActionUpdate , xpv1 .ManagementActionLateInitialize , xpv1 .ManagementActionDelete ),
6563 // ObserveOnly, just observe action is done, the external resource is
6664 // considered as read-only.
6765 sets.New [xpv1.ManagementAction ](xpv1 .ManagementActionObserve ),
@@ -71,55 +69,29 @@ func defaultSupportedManagementPolicies() []sets.Set[xpv1.ManagementAction] {
7169 // No LateInitialize filling in the spec.forProvider, allowing some
7270 // external resource fields to be managed externally.
7371 sets .New [xpv1.ManagementAction ](xpv1 .ManagementActionObserve , xpv1 .ManagementActionCreate , xpv1 .ManagementActionUpdate , xpv1 .ManagementActionDelete ),
74- // No LateInitialize filling in the spec.forProvider, allowing some
75- // external resource fields to be managed externally. With MustCreate.
76- sets .New [xpv1.ManagementAction ](xpv1 .ManagementActionObserve , xpv1 .ManagementActionMustCreate , xpv1 .ManagementActionUpdate , xpv1 .ManagementActionDelete ),
7772 // No Delete, the external resource is not deleted when the managed
7873 // resource is deleted.
7974 sets .New [xpv1.ManagementAction ](xpv1 .ManagementActionObserve , xpv1 .ManagementActionCreate , xpv1 .ManagementActionUpdate , xpv1 .ManagementActionLateInitialize ),
80- // No Delete, the external resource is not deleted when the managed
81- // resource is deleted. With MustCreate.
82- sets .New [xpv1.ManagementAction ](xpv1 .ManagementActionObserve , xpv1 .ManagementActionMustCreate , xpv1 .ManagementActionUpdate , xpv1 .ManagementActionLateInitialize ),
8375 // No Delete and no LateInitialize, the external resource is not deleted
8476 // when the managed resource is deleted and the spec.forProvider is not
8577 // late initialized.
8678 sets .New [xpv1.ManagementAction ](xpv1 .ManagementActionObserve , xpv1 .ManagementActionCreate , xpv1 .ManagementActionUpdate ),
87- // No Delete and no LateInitialize, the external resource is not deleted
88- // when the managed resource is deleted and the spec.forProvider is not
89- // late initialized. With MustCreate.
90- sets .New [xpv1.ManagementAction ](xpv1 .ManagementActionObserve , xpv1 .ManagementActionMustCreate , xpv1 .ManagementActionUpdate ),
9179 // No Update, the external resource is not updated when the managed
9280 // resource is updated. Useful for immutable external resources.
9381 sets .New [xpv1.ManagementAction ](xpv1 .ManagementActionObserve , xpv1 .ManagementActionCreate , xpv1 .ManagementActionDelete , xpv1 .ManagementActionLateInitialize ),
94- // No Update, the external resource is not updated when the managed
95- // resource is updated. Useful for immutable external resources. With MustCreate.
96- sets .New [xpv1.ManagementAction ](xpv1 .ManagementActionObserve , xpv1 .ManagementActionMustCreate , xpv1 .ManagementActionDelete , xpv1 .ManagementActionLateInitialize ),
9782 // No Update and no Delete, the external resource is not updated
9883 // when the managed resource is updated and the external resource
9984 // is not deleted when the managed resource is deleted.
10085 sets .New [xpv1.ManagementAction ](xpv1 .ManagementActionObserve , xpv1 .ManagementActionCreate , xpv1 .ManagementActionLateInitialize ),
101- // No Update and no Delete, the external resource is not updated
102- // when the managed resource is updated and the external resource
103- // is not deleted when the managed resource is deleted. With MustCreate.
104- sets .New [xpv1.ManagementAction ](xpv1 .ManagementActionObserve , xpv1 .ManagementActionMustCreate , xpv1 .ManagementActionLateInitialize ),
10586 // No Update and no LateInitialize, the external resource is not updated
10687 // when the managed resource is updated and the spec.forProvider is not
10788 // late initialized.
10889 sets .New [xpv1.ManagementAction ](xpv1 .ManagementActionObserve , xpv1 .ManagementActionCreate , xpv1 .ManagementActionDelete ),
109- // No Update and no LateInitialize, the external resource is not updated
110- // when the managed resource is updated and the spec.forProvider is not
111- // late initialized. With MustCreate.
112- sets .New [xpv1.ManagementAction ](xpv1 .ManagementActionObserve , xpv1 .ManagementActionMustCreate , xpv1 .ManagementActionDelete ),
11390 // No Update, no Delete and no LateInitialize, the external resource is
11491 // not updated when the managed resource is updated, the external resource
11592 // is not deleted when the managed resource is deleted and the
11693 // spec.forProvider is not late initialized.
11794 sets .New [xpv1.ManagementAction ](xpv1 .ManagementActionObserve , xpv1 .ManagementActionCreate ),
118- // No Update, no Delete and no LateInitialize, the external resource is
119- // not updated when the managed resource is updated, the external resource
120- // is not deleted when the managed resource is deleted and the
121- // spec.forProvider is not late initialized. With MustCreate.
122- sets .New [xpv1.ManagementAction ](xpv1 .ManagementActionObserve , xpv1 .ManagementActionMustCreate ),
12395 // Like ObserveOnly, but the external resource is deleted when the
12496 // managed resource is deleted.
12597 sets .New [xpv1.ManagementAction ](xpv1 .ManagementActionObserve , xpv1 .ManagementActionDelete ),
@@ -217,18 +189,7 @@ func (m *ManagementPoliciesResolver) ShouldCreate() bool {
217189 return true
218190 }
219191
220- return m .managementPolicies .HasAny (xpv1 .ManagementActionCreate , xpv1 .ManagementActionAll , xpv1 .ManagementActionMustCreate )
221- }
222-
223- // MustCreate returns true if the Create action is required. If the resource already exists an error will
224- // be raised in the reconciler.
225- // If the management policy feature is disabled, it returns false.
226- func (m * ManagementPoliciesResolver ) MustCreate () bool {
227- if ! m .enabled {
228- return false
229- }
230-
231- return m .managementPolicies .Has (xpv1 .ManagementActionMustCreate )
192+ return m .managementPolicies .HasAny (xpv1 .ManagementActionCreate , xpv1 .ManagementActionAll )
232193}
233194
234195// ShouldUpdate returns true if the Update action is allowed.
0 commit comments