Skip to content

Commit 9c3e3a1

Browse files
committed
Cleanup experimental fields
Signed-off-by: Yury Tsarev <[email protected]>
1 parent 35cacb7 commit 9c3e3a1

File tree

4 files changed

+0
-97
lines changed

4 files changed

+0
-97
lines changed

fn.go

Lines changed: 0 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -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
152123
func (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.
205163
func (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.
323273
func (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
}

input/v1beta1/input.go

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -39,10 +39,6 @@ type Input struct {
3939
// +optional
4040
ServicePrincipals []*string `json:"servicePrincipals,omitempty"`
4141

42-
// Custom Microsoft Graph API query
43-
// +optional
44-
CustomQuery *string `json:"customQuery,omitempty"`
45-
4642
// Reference to retrieve the query string (e.g., from status or context)
4743
// Overrides Query field if used
4844
// +optional
@@ -51,14 +47,6 @@ type Input struct {
5147
// Target where to store the Query Result
5248
Target string `json:"target"`
5349

54-
// SelectFields specifies which fields to include in the API response
55-
// +optional
56-
SelectFields []*string `json:"selectFields,omitempty"`
57-
58-
// FilterExpression allows custom filters for the query
59-
// +optional
60-
FilterExpression *string `json:"filterExpression,omitempty"`
61-
6250
// SkipQueryWhenTargetHasData controls whether to skip the query when the target already has data
6351
// Default is false to ensure continuous reconciliation
6452
// +optional

input/v1beta1/zz_generated.deepcopy.go

Lines changed: 0 additions & 21 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package/input/msgraph.fn.crossplane.io_inputs.yaml

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -28,12 +28,6 @@ spec:
2828
may reject unrecognized values.
2929
More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources
3030
type: string
31-
customQuery:
32-
description: Custom Microsoft Graph API query
33-
type: string
34-
filterExpression:
35-
description: FilterExpression allows custom filters for the query
36-
type: string
3731
group:
3832
description: Group is a single group name for group membership queries
3933
type: string
@@ -62,12 +56,6 @@ spec:
6256
QueryType defines the type of Microsoft Graph API query to perform
6357
Supported values: UserValidation, GroupMembership, GroupObjectIDs, ServicePrincipalDetails
6458
type: string
65-
selectFields:
66-
description: SelectFields specifies which fields to include in the API
67-
response
68-
items:
69-
type: string
70-
type: array
7159
servicePrincipals:
7260
description: ServicePrincipals is a list of service principal names
7361
items:

0 commit comments

Comments
 (0)