@@ -50,14 +50,55 @@ 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+ WithProjectID (osResource .ProjectID )
5456
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
57+ if osResource .Secret != "" {
58+ resourceStatus .WithSecret (osResource .Secret )
59+ }
60+
61+ if ! osResource .ExpiresAt .IsZero () {
62+ resourceStatus .WithExpiresAt (metav1 .NewTime (osResource .ExpiresAt ))
63+ }
64+
65+ if osResource .ID != "" {
66+ resourceStatus .WithID (osResource .ID )
67+ }
5768
5869 if osResource .Description != "" {
5970 resourceStatus .WithDescription (osResource .Description )
6071 }
6172
73+ for i := range osResource .Roles {
74+ roleStatus := orcapplyconfigv1alpha1 .ApplicationCredentialAccessRoleStatus ().
75+ WithID (osResource .Roles [i ].ID ).
76+ WithName (osResource .Roles [i ].Name )
77+
78+ if osResource .Roles [i ].DomainID != "" {
79+ roleStatus .WithDomainID (osResource .Roles [i ].DomainID )
80+ }
81+
82+ resourceStatus .WithRoles (roleStatus )
83+ }
84+
85+ for i := range osResource .AccessRules {
86+ accessRuleStatus := orcapplyconfigv1alpha1 .ApplicationCredentialAccessRuleStatus ().
87+ WithID (osResource .AccessRules [i ].ID ).
88+ WithPath (osResource .AccessRules [i ].Path ).
89+ WithMethod (osResource .AccessRules [i ].Method ).
90+ WithService (osResource .AccessRules [i ].Service )
91+
92+ resourceStatus .WithAccessRules (accessRuleStatus )
93+ }
94+
95+ links := make (map [string ]string , len (osResource .Links ))
96+
97+ for k , v := range osResource .Links {
98+ links [k ] = v .(string )
99+ }
100+
101+ resourceStatus .WithLinks (links )
102+
62103 statusApply .WithResource (resourceStatus )
63104}
0 commit comments