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
feat: Add support to disable logging from bucket #390
Changes from 4 commits
05b175f
72ef594
b3fc860
51c1c59
6e32236
b3aab02
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1310,7 +1310,7 @@ public Builder setIamConfiguration(IamConfiguration iamConfiguration) { | |
|
||
@Override | ||
public Builder setLogging(Logging logging) { | ||
this.logging = logging; | ||
this.logging = logging != null ? logging : null; | ||
return this; | ||
} | ||
|
||
|
@@ -1758,9 +1758,8 @@ public Rule apply(LifecycleRule lifecycleRule) { | |
if (iamConfiguration != null) { | ||
bucketPb.setIamConfiguration(iamConfiguration.toPb()); | ||
} | ||
if (logging != null) { | ||
bucketPb.setLogging(logging.toPb()); | ||
} | ||
Bucket.Logging loggingPb = logging != null ? logging.toPb() : Data.nullOf(Bucket.Logging.class); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Revert this change:
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think we also have to keep this check because when the object of There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. https://github.com/googleapis/java-storage/compare/qlogics?expand=1 Here's alternative solution. If you have concerns with it always open to discuss further. I'd like to address the issue with logging field is not selected in Fields. In which case it comes back null and this PR can corrupt the logging field when not selected. For example this will corrupt logging metadata:
Additionally could you remove setting IAM policy to allow writes from allAuthenticatedUsers. This is a security risk:
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @frankyn good catch and thanks for the detailed description. Both the comments have been addressed PTAL when get chance. |
||
bucketPb.setLogging(loggingPb); | ||
return bucketPb; | ||
} | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead do:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@frankyn thanks for the quick review I think we have to go with the
null
instead ofData.nullOf(com.google.cloud.storage.Bucket.Logging.class)
because if we do as you said then the following error occurs :unable to create new instance of class com.google.cloud.storage.BucketInfo$Logging because it has no accessible default constructor