// Sync will attempt to take the exported field value from the source ACK
// resource and write it into the destination field export output type.
Sync will attempt to take the exported field value from the source ACK
resource and write it into the destination field export output type.
// Sync will attempt to take the exported field value from the source ACK // resource and write it into the destination field export output type .
func (r *fieldExportReconciler) Sync(
	ctx context.Context,
	from acktypes.AWSResource,
	desired ackv1alpha1.FieldExport,
) (ackv1alpha1.FieldExport, error) {
	var err error
	rlog := ackrtlog.FromContext(ctx)
	exit := rlog.Trace("r.Sync")
	defer exit(err)
	latest := desired.DeepCopy()
	r.resetConditions(ctx, &desired)
	defer func() {
		r.patchStatus(ctx, &desired, latest)
	}()
	value, err := r.getSourcePathFromResource(from, *desired.Spec.From.Path)
	if err != nil {
		return desired, r.onError(ctx, &desired, err)
	} else if value == nil {
		return desired, r.onError(ctx, &desired, requeue.None(ackerr.FieldExportPathDoesNotExist))
	}
	switch desired.Spec.To.Kind {
	case ackv1alpha1.FieldExportOutputTypeConfigMap:
		if err = r.writeToConfigMap(ctx, *value, &desired); err != nil {
			return desired, r.onError(ctx, &desired, err)
		}
	case ackv1alpha1.FieldExportOutputTypeSecret:
		if err = r.writeToSecret(ctx, *value, &desired); err != nil {
			return desired, r.onError(ctx, &desired, err)
		}
	}
	return desired, r.onSuccess(ctx, &desired)
}
func ( r * fieldExportReconciler ) Sync ( ctx context . Context , from acktypes . AWSResource , desired ackv1alpha1 . FieldExport , ) ( ackv1alpha1 . FieldExport , error ) { var err error rlog := ackrtlog . FromContext ( ctx ) exit := rlog . Trace ( " " ) defer exit ( err ) latest := desired . DeepCopy ( ) r . resetConditions ( ctx , & desired ) defer func ( ) { r . patchStatus ( ctx , & desired , latest ) } ( ) value , err := r . getSourcePathFromResource ( from , * desired . Spec . From . Path ) if err != nil { return desired , r . onError ( ctx , & desired , err ) } else if value == nil { return desired , r . onError ( ctx , & desired , requeue . None ( ackerr . FieldExportPathDoesNotExist ) ) } switch desired . Spec . To . Kind { case ackv1alpha1 . FieldExportOutputTypeConfigMap : if err = r . writeToConfigMap ( ctx , * value , & desired ) ; err != nil { return desired , r . onError ( ctx , & desired , err ) } case ackv1alpha1 . FieldExportOutputTypeSecret : if err = r . writeToSecret ( ctx , * value , & desired ) ; err != nil { return desired , r . onError ( ctx , & desired , err ) } } return desired , r . onSuccess ( ctx , & desired ) }
Sync will attempt to take the exported field value from the source ACK
resource and write it into the destination field export output type.
Sync will attempt to take the exported field value from the source ACK resource and write it into the destination field export output type .
// Get the field from the resource // Don't attempt to patch conditions again, directly return result of // 'r.onSuccess'