-
Notifications
You must be signed in to change notification settings - Fork 8.3k
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
[Saved Objects] Adds config flag to toggle hiddenFromHttpApis SO types conditionally #151512
Merged
TinaHeiligers
merged 7 commits into
elastic:main
from
TinaHeiligers:kbn-150471-toggle-hiddenFromHttpApis-accessibility
Feb 22, 2023
Merged
Changes from 1 commit
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
76a77b4
Adds config flag to toggle hiddenFromHttpApis SO types conditionally
TinaHeiligers 99b4dcf
cleanup draft
TinaHeiligers 497ec8a
Merge branch 'main' into kbn-150471-toggle-hiddenFromHttpApis-accessi…
kibanamachine 879d33b
marks allowHttpApiAccess as internal
TinaHeiligers b61d065
Merge branch 'main' into kbn-150471-toggle-hiddenFromHttpApis-accessi…
kibanamachine 96bb95a
default allowHttpApiAccess conditionally depending on if Kibana's run…
TinaHeiligers 75e11c7
Consistently name integration tests
TinaHeiligers File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -42,6 +42,8 @@ export const savedObjectsMigrationConfig: ServiceConfigDescriptor<SavedObjectsMi | |
const soSchema = schema.object({ | ||
maxImportPayloadBytes: schema.byteSize({ defaultValue: 26_214_400 }), | ||
maxImportExportSize: schema.number({ defaultValue: 10_000 }), | ||
// Conditionally set within config, dependening on the env. In prod: allow all access(default), in dev: false | ||
allowHttpApiAccess: schema.boolean({ defaultValue: true }), | ||
}); | ||
|
||
export type SavedObjectsConfigType = TypeOf<typeof soSchema>; | ||
|
@@ -50,19 +52,20 @@ export const savedObjectsConfig: ServiceConfigDescriptor<SavedObjectsConfigType> | |
path: 'savedObjects', | ||
schema: soSchema, | ||
}; | ||
|
||
export class SavedObjectConfig { | ||
public maxImportPayloadBytes: number; | ||
public maxImportExportSize: number; | ||
|
||
public allowHttpApiAccess: boolean; // depend on env: see https://github.com/elastic/dev/issues/2200 | ||
public migration: SavedObjectsMigrationConfigType; | ||
|
||
constructor( | ||
rawConfig: SavedObjectsConfigType, | ||
rawMigrationConfig: SavedObjectsMigrationConfigType | ||
rawMigrationConfig: SavedObjectsMigrationConfigType, | ||
allowHttpApiAccess: boolean | ||
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. Naming is hard and |
||
) { | ||
this.maxImportPayloadBytes = rawConfig.maxImportPayloadBytes.getValueInBytes(); | ||
this.maxImportExportSize = rawConfig.maxImportExportSize; | ||
this.migration = rawMigrationConfig; | ||
this.allowHttpApiAccess = rawConfig.allowHttpApiAccess || allowHttpApiAccess; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
I've gone with defaulting to the "old" behavior where all visible types (those not hidden) use the HTTP APIs. We also need to allow access for self-managed & current cloud offering & cloud tests
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.
Is there a specific reason to depend on the environment and not distribution?
Instead of doing the override logic between the config and the env inside the code and having to inject the env into the classes, why not just do it from the config defaults here (like the example below). This makes the logic a lot more resilient and easier to understand. wdyt?
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.
I didn't think to use the distro rather, great idea thanks!
I'll change it and see how it improves the logic.
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.
@Bamieh I've made the change you requested in
96bb95a
(#151512).Could you take another look, please?