@@ -33,10 +33,13 @@ var (
3333 "annotations."
3434 UnknownSyncedMessage = "Unable to determine if desired resource state matches latest observed state"
3535 NotSyncedMessage = "Resource not synced"
36- TerminalMessage = "Resource is "
36+ TerminalMessage = "Resource is "
3737 SyncedMessage = "Resource synced successfully"
3838 FailedReferenceResolutionMessage = "Reference resolution failed"
3939 UnavailableIAMRoleMessage = "IAM Role is not available"
40+
41+ IAMRoleSelectedReason = "Selected"
42+ IAMRoleSelectedMessage = "roleARN: %s, selectorName: %s, selectorResourceVersion: %s"
4043)
4144
4245// Ready returns the Condition in the resource's Conditions collection that is
@@ -81,6 +84,13 @@ func ReferencesResolved(subject acktypes.ConditionManager) *ackv1alpha1.Conditio
8184 return FirstOfType (subject , ackv1alpha1 .ConditionTypeReferencesResolved )
8285}
8386
87+ // IAMRoleSelected returns the Condition in the resource's Conditions collection
88+ // that is of type ConditionTypeIAMRoleSelected. If no such condition is found,
89+ // returns nil.
90+ func IAMRoleSelected (subject acktypes.ConditionManager ) * ackv1alpha1.Condition {
91+ return FirstOfType (subject , ackv1alpha1 .ConditionTypeIAMRoleSelected )
92+ }
93+
8494// FirstOfType returns the first Condition in the resource's Conditions
8595// collection of the supplied type. If no such condition is found, returns nil.
8696func FirstOfType (
@@ -252,6 +262,30 @@ func SetReferencesResolved(
252262 subject .ReplaceConditions (allConds )
253263}
254264
265+ // SetIAMRoleSelected sets the resource's Condition of type ConditionTypeIAMRoleSelected
266+ // to the supplied status, optional message and reason.
267+ func SetIAMRoleSelected (
268+ subject acktypes.ConditionManager ,
269+ status corev1.ConditionStatus ,
270+ message * string ,
271+ reason * string ,
272+ ) {
273+ allConds := subject .Conditions ()
274+ var c * ackv1alpha1.Condition
275+ if c = ReferencesResolved (subject ); c == nil {
276+ c = & ackv1alpha1.Condition {
277+ Type : ackv1alpha1 .ConditionTypeIAMRoleSelected ,
278+ }
279+ allConds = append (allConds , c )
280+ }
281+ now := metav1 .Now ()
282+ c .LastTransitionTime = & now
283+ c .Status = status
284+ c .Message = message
285+ c .Reason = reason
286+ subject .ReplaceConditions (allConds )
287+ }
288+
255289// RemoveReferencesResolved removes the condition of type ConditionTypeReferencesResolved
256290// from the resource's conditions
257291func RemoveReferencesResolved (
0 commit comments