Skip to main content

rusticity_term/
efs.rs

1pub mod access_point;
2pub mod actions;
3pub mod fs;
4pub mod mount_target;
5
6use std::collections::HashMap;
7
8pub fn init(i18n: &mut HashMap<String, String>) {
9    fs::init(i18n);
10    access_point::init(i18n);
11    mount_target::init(i18n);
12}
13
14pub fn console_url_file_systems(region: &str) -> String {
15    format!(
16        "https://{}.console.aws.amazon.com/efs/home?region={}#/file-systems",
17        region, region
18    )
19}
20
21pub fn console_url_file_system(region: &str, fs_id: &str) -> String {
22    format!(
23        "https://{}.console.aws.amazon.com/efs/home?region={}#/file-systems/{}",
24        region, region, fs_id
25    )
26}
27
28/// Console URL for a file system's detail page, deep-linked to a specific tab
29/// via the `tabId` query parameter (e.g. `tabId=fileSystemPolicy`). The General
30/// tab is the default view and carries no `tabId`.
31pub fn console_url_file_system_with_tab(
32    region: &str,
33    fs_id: &str,
34    tab: crate::ui::efs::DetailTab,
35) -> String {
36    use crate::ui::efs::DetailTab;
37    let tab_id = match tab {
38        DetailTab::MeteredSize => Some("meteredSize"),
39        DetailTab::Monitoring => Some("monitoring"),
40        DetailTab::Tags => Some("tags"),
41        DetailTab::FileSystemPolicy => Some("fileSystemPolicy"),
42        DetailTab::AccessPoints => Some("accessPoints"),
43        DetailTab::Network => Some("network"),
44        DetailTab::Replication => Some("replication"),
45    };
46    match tab_id {
47        Some(id) => format!(
48            "https://{}.console.aws.amazon.com/efs/home?region={}#/file-systems/{}?tabId={}",
49            region, region, fs_id, id
50        ),
51        None => console_url_file_system(region, fs_id),
52    }
53}