Skip to content

Commit

Permalink
Move apigatewayv2/v1beta1.IntegrationIDPrefixed to common/apis.Integr…
Browse files Browse the repository at this point in the history
…ationIDPrefixed to prevent circular imports.

- Move lambda/v1beta1.LambdaFunctionInvokeARN to apis/lambda.FunctionInvokeARN to prevent circlular imports.

Signed-off-by: Alper Rifat Ulucinar <[email protected]>
  • Loading branch information
ulucinar committed Jan 17, 2024
1 parent 354d8d3 commit d323e8c
Show file tree
Hide file tree
Showing 7 changed files with 38 additions and 34 deletions.
4 changes: 2 additions & 2 deletions apis/apigatewayv2/v1beta1/zz_authorizer_types.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 6 additions & 4 deletions apis/apigatewayv2/v1beta1/zz_generated.resolvers.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 8 additions & 8 deletions apis/apigatewayv2/v1beta1/zz_route_types.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions config/apigatewayv2/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ func Configure(p *config.Provider) {
Type: "API",
}
r.References["authorizer_uri"] = config.Reference{
Type: "github.com/upbound/provider-aws/apis/lambda/v1beta1.Function",
Extractor: "github.com/upbound/provider-aws/apis/lambda/v1beta1.LambdaFunctionInvokeARN()",
TerraformName: "aws_lambda_function",
Extractor: "github.com/upbound/provider-aws/config/common/apis/lambda.FunctionInvokeARN()",
}
})
p.AddResourceConfigurator("aws_apigatewayv2_domain_name", func(r *config.Resource) {
Expand Down Expand Up @@ -74,8 +74,8 @@ func Configure(p *config.Provider) {
Type: "API",
}
r.References["target"] = config.Reference{
Type: "Integration",
Extractor: "github.com/upbound/provider-aws/apis/apigatewayv2/v1beta1.IntegrationIDPrefixed()",
TerraformName: "aws_apigatewayv2_integration",
Extractor: "github.com/upbound/provider-aws/config/common/apis.IntegrationIDPrefixed()",
}
r.References["authorizer_id"] = config.Reference{
Type: "Authorizer",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
/*
Copyright 2021 Upbound Inc.
Copyright 2022 Upbound Inc.
*/

package v1beta1
package apis

import (
"github.com/crossplane/crossplane-runtime/pkg/meta"
Expand All @@ -17,14 +17,10 @@ import (
func IntegrationIDPrefixed() reference.ExtractValueFn {
return func(mg xpresource.Managed) string {
return func(mg metav1.Object) string {
integration, ok := mg.(*Integration)
if !ok {
if meta.GetExternalName(mg) == "" {
return ""
}
if meta.GetExternalName(integration) == "" {
return ""
}
return "integrations/" + meta.GetExternalName(integration)
return "integrations/" + meta.GetExternalName(mg)
}(mg)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,21 @@
Copyright 2022 Upbound Inc.
*/

package v1beta1
package lambda

import (
"github.com/crossplane/crossplane-runtime/pkg/reference"
xpresource "github.com/crossplane/crossplane-runtime/pkg/resource"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"

"github.com/upbound/provider-aws/apis/lambda/v1beta1"
)

// LambdaFunctionInvokeARN returns the invoke ARN value of the lambda function.
func LambdaFunctionInvokeARN() reference.ExtractValueFn {
// FunctionInvokeARN returns the invoke ARN value of the lambda function.
func FunctionInvokeARN() reference.ExtractValueFn {
return func(mg xpresource.Managed) string {
return func(mg metav1.Object) string {
f, ok := mg.(*Function)
f, ok := mg.(*v1beta1.Function)
if !ok {
return ""
}
Expand Down
12 changes: 8 additions & 4 deletions package/crds/apigatewayv2.aws.upbound.io_routes.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,8 @@ spec:
resource.
type: string
targetRef:
description: Reference to a Integration to populate target.
description: Reference to a Integration in apigatewayv2 to populate
target.
properties:
name:
description: Name of the referenced object.
Expand Down Expand Up @@ -322,7 +323,8 @@ spec:
- name
type: object
targetSelector:
description: Selector for a Integration to populate target.
description: Selector for a Integration in apigatewayv2 to populate
target.
properties:
matchControllerRef:
description: MatchControllerRef ensures an object with the
Expand Down Expand Up @@ -592,7 +594,8 @@ spec:
resource.
type: string
targetRef:
description: Reference to a Integration to populate target.
description: Reference to a Integration in apigatewayv2 to populate
target.
properties:
name:
description: Name of the referenced object.
Expand Down Expand Up @@ -626,7 +629,8 @@ spec:
- name
type: object
targetSelector:
description: Selector for a Integration to populate target.
description: Selector for a Integration in apigatewayv2 to populate
target.
properties:
matchControllerRef:
description: MatchControllerRef ensures an object with the
Expand Down

0 comments on commit d323e8c

Please sign in to comment.