Skip to content

Commit

Permalink
Merge pull request #1019 from haarchri/feat-glue
Browse files Browse the repository at this point in the history
feat(glue): followup cleanup cr.name to external.name
  • Loading branch information
haarchri authored Jan 5, 2022
2 parents 17f1ae9 + b6142d8 commit f097d7d
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 15 deletions.
9 changes: 4 additions & 5 deletions pkg/controller/glue/classifier/setup.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@ func SetupClassifier(mgr ctrl.Manager, l logging.Logger, limiter workqueue.RateL
For(&svcapitypes.Classifier{}).
Complete(managed.NewReconciler(mgr,
resource.ManagedKind(svcapitypes.ClassifierGroupVersionKind),
managed.WithInitializers(managed.NewDefaultProviderConfig(mgr.GetClient())),
managed.WithExternalConnecter(&connector{kube: mgr.GetClient(), opts: opts}),
managed.WithPollInterval(poll),
managed.WithLogger(l.WithValues("controller", name)),
Expand Down Expand Up @@ -91,7 +90,7 @@ func preCreate(_ context.Context, cr *svcapitypes.Classifier, obj *svcsdk.Create

if cr.Spec.ForProvider.CustomCsvClassifier != nil {
obj.CsvClassifier = &svcsdk.CreateCsvClassifierRequest{
Name: &cr.Name,
Name: awsclients.String(meta.GetExternalName(cr)),
AllowSingleColumn: cr.Spec.ForProvider.CustomCsvClassifier.AllowSingleColumn,
ContainsHeader: cr.Spec.ForProvider.CustomCsvClassifier.ContainsHeader,
Delimiter: cr.Spec.ForProvider.CustomCsvClassifier.Delimiter,
Expand All @@ -103,15 +102,15 @@ func preCreate(_ context.Context, cr *svcapitypes.Classifier, obj *svcsdk.Create

if cr.Spec.ForProvider.CustomXMLClassifier != nil {
obj.XMLClassifier = &svcsdk.CreateXMLClassifierRequest{
Name: &cr.Name,
Name: awsclients.String(meta.GetExternalName(cr)),
Classification: cr.Spec.ForProvider.CustomXMLClassifier.Classification,
RowTag: cr.Spec.ForProvider.CustomXMLClassifier.RowTag,
}
}

if cr.Spec.ForProvider.CustomGrokClassifier != nil {
obj.GrokClassifier = &svcsdk.CreateGrokClassifierRequest{
Name: &cr.Name,
Name: awsclients.String(meta.GetExternalName(cr)),
Classification: cr.Spec.ForProvider.CustomGrokClassifier.Classification,
CustomPatterns: cr.Spec.ForProvider.CustomGrokClassifier.CustomPatterns,
GrokPattern: cr.Spec.ForProvider.CustomGrokClassifier.GrokPattern,
Expand All @@ -120,7 +119,7 @@ func preCreate(_ context.Context, cr *svcapitypes.Classifier, obj *svcsdk.Create

if cr.Spec.ForProvider.CustomJSONClassifier != nil {
obj.JsonClassifier = &svcsdk.CreateJsonClassifierRequest{
Name: &cr.Name,
Name: awsclients.String(meta.GetExternalName(cr)),
JsonPath: cr.Spec.ForProvider.CustomJSONClassifier.JSONPath,
}
}
Expand Down
3 changes: 1 addition & 2 deletions pkg/controller/glue/connection/setup.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@ func SetupConnection(mgr ctrl.Manager, l logging.Logger, limiter workqueue.RateL
For(&svcapitypes.Connection{}).
Complete(managed.NewReconciler(mgr,
resource.ManagedKind(svcapitypes.ConnectionGroupVersionKind),
managed.WithInitializers(managed.NewDefaultProviderConfig(mgr.GetClient())),
managed.WithExternalConnecter(&connector{kube: mgr.GetClient(), opts: opts}),
managed.WithPollInterval(poll),
managed.WithLogger(l.WithValues("controller", name)),
Expand Down Expand Up @@ -91,7 +90,7 @@ func preCreate(_ context.Context, cr *svcapitypes.Connection, obj *svcsdk.Create

if cr.Spec.ForProvider.CustomConnectionInput != nil && cr.Spec.ForProvider.CustomConnectionInput.CustomPhysicalConnectionRequirements != nil {
obj.ConnectionInput = &svcsdk.ConnectionInput{
Name: &cr.Name,
Name: awsclients.String(meta.GetExternalName(cr)),
ConnectionProperties: cr.Spec.ForProvider.CustomConnectionInput.ConnectionProperties,
ConnectionType: cr.Spec.ForProvider.CustomConnectionInput.ConnectionType,
Description: cr.Spec.ForProvider.CustomConnectionInput.Description,
Expand Down
3 changes: 1 addition & 2 deletions pkg/controller/glue/crawler/setup.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,6 @@ func SetupCrawler(mgr ctrl.Manager, l logging.Logger, limiter workqueue.RateLimi
For(&svcapitypes.Crawler{}).
Complete(managed.NewReconciler(mgr,
resource.ManagedKind(svcapitypes.CrawlerGroupVersionKind),
managed.WithInitializers(managed.NewDefaultProviderConfig(mgr.GetClient())),
managed.WithExternalConnecter(&connector{kube: mgr.GetClient(), opts: opts}),
managed.WithPollInterval(poll),
managed.WithLogger(l.WithValues("controller", name)),
Expand All @@ -80,7 +79,7 @@ func postObserve(_ context.Context, cr *svcapitypes.Crawler, _ *svcsdk.GetCrawle

func preCreate(_ context.Context, cr *svcapitypes.Crawler, obj *svcsdk.CreateCrawlerInput) error {
obj.Name = awsclients.String(meta.GetExternalName(cr))
obj.Role = &cr.Spec.ForProvider.RoleArn
obj.Role = awsclients.String(cr.Spec.ForProvider.RoleArn)
obj.Schedule = cr.Spec.ForProvider.Schedule
return nil
}
5 changes: 2 additions & 3 deletions pkg/controller/glue/database/setup.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@ func SetupDatabase(mgr ctrl.Manager, l logging.Logger, limiter workqueue.RateLim
For(&svcapitypes.Database{}).
Complete(managed.NewReconciler(mgr,
resource.ManagedKind(svcapitypes.DatabaseGroupVersionKind),
managed.WithInitializers(managed.NewDefaultProviderConfig(mgr.GetClient())),
managed.WithExternalConnecter(&connector{kube: mgr.GetClient(), opts: opts}),
managed.WithPollInterval(poll),
managed.WithLogger(l.WithValues("controller", name)),
Expand Down Expand Up @@ -91,11 +90,11 @@ func preCreate(_ context.Context, cr *svcapitypes.Database, obj *svcsdk.CreateDa

if cr.Spec.ForProvider.CustomDatabaseInput == nil {
obj.DatabaseInput = &svcsdk.DatabaseInput{
Name: &cr.Name,
Name: awsclients.String(meta.GetExternalName(cr)),
}
} else {
obj.DatabaseInput = &svcsdk.DatabaseInput{
Name: &cr.Name,
Name: awsclients.String(meta.GetExternalName(cr)),
Description: cr.Spec.ForProvider.CustomDatabaseInput.Description,
LocationUri: cr.Spec.ForProvider.CustomDatabaseInput.LocationURI,
Parameters: cr.Spec.ForProvider.CustomDatabaseInput.Parameters,
Expand Down
5 changes: 2 additions & 3 deletions pkg/controller/glue/job/setup.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@ func SetupJob(mgr ctrl.Manager, l logging.Logger, limiter workqueue.RateLimiter,
For(&svcapitypes.Job{}).
Complete(managed.NewReconciler(mgr,
resource.ManagedKind(svcapitypes.JobGroupVersionKind),
managed.WithInitializers(managed.NewDefaultProviderConfig(mgr.GetClient())),
managed.WithExternalConnecter(&connector{kube: mgr.GetClient(), opts: opts}),
managed.WithPollInterval(poll),
managed.WithLogger(l.WithValues("controller", name)),
Expand Down Expand Up @@ -89,7 +88,7 @@ func postCreate(_ context.Context, cr *svcapitypes.Job, obj *svcsdk.CreateJobOut
}

func preCreate(_ context.Context, cr *svcapitypes.Job, obj *svcsdk.CreateJobInput) error {
obj.Name = &cr.Name
obj.Role = &cr.Spec.ForProvider.RoleArn
obj.Name = awsclients.String(meta.GetExternalName(cr))
obj.Role = awsclients.String(cr.Spec.ForProvider.RoleArn)
return nil
}

0 comments on commit f097d7d

Please sign in to comment.