57
57
' template_name=s' => \(my $template_name ),
58
58
' container_name=s' => \(my $container_name ),
59
59
' bookmark_name=s' => \(my $bookmark_name ),
60
+ ' usefullname' => \(my $usefullname ),
60
61
' branch_name=s' => \(my $branch_name ),
61
62
' bookmark_branchname=s' => \(my $full_branchname ),
62
63
' bookmark_time=s' => \(my $bookmark_time ),
95
96
96
97
if (lc $action eq ' create' ) {
97
98
98
- if (!defined ($template_name ) || (!defined ($bookmark_name ))) {
99
- print " Options template_name and bookmark_name are required \n " ;
99
+ if (!defined ($template_name ) || (!( defined ($bookmark_name ) ))) {
100
+ print " Options template_name and bookmark_name or bookmark_prefix are required \n " ;
100
101
pod2usage(-verbose => 1, -input => \*DATA );
101
102
exit (1);
102
103
}
126
127
exit (1);
127
128
}
128
129
130
+ if ((( lc $snapshots eq ' all' ) || ( lc $snapshots eq ' both' )) && (defined ($usefullname ))) {
131
+ print " Snapshot option all or both can't run with usefullname flag \n " ;
132
+ pod2usage(-verbose => 1, -input => \*DATA );
133
+ exit (1);
134
+ }
135
+
129
136
if (defined ($snapshots ) && (!defined ($source ))) {
130
137
print " Option snapshot require a source to be defined \n " ;
131
138
pod2usage(-verbose => 1, -input => \*DATA );
@@ -385,7 +392,7 @@ sub generate_snapshot_mapping {
385
392
if ((lc $snapshots eq ' first' ) || (lc $snapshots eq ' both' )) {
386
393
# find a first snapshot which can be used for bookmark ( has been taken after template was created )
387
394
for my $snapitem ( @{ $snapshot -> getSnapshots() }) {
388
- my $time = $snapshot -> getSnapshotCreationTime ($snapitem );
395
+ my $time = $snapshot -> getStartPoint ($snapitem );
389
396
my $goodtime ;
390
397
if (version-> parse($engine_obj -> getApi()) < version-> parse(1.8.0)) {
391
398
$goodtime = $datasources -> checkTime($datalayout_ref , $time );
@@ -396,7 +403,12 @@ sub generate_snapshot_mapping {
396
403
my $timename = $time ;
397
404
$timename =~ s / T/ / ;
398
405
$timename =~ s /\. ...Z// ;
399
- $bookmark_times_hash {$bookmark_name . ' -' . $timename } = $time ;
406
+ if (defined ($usefullname )) {
407
+ $timename = $bookmark_name ;
408
+ } else {
409
+ $timename = $bookmark_name . " -" . $timename
410
+ }
411
+ $bookmark_times_hash {$timename } = $time ;
400
412
last ;
401
413
}
402
414
}
@@ -405,7 +417,7 @@ sub generate_snapshot_mapping {
405
417
if ((lc $snapshots eq ' last' ) || (lc $snapshots eq ' both' )) {
406
418
my $last_time = (@{ $snapshot -> getSnapshots() })[-1];
407
419
408
- my $time = $snapshot -> getSnapshotCreationTime ($last_time );
420
+ my $time = $snapshot -> getStartPoint ($last_time );
409
421
my $goodtime ;
410
422
if (version-> parse($engine_obj -> getApi()) < version-> parse(1.8.0)) {
411
423
$goodtime = $datasources -> checkTime($datalayout_ref , $time );
@@ -417,13 +429,18 @@ sub generate_snapshot_mapping {
417
429
my $timename = $time ;
418
430
$timename =~ s / T/ / ;
419
431
$timename =~ s /\. ...Z// ;
420
- $bookmark_times_hash {$bookmark_name . ' -' . $timename } = $time ;
432
+ if (defined ($usefullname )) {
433
+ $timename = $bookmark_name ;
434
+ } else {
435
+ $timename = $bookmark_name . " -" . $timename
436
+ }
437
+ $bookmark_times_hash {$timename } = $time ;
421
438
}
422
439
}
423
440
424
441
if (lc $snapshots eq ' all' ) {
425
442
for my $snapitem ( @{ $snapshot -> getSnapshots() }) {
426
- my $time = $snapshot -> getSnapshotCreationTime ($snapitem );
443
+ my $time = $snapshot -> getStartPoint ($snapitem );
427
444
my $goodtime ;
428
445
if (version-> parse($engine_obj -> getApi()) < version-> parse(1.8.0)) {
429
446
$goodtime = $datasources -> checkTime($datalayout_ref , $time );
@@ -458,6 +475,7 @@ =head1 SYNOPSIS
458
475
[-source source_name]
459
476
[-container_name container_name]
460
477
[-expireat timestamp ]
478
+ [-usefullname]
461
479
[ --help|? ] [ -debug ]
462
480
463
481
=head1 DESCRIPTION
@@ -507,7 +525,18 @@ =head2 Options
507
525
Set container for bookmark using container name
508
526
509
527
=item B<-bookmark_name bookmark_name >
510
- Set bookmark name
528
+ Set bookmark name if bookmark is created using bookmark_time.
529
+ When bookmarks are created using snapshot option,
530
+ names will be generated using bookmark name as a prefix
531
+ and snapshot time.
532
+
533
+ This behaviour can be modified using usefullname flag
534
+
535
+ =item B<-usefullname >
536
+ If bookmarks are created using a snapshot last or snapshot first
537
+ option, this flag will force a bookmark name to be set without
538
+ adding a time of the snapshot
539
+
511
540
512
541
=item B<-bookmark_time time >
513
542
Set bookmark time. Allowed values:
@@ -536,14 +565,25 @@ =head2 Options
536
565
537
566
=over 3
538
567
539
- =item B<-all > - create bookmarks for all snapshot of source created after template was created
568
+ =item B<-all > - create bookmarks for all snapshot of source created after template was created.
569
+ Bookmark names will be generated using this pattern: bookname_name-YYYY-MM-DDTHH:MI:SS.SSSZ
540
570
541
571
=item B<-first > - create bookmark for a first snapshot of source after template was created
572
+ Bookmark name will be generated using this pattern: bookname_name-YYYY-MM-DDTHH:MI:SS.SSSZ
573
+ If the -usefullname parameter is used, bookmark name will be created without adding a snapshot time
542
574
543
575
=item B<-last > - create bookmark for a last snapshot of source after template was created
576
+ Bookmark name will be generated using this pattern: bookname_name-YYYY-MM-DDTHH:MI:SS.SSSZ
577
+ If the -usefullname parameter is used, bookmark name will be created without adding a snapshot time
578
+
579
+ =item B<-both > - create bookmark for a first and last snapshot of source after template was created
580
+ Bookmark names will be generated using this pattern: bookname_name-YYYY-MM-DDTHH:MI:SS.SSSZ
544
581
545
582
=back
546
583
584
+ Bookmark will be created with a name following this pattern:
585
+
586
+
547
587
=item B<-expireat timestamp >
548
588
Set a bookmark expiration time using format "YYYY-MM-DD"
549
589
or "YYYY-MM-DD HH24:MI:SS"
0 commit comments