-
Notifications
You must be signed in to change notification settings - Fork 8.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[SR] Prevent snapshots in Cloud-managed repository from being deleted…
… in the UI (#40104) * Extract `getManagedRepositoryName` to `lib/` * Prevent managed repository snapshots from being deleted in table UI * Prevent delete of managed repository snapshot from its details UI * Fix test * PR feedback and empty restore tab copy edits
- Loading branch information
Showing
13 changed files
with
156 additions
and
35 deletions.
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
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
32 changes: 32 additions & 0 deletions
32
x-pack/legacy/plugins/snapshot_restore/server/lib/get_managed_repository_name.ts
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 |
---|---|---|
@@ -0,0 +1,32 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License; | ||
* you may not use this file except in compliance with the Elastic License. | ||
*/ | ||
|
||
// Cloud has its own system for managing snapshots and we want to make | ||
// this clear when Snapshot and Restore is used in a Cloud deployment. | ||
// Retrieve the Cloud-managed repository name so that UI can switch | ||
// logical paths based on this information. | ||
export const getManagedRepositoryName = async ( | ||
callWithInternalUser: any | ||
): Promise<string | undefined> => { | ||
try { | ||
const { persistent, transient, defaults } = await callWithInternalUser('cluster.getSettings', { | ||
filterPath: '*.*managed_repository', | ||
flatSettings: true, | ||
includeDefaults: true, | ||
}); | ||
const { 'cluster.metadata.managed_repository': managedRepositoryName = undefined } = { | ||
...defaults, | ||
...persistent, | ||
...transient, | ||
}; | ||
return managedRepositoryName; | ||
} catch (e) { | ||
// Silently swallow error and return undefined for managed repository name | ||
// so that downstream calls are not blocked. In a healthy environment we do | ||
// not expect to reach here. | ||
return; | ||
} | ||
}; |
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