Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MatchPrefix and MatchSuffix properties created from the UI, are not reflecting in the LifecycleCondition #1715

Closed
sundarrajanraman opened this issue Oct 18, 2022 · 2 comments · Fixed by #1717
Assignees
Labels
api: storage Issues related to the googleapis/java-storage API. priority: p2 Moderately-important priority. Fix may not be included in next release. type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns.

Comments

@sundarrajanraman
Copy link
Contributor

sundarrajanraman commented Oct 18, 2022

Thanks for stopping by to let us know something could be better!

Environment details

API: https://github.com/googleapis/java-storage
2. OS type and version: All OS
3. Java version: 8
4. version(s): 2.13.0

Steps to reproduce

  1. Create a Bucket in GCP Console
  2. For the Bucket just created Add a LifeCyle Rule with Condition: MatchPrefix and Match Suffix. Save the Configuration.
  3. Using Google Cloud API, create a Bucket Object for the bucket created from the step 1.
  4. sysout the LifeCyleCondition, correct behaviour is for the LifecycleRule. getCondition.getMatchesPrefix() & LifecycleRule. getCondition.getMatchesSuffix() return the values set using step 3.
  5. But the values are shown as null, even though the values are populated from the Console UI

Code example

for (BucketInfo.LifecycleRule rule : bucket.getLifecycleRules()) {
    System.out.println(" Action: " + rule.getAction());  //Returns the Action
    System.out.println("Match Prefix :: " + rule.getCondition().getMatchesPrefix());   //returns null
    System.out.println("Age :: " + rule.getCondition().getAge()); //return value 5
}

Stack trace

Not applicable

External references such as API reference guides

Not applicable

Any additional information below

The reason for this behaviour:
While the API is able to bring the MatchPrefix and Matchsuffix, the same is not used in the Builder.
LifecycleRule fromPb(Rule rule) method, while building the LifeCyleRuleCondition, doesnt populate the matchPrefix and matchsuffix values.

Following these steps guarantees the quickest resolution possible.

Thanks!

@product-auto-label product-auto-label bot added the api: storage Issues related to the googleapis/java-storage API. label Oct 18, 2022
@BenWhitehead BenWhitehead self-assigned this Oct 18, 2022
@BenWhitehead BenWhitehead added priority: p2 Moderately-important priority. Fix may not be included in next release. type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns. labels Oct 18, 2022
@BenWhitehead
Copy link
Collaborator

Thanks for reporting @sundarrajanraman, I'll investigate and see what can be done to fix this.

@sundarrajanraman
Copy link
Contributor Author

@BenWhitehead Created the PR to fix the issue. Please review. Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api: storage Issues related to the googleapis/java-storage API. priority: p2 Moderately-important priority. Fix may not be included in next release. type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns.
Projects
None yet
2 participants