@@ -59,11 +59,6 @@ func (f *Function) RunFunction(ctx context.Context, req *fnv1.RunFunctionRequest
5959 return rsp , nil //nolint:nilerr // errors are handled in rsp. We should not error main function and proceed with reconciliation
6060 }
6161
62- // Get query from reference if specified
63- if err := f .resolveQueryRef (req , in , rsp ); err != nil {
64- return rsp , nil //nolint:nilerr // errors are handled in rsp. We should not error main function and proceed with reconciliation
65- }
66-
6762 // Check if target is valid
6863 if ! f .isValidTarget (in .Target ) {
6964 response .Fatal (rsp , errors .Errorf ("Unrecognized target field: %s" , in .Target ))
@@ -124,30 +119,6 @@ func (f *Function) parseInputAndCredentials(req *fnv1.RunFunctionRequest, rsp *f
124119 return in , azureCreds , nil
125120}
126121
127- // resolveQueryRef resolves the query from a reference if specified.
128- func (f * Function ) resolveQueryRef (req * fnv1.RunFunctionRequest , in * v1beta1.Input , rsp * fnv1.RunFunctionResponse ) error {
129- if in .QueryRef == nil {
130- return nil
131- }
132-
133- switch {
134- case strings .HasPrefix (* in .QueryRef , "status." ):
135- if err := f .getQueryFromStatus (req , in ); err != nil {
136- response .Fatal (rsp , err )
137- return err
138- }
139- case strings .HasPrefix (* in .QueryRef , "context." ):
140- functionContext := req .GetContext ().AsMap ()
141- if queryFromContext , ok := GetNestedKey (functionContext , strings .TrimPrefix (* in .QueryRef , "context." )); ok {
142- in .CustomQuery = & queryFromContext
143- }
144- default :
145- response .Fatal (rsp , errors .Errorf ("Unrecognized QueryRef field: %s" , * in .QueryRef ))
146- return errors .New ("unrecognized QueryRef field" )
147- }
148- return nil
149- }
150-
151122// getXRAndStatus retrieves status and desired XR, handling initialization if needed
152123func (f * Function ) getXRAndStatus (req * fnv1.RunFunctionRequest ) (map [string ]interface {}, * resource.Composite , error ) {
153124 // Get both observed and desired XR
@@ -188,19 +159,6 @@ func (f *Function) getXRAndStatus(req *fnv1.RunFunctionRequest) (map[string]inte
188159 return xrStatus , dxr , nil
189160}
190161
191- // getQueryFromStatus gets query from the XR status
192- func (f * Function ) getQueryFromStatus (req * fnv1.RunFunctionRequest , in * v1beta1.Input ) error {
193- xrStatus , _ , err := f .getXRAndStatus (req )
194- if err != nil {
195- return err
196- }
197-
198- if queryFromXRStatus , ok := GetNestedKey (xrStatus , strings .TrimPrefix (* in .QueryRef , "status." )); ok {
199- in .CustomQuery = & queryFromXRStatus
200- }
201- return nil
202- }
203-
204162// checkStatusTargetHasData checks if the status target has data.
205163func (f * Function ) checkStatusTargetHasData (req * fnv1.RunFunctionRequest , in * v1beta1.Input , rsp * fnv1.RunFunctionResponse ) bool {
206164 xrStatus , _ , err := f .getXRAndStatus (req )
@@ -311,14 +269,6 @@ func (g *GraphQuery) createGraphClient(azureCreds map[string]string) (*msgraphsd
311269 return msgraphsdk .NewGraphServiceClient (adapter ), nil
312270}
313271
314- // validateCustomQuery validates a custom query input
315- func (g * GraphQuery ) validateCustomQuery (in * v1beta1.Input ) error {
316- if in .CustomQuery == nil || * in .CustomQuery == "" {
317- return errors .New ("custom query is empty" )
318- }
319- return errors .New ("custom queries not implemented" )
320- }
321-
322272// graphQuery is a concrete implementation that interacts with Microsoft Graph API.
323273func (g * GraphQuery ) graphQuery (ctx context.Context , azureCreds map [string ]string , in * v1beta1.Input ) (interface {}, error ) {
324274 // Create the Microsoft Graph client
@@ -337,8 +287,6 @@ func (g *GraphQuery) graphQuery(ctx context.Context, azureCreds map[string]strin
337287 return g .getGroupObjectIDs (ctx , client , in )
338288 case "ServicePrincipalDetails" :
339289 return g .getServicePrincipalDetails (ctx , client , in )
340- case "CustomQuery" :
341- return nil , g .validateCustomQuery (in )
342290 default :
343291 return nil , errors .Errorf ("unsupported query type: %s" , in .QueryType )
344292 }
0 commit comments