@@ -446,7 +446,9 @@ public LifecycleRule(LifecycleAction action, LifecycleCondition condition) {
446446 && condition .getDaysSinceNoncurrentTime () == null
447447 && condition .getNoncurrentTimeBefore () == null
448448 && condition .getCustomTimeBefore () == null
449- && condition .getDaysSinceCustomTime () == null ) {
449+ && condition .getDaysSinceCustomTime () == null
450+ && condition .getMatchesPrefix () == null
451+ && condition .getMatchesSuffix () == null ) {
450452 log .warning (
451453 "Creating a lifecycle condition with no supported conditions:\n "
452454 + this
@@ -527,7 +529,9 @@ Rule toPb() {
527529 lifecycleCondition .getCustomTimeBefore () == null
528530 ? null
529531 : new DateTime (true , lifecycleCondition .getCustomTimeBefore ().getValue (), 0 ))
530- .setDaysSinceCustomTime (lifecycleCondition .getDaysSinceCustomTime ());
532+ .setDaysSinceCustomTime (lifecycleCondition .getDaysSinceCustomTime ())
533+ .setMatchesPrefix (lifecycleCondition .getMatchesPrefix ())
534+ .setMatchesSuffix (lifecycleCondition .getMatchesSuffix ());
531535
532536 rule .setCondition (condition );
533537
@@ -604,6 +608,8 @@ public static class LifecycleCondition implements Serializable {
604608 private final DateTime noncurrentTimeBefore ;
605609 private final DateTime customTimeBefore ;
606610 private final Integer daysSinceCustomTime ;
611+ private final List <String > matchesPrefix ;
612+ private final List <String > matchesSuffix ;
607613
608614 private LifecycleCondition (Builder builder ) {
609615 this .age = builder .age ;
@@ -615,6 +621,8 @@ private LifecycleCondition(Builder builder) {
615621 this .noncurrentTimeBefore = builder .noncurrentTimeBefore ;
616622 this .customTimeBefore = builder .customTimeBefore ;
617623 this .daysSinceCustomTime = builder .daysSinceCustomTime ;
624+ this .matchesPrefix = builder .matchesPrefix ;
625+ this .matchesSuffix = builder .matchesSuffix ;
618626 }
619627
620628 public Builder toBuilder () {
@@ -627,7 +635,9 @@ public Builder toBuilder() {
627635 .setDaysSinceNoncurrentTime (this .daysSinceNoncurrentTime )
628636 .setNoncurrentTimeBefore (this .noncurrentTimeBefore )
629637 .setCustomTimeBefore (this .customTimeBefore )
630- .setDaysSinceCustomTime (this .daysSinceCustomTime );
638+ .setDaysSinceCustomTime (this .daysSinceCustomTime )
639+ .setMatchesPrefix (this .matchesPrefix )
640+ .setMatchesSuffix (this .matchesSuffix );
631641 }
632642
633643 public static Builder newBuilder () {
@@ -646,6 +656,8 @@ public String toString() {
646656 .add ("noncurrentTimeBefore" , noncurrentTimeBefore )
647657 .add ("customTimeBefore" , customTimeBefore )
648658 .add ("daysSinceCustomTime" , daysSinceCustomTime )
659+ .add ("matchesPrefix" , matchesPrefix )
660+ .add ("matchesSuffix" , matchesSuffix )
649661 .toString ();
650662 }
651663
@@ -691,6 +703,14 @@ public Integer getDaysSinceCustomTime() {
691703 return daysSinceCustomTime ;
692704 }
693705
706+ public List <String > getMatchesPrefix () {
707+ return matchesPrefix ;
708+ }
709+
710+ public List <String > getMatchesSuffix () {
711+ return matchesSuffix ;
712+ }
713+
694714 /** Builder for {@code LifecycleCondition}. */
695715 public static class Builder {
696716 private Integer age ;
@@ -702,6 +722,8 @@ public static class Builder {
702722 private DateTime noncurrentTimeBefore ;
703723 private DateTime customTimeBefore ;
704724 private Integer daysSinceCustomTime ;
725+ private List <String > matchesPrefix ;
726+ private List <String > matchesSuffix ;
705727
706728 private Builder () {}
707729
@@ -800,6 +822,24 @@ public Builder setDaysSinceCustomTime(Integer daysSinceCustomTime) {
800822 return this ;
801823 }
802824
825+ /**
826+ * Sets the list of prefixes. If any prefix matches the beginning of the object’s name, this
827+ * portion of the condition is satisfied for that object.
828+ */
829+ public Builder setMatchesPrefix (List <String > matchesPrefix ) {
830+ this .matchesPrefix = matchesPrefix != null ? ImmutableList .copyOf (matchesPrefix ) : null ;
831+ return this ;
832+ }
833+
834+ /**
835+ * Sets the list of suffixes. If any suffix matches the end of the object’s name, this
836+ * portion of the condition is satisfied for that object.
837+ */
838+ public Builder setMatchesSuffix (List <String > matchesSuffix ) {
839+ this .matchesSuffix = matchesSuffix != null ? ImmutableList .copyOf (matchesSuffix ) : null ;
840+ return this ;
841+ }
842+
803843 /** Builds a {@code LifecycleCondition} object. * */
804844 public LifecycleCondition build () {
805845 return new LifecycleCondition (this );
0 commit comments