@@ -50,14 +50,49 @@ func (applicationcredentialStatusWriter) ResourceAvailableStatus(orcObject *orcv
5050
5151func (applicationcredentialStatusWriter ) ApplyResourceStatus (log logr.Logger , osResource * osResourceT , statusApply * statusApplyT ) {
5252 resourceStatus := orcapplyconfigv1alpha1 .ApplicationCredentialResourceStatus ().
53- WithName (osResource .Name )
53+ WithName (osResource .Name ).
54+ WithUnrestricted (osResource .Unrestricted ).
55+ WithSecret (osResource .Secret ).
56+ WithProjectID (osResource .ProjectID )
5457
55- // TODO(scaffolding): add all of the fields supported in the ApplicationCredentialResourceStatus struct
56- // If a zero-value isn't expected in the response, place it behind a conditional
58+ if ! osResource .ExpiresAt .IsZero () {
59+ resourceStatus .WithExpiresAt (metav1 .NewTime (osResource .ExpiresAt ))
60+ }
61+
62+ if osResource .ID != "" {
63+ resourceStatus .WithID (osResource .ID )
64+ }
5765
5866 if osResource .Description != "" {
5967 resourceStatus .WithDescription (osResource .Description )
6068 }
6169
70+ for i := range osResource .Roles {
71+ roleStatus := orcapplyconfigv1alpha1 .ApplicationCredentialAccessRoleStatus ().
72+ WithID (osResource .Roles [i ].ID ).
73+ WithName (osResource .Roles [i ].Name ).
74+ WithDomainID (osResource .Roles [i ].DomainID )
75+
76+ resourceStatus .WithRoles (roleStatus )
77+ }
78+
79+ for i := range osResource .AccessRules {
80+ accessRuleStatus := orcapplyconfigv1alpha1 .ApplicationCredentialAccessRuleStatus ().
81+ WithID (osResource .AccessRules [i ].ID ).
82+ WithPath (osResource .AccessRules [i ].Path ).
83+ WithMethod (osResource .AccessRules [i ].Method ).
84+ WithService (osResource .AccessRules [i ].Service )
85+
86+ resourceStatus .WithAccessRules (accessRuleStatus )
87+ }
88+
89+ links := make (map [string ]string , len (osResource .Links ))
90+
91+ for k , v := range osResource .Links {
92+ links [k ] = v .(string )
93+ }
94+
95+ resourceStatus .WithLinks (links )
96+
6297 statusApply .WithResource (resourceStatus )
6398}
0 commit comments