From 986316dd56b606d5be0b89fb730ec334f0c524cf Mon Sep 17 00:00:00 2001 From: suikammd Date: Thu, 17 Aug 2023 19:14:58 +0800 Subject: [PATCH] feat: separate aws support in es & prometheus sink --- Cargo.lock | 426 +++++++++++++++------------ Cargo.toml | 6 +- src/sinks/elasticsearch/common.rs | 42 ++- src/sinks/elasticsearch/config.rs | 5 +- src/sinks/elasticsearch/mod.rs | 3 + src/sinks/elasticsearch/service.rs | 13 +- src/sinks/prometheus/mod.rs | 2 + src/sinks/prometheus/remote_write.rs | 12 +- 8 files changed, 300 insertions(+), 209 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index b0a3a16bafa264..67a0dd5e553626 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -217,9 +217,9 @@ dependencies = [ [[package]] name = "anstyle-wincon" -version = "1.0.1" +version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "180abfa45703aebe0093f79badacc01b8fd4ea2e35118747e5811127f926e188" +checksum = "c677ab05e09154296dd37acecd46420c17b9713e8366facafa8fc0885167cf4c" dependencies = [ "anstyle 1.0.0", "windows-sys 0.48.0", @@ -244,7 +244,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9c0fdddc3fdac97394ffcc5c89c634faa9c1c166ced54189af34e407c97b6ee7" dependencies = [ "byteorder", - "digest", + "digest 0.10.7", "lazy_static", "libflate", "log", @@ -304,7 +304,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9c6368f9ae5c6ec403ca910327ae0c9437b0a85255b6950c90d497e6177f6e5e" dependencies = [ "proc-macro-hack", - "quote 1.0.33", + "quote 1.0.32", "syn 1.0.109", ] @@ -534,7 +534,7 @@ dependencies = [ "darling 0.14.2", "proc-macro-crate 1.2.1", "proc-macro2 1.0.66", - "quote 1.0.33", + "quote 1.0.32", "syn 1.0.109", "thiserror", ] @@ -550,9 +550,9 @@ dependencies = [ "darling 0.20.3", "proc-macro-crate 1.2.1", "proc-macro2 1.0.66", - "quote 1.0.33", + "quote 1.0.32", "strum", - "syn 2.0.29", + "syn 2.0.28", "thiserror", ] @@ -729,8 +729,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0e97ce7de6cf12de5d7226c73f5ba9811622f4db3a5b91b55c53e987e5f91cba" dependencies = [ "proc-macro2 1.0.66", - "quote 1.0.33", - "syn 2.0.29", + "quote 1.0.32", + "syn 2.0.28", ] [[package]] @@ -751,8 +751,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "16e62a023e7c117e27523144c5d2459f4397fcc3cab0085af8e2224f643a0193" dependencies = [ "proc-macro2 1.0.66", - "quote 1.0.33", - "syn 2.0.29", + "quote 1.0.32", + "syn 2.0.28", ] [[package]] @@ -768,8 +768,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bc00ceb34980c03614e35a3a4e218276a0a824e911d07651cd0d858a51e8c0f0" dependencies = [ "proc-macro2 1.0.66", - "quote 1.0.33", - "syn 2.0.29", + "quote 1.0.32", + "syn 2.0.28", ] [[package]] @@ -1143,7 +1143,7 @@ dependencies = [ "once_cell", "percent-encoding", "regex", - "sha2", + "sha2 0.10.7", "time", "tracing 0.1.37", ] @@ -1175,7 +1175,7 @@ dependencies = [ "md-5", "pin-project-lite", "sha1", - "sha2", + "sha2 0.10.7", "tracing 0.1.37", ] @@ -1426,7 +1426,7 @@ dependencies = [ "serde", "serde_derive", "serde_json", - "sha2", + "sha2 0.10.7", "time", "url", "uuid", @@ -1562,8 +1562,8 @@ version = "2.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "49fb8528abca6895a5ada33d62aedd538a5c33e77068256483b44a3230270163" dependencies = [ - "quote 1.0.33", - "syn 2.0.29", + "quote 1.0.32", + "syn 2.0.28", ] [[package]] @@ -1578,6 +1578,15 @@ dependencies = [ "wyz", ] +[[package]] +name = "block-buffer" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4152116fd6e9dadb291ae18fc1ec3575ed6d84c29642d97890f4b4a3417297e4" +dependencies = [ + "generic-array", +] + [[package]] name = "block-buffer" version = "0.10.3" @@ -1697,7 +1706,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "61820b4c5693eafb998b1e67485423c923db4a75f72585c247bdee32bad81e7b" dependencies = [ "proc-macro2 1.0.66", - "quote 1.0.33", + "quote 1.0.32", "syn 1.0.109", ] @@ -1708,7 +1717,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c76cdbfa13def20d1f8af3ae7b3c6771f06352a74221d8851262ac384c122b8e" dependencies = [ "proc-macro2 1.0.66", - "quote 1.0.33", + "quote 1.0.32", "syn 1.0.109", ] @@ -1778,7 +1787,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "13e576ebe98e605500b3c8041bb888e966653577172df6dd97398714eb30b9bf" dependencies = [ "proc-macro2 1.0.66", - "quote 1.0.33", + "quote 1.0.32", "syn 1.0.109", ] @@ -1861,7 +1870,7 @@ dependencies = [ "cached_proc_macro_types", "darling 0.14.2", "proc-macro2 1.0.66", - "quote 1.0.33", + "quote 1.0.32", "syn 1.0.109", ] @@ -2111,8 +2120,8 @@ checksum = "54a9bb5758fc5dfe728d1019941681eccaf0cf8a4189b692a0ee2f2ecf90a050" dependencies = [ "heck 0.4.1", "proc-macro2 1.0.66", - "quote 1.0.33", - "syn 2.0.29", + "quote 1.0.32", + "syn 2.0.28", ] [[package]] @@ -2313,9 +2322,9 @@ dependencies = [ [[package]] name = "const-oid" -version = "0.9.5" +version = "0.6.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "28c122c3980598d243d63d9a704629a2d748d101f278052ff068be5a4423ab6f" +checksum = "9d6f2aa4d0537bcc1c74df8755072bd31c1ef1a3a1b85a68e8404a8c353b7b8b" [[package]] name = "convert_case" @@ -2356,9 +2365,9 @@ checksum = "5827cebf4670468b8772dd191856768aedcb1b0278a04f989f7766351917b9dc" [[package]] name = "cpufeatures" -version = "0.2.9" +version = "0.2.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a17b76ff3a4162b0b27f354a0c87015ddad39d35f9c0c36607a3bdd175dde1f1" +checksum = "28d997bd5e24a5928dd43e46dc529867e207907fe0b239c3477d924f7f2ca320" dependencies = [ "libc", ] @@ -2572,7 +2581,7 @@ version = "0.1.26" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6d2301688392eb071b0bf1a37be05c469d3cc4dbbd95df672fe28ab021e6a096" dependencies = [ - "quote 1.0.33", + "quote 1.0.32", "syn 1.0.109", ] @@ -2593,29 +2602,15 @@ checksum = "b365fabc795046672053e29c954733ec3b05e4be654ab130fe8f1f94d7051f35" [[package]] name = "curve25519-dalek" -version = "4.0.0" +version = "3.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f711ade317dd348950a9910f81c5947e3d8907ebd2b83f76203ff1807e6a2bc2" +checksum = "0b9fdf9972b2bd6af2d913799d9ebc165ea4d2e65878e329d9c6b372c4491b61" dependencies = [ - "cfg-if", - "cpufeatures", - "curve25519-dalek-derive", - "digest", - "fiat-crypto", - "platforms 3.0.2", - "rustc_version 0.4.0", + "byteorder", + "digest 0.9.0", + "rand_core 0.5.1", "subtle", -] - -[[package]] -name = "curve25519-dalek-derive" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "83fdaf97f4804dcebfa5862639bc9ce4121e82140bec2a987ac5140294865b5b" -dependencies = [ - "proc-macro2 1.0.66", - "quote 1.0.33", - "syn 2.0.29", + "zeroize", ] [[package]] @@ -2640,7 +2635,7 @@ dependencies = [ "codespan-reporting", "once_cell", "proc-macro2 1.0.66", - "quote 1.0.33", + "quote 1.0.32", "scratch", "syn 1.0.109", ] @@ -2658,7 +2653,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a08a6e2fcc370a089ad3b4aaf54db3b1b4cee38ddabce5896b33eb693275f470" dependencies = [ "proc-macro2 1.0.66", - "quote 1.0.33", + "quote 1.0.32", "syn 1.0.109", ] @@ -2701,7 +2696,7 @@ dependencies = [ "fnv", "ident_case", "proc-macro2 1.0.66", - "quote 1.0.33", + "quote 1.0.32", "strsim 0.10.0", "syn 1.0.109", ] @@ -2715,7 +2710,7 @@ dependencies = [ "fnv", "ident_case", "proc-macro2 1.0.66", - "quote 1.0.33", + "quote 1.0.32", "strsim 0.10.0", "syn 1.0.109", ] @@ -2729,9 +2724,9 @@ dependencies = [ "fnv", "ident_case", "proc-macro2 1.0.66", - "quote 1.0.33", + "quote 1.0.32", "strsim 0.10.0", - "syn 2.0.29", + "syn 2.0.28", ] [[package]] @@ -2741,7 +2736,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9c972679f83bdf9c42bd905396b6c3588a843a17f0f16dfcfa3e2c5d57441835" dependencies = [ "darling_core 0.13.4", - "quote 1.0.33", + "quote 1.0.32", "syn 1.0.109", ] @@ -2752,7 +2747,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7618812407e9402654622dd402b0a89dff9ba93badd6540781526117b92aab7e" dependencies = [ "darling_core 0.14.2", - "quote 1.0.33", + "quote 1.0.32", "syn 1.0.109", ] @@ -2763,8 +2758,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "836a9bbc7ad63342d6d6e7b815ccab164bc77a2d95d84bc3117a8c0d5c98e2d5" dependencies = [ "darling_core 0.20.3", - "quote 1.0.33", - "syn 2.0.29", + "quote 1.0.32", + "syn 2.0.28", ] [[package]] @@ -2825,13 +2820,20 @@ checksum = "f578e8e2c440e7297e008bb5486a3a8a194775224bbc23729b0dbdfaeebf162e" [[package]] name = "der" -version = "0.7.8" +version = "0.4.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fffa369a668c8af7dbf8b5e56c9f744fbd399949ed171606040001947de40b1c" +checksum = "79b71cca7d95d7681a4b3b9cdf63c8dbc3730d0584c2c74e31416d64a90493f4" dependencies = [ "const-oid", - "pem-rfc7468", - "zeroize", +] + +[[package]] +name = "deranged" +version = "0.3.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7684a49fb1af197853ef7b2ee694bc1f5b4179556f1e5710e1760c5db6f5e929" +dependencies = [ + "serde", ] [[package]] @@ -2841,7 +2843,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fcc3dd5e9e9c0b295d6e1e4d811fb6f157d5ffd784b8d202fc62eac8035a770b" dependencies = [ "proc-macro2 1.0.66", - "quote 1.0.33", + "quote 1.0.32", "syn 1.0.109", ] @@ -2852,8 +2854,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "53e0efad4403bfc52dc201159c4b842a246a14b98c64b55dfd0f2d89729dfeb8" dependencies = [ "proc-macro2 1.0.66", - "quote 1.0.33", - "syn 2.0.29", + "quote 1.0.32", + "syn 2.0.28", ] [[package]] @@ -2864,7 +2866,7 @@ checksum = "4fb810d30a7c1953f91334de7244731fc3f3c10d7fe163338a35b9f640960321" dependencies = [ "convert_case 0.4.0", "proc-macro2 1.0.66", - "quote 1.0.33", + "quote 1.0.32", "rustc_version 0.4.0", "syn 1.0.109", ] @@ -2881,13 +2883,22 @@ version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6184e33543162437515c2e2b48714794e37845ec9851711914eec9d308f6ebe8" +[[package]] +name = "digest" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d3dd60d1080a57a05ab032377049e0591415d2b31afd7028356dbf3cc6dcb066" +dependencies = [ + "generic-array", +] + [[package]] name = "digest" version = "0.10.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292" dependencies = [ - "block-buffer", + "block-buffer 0.10.3", "crypto-common", "subtle", ] @@ -3031,23 +3042,23 @@ checksum = "bbfc4744c1b8f2a09adc0e55242f60b1af195d88596bd8700be74418c056c555" [[package]] name = "ed25519" -version = "2.2.2" +version = "1.5.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "60f6d271ca33075c88028be6f04d502853d63a5ece419d269c15315d4fc1cf1d" +checksum = "91cff35c70bba8a626e3185d8cd48cc11b5437e1a5bcd15b9b5fa3c64b6dfee7" dependencies = [ "signature", ] [[package]] name = "ed25519-dalek" -version = "2.0.0" +version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7277392b266383ef8396db7fdeb1e77b6c52fed775f5df15bb24f35b72156980" +checksum = "c762bae6dcaf24c4c84667b8579785430908723d5c889f469d76a41d59cc7a9d" dependencies = [ "curve25519-dalek", "ed25519", - "sha2", - "signature", + "sha2 0.9.9", + "zeroize", ] [[package]] @@ -3111,7 +3122,7 @@ checksum = "21cdad81446a7f7dc43f6a77409efeb9733d2fa65553efef6018ef257c959b73" dependencies = [ "heck 0.4.1", "proc-macro2 1.0.66", - "quote 1.0.33", + "quote 1.0.32", "syn 1.0.109", ] @@ -3123,7 +3134,7 @@ checksum = "c9720bba047d567ffc8a3cba48bf19126600e249ab7f128e9233e6376976a116" dependencies = [ "heck 0.4.1", "proc-macro2 1.0.66", - "quote 1.0.33", + "quote 1.0.32", "syn 1.0.109", ] @@ -3135,8 +3146,8 @@ checksum = "8f33313078bb8d4d05a2733a94ac4c2d8a0df9a2b84424ebf4f33bfc224a890e" dependencies = [ "once_cell", "proc-macro2 1.0.66", - "quote 1.0.33", - "syn 2.0.29", + "quote 1.0.32", + "syn 2.0.28", ] [[package]] @@ -3155,8 +3166,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5e9a1f9f7d83e59740248a6e14ecf93929ade55027844dfcea78beafccc15745" dependencies = [ "proc-macro2 1.0.66", - "quote 1.0.33", - "syn 2.0.29", + "quote 1.0.32", + "syn 2.0.28", ] [[package]] @@ -3283,7 +3294,7 @@ checksum = "f47da3a72ec598d9c8937a7ebca8962a5c7a1f28444e38c2b33c771ba3f55f05" dependencies = [ "proc-macro-error", "proc-macro2 1.0.66", - "quote 1.0.33", + "quote 1.0.32", "syn 1.0.109", ] @@ -3322,12 +3333,6 @@ dependencies = [ "instant", ] -[[package]] -name = "fiat-crypto" -version = "0.1.20" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e825f6987101665dea6ec934c09ec6d721de7bc1bf92248e1d5810c8cd636b77" - [[package]] name = "file-source" version = "0.1.0" @@ -3385,7 +3390,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e4c81935e123ab0741c4c4f0d9b8377e5fb21d3de7e062fa4b1263b1fbcba1ea" dependencies = [ "proc-macro2 1.0.66", - "quote 1.0.33", + "quote 1.0.32", "syn 1.0.109", ] @@ -3566,8 +3571,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "89ca545a94061b6365f2c7355b4b32bd20df3ff95f02da9329b34ccc3bd6ee72" dependencies = [ "proc-macro2 1.0.66", - "quote 1.0.33", - "syn 2.0.29", + "quote 1.0.32", + "syn 2.0.28", ] [[package]] @@ -3745,7 +3750,7 @@ dependencies = [ "heck 0.4.1", "lazy_static", "proc-macro2 1.0.66", - "quote 1.0.33", + "quote 1.0.32", "serde", "serde_json", "syn 1.0.109", @@ -3996,7 +4001,7 @@ dependencies = [ "log", "mach", "ntapi", - "platforms 1.1.0", + "platforms", "winapi", ] @@ -4068,7 +4073,7 @@ version = "0.12.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6c49c37c09c17a53d937dfbb742eb3a961d65a994e6bcdcf37e7399d0cc8ab5e" dependencies = [ - "digest", + "digest 0.10.7", ] [[package]] @@ -5105,7 +5110,7 @@ version = "0.10.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6365506850d44bff6e2fbcb5176cf63650e48bd45ef2fe2665ae1570e0f4b9ca" dependencies = [ - "digest", + "digest 0.10.7", ] [[package]] @@ -5159,8 +5164,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ddece26afd34c31585c74a4db0630c376df271c285d682d1e55012197830b6df" dependencies = [ "proc-macro2 1.0.66", - "quote 1.0.33", - "syn 2.0.29", + "quote 1.0.32", + "syn 2.0.28", ] [[package]] @@ -5303,7 +5308,7 @@ dependencies = [ "serde_bytes", "serde_with 1.14.0", "sha-1", - "sha2", + "sha2 0.10.7", "socket2 0.4.9", "stringprep", "strsim 0.10.0", @@ -5437,9 +5442,9 @@ dependencies = [ [[package]] name = "nkeys" -version = "0.3.2" +version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aad178aad32087b19042ee36dfd450b73f5f934fbfb058b59b198684dfec4c47" +checksum = "3e9261eb915c785ea65708bc45ef43507ea46914e1a73f1412d1a38aba967c8e" dependencies = [ "byteorder", "data-encoding", @@ -5635,7 +5640,7 @@ checksum = "dcbff9bc912032c62bf65ef1d5aea88983b420f4f839db1e9b0c281a25c9c799" dependencies = [ "proc-macro-crate 1.2.1", "proc-macro2 1.0.66", - "quote 1.0.33", + "quote 1.0.32", "syn 1.0.109", ] @@ -5647,8 +5652,8 @@ checksum = "56ea360eafe1022f7cc56cd7b869ed57330fb2453d0c7831d99b74c65d2f5597" dependencies = [ "proc-macro-crate 1.2.1", "proc-macro2 1.0.66", - "quote 1.0.33", - "syn 2.0.29", + "quote 1.0.32", + "syn 2.0.28", ] [[package]] @@ -5681,7 +5686,7 @@ dependencies = [ "serde", "serde_json", "serde_path_to_error", - "sha2", + "sha2 0.10.7", "thiserror", "url", ] @@ -5830,7 +5835,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b501e44f11665960c7e7fcf062c7d96a14ade4aa98116c004b2e37b5be7d736c" dependencies = [ "proc-macro2 1.0.66", - "quote 1.0.33", + "quote 1.0.32", "syn 1.0.109", ] @@ -6010,7 +6015,7 @@ version = "0.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "83a0692ec44e4cf1ef28ca317f14f8f07da2d95ec3fa01f86e4467b725e60917" dependencies = [ - "digest", + "digest 0.10.7", ] [[package]] @@ -6030,9 +6035,9 @@ dependencies = [ [[package]] name = "pem-rfc7468" -version = "0.7.0" +version = "0.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "88b39c9bfcfc231068454382784bb460aae594343fb030d46e9f50a645418412" +checksum = "8f22eb0e3c593294a99e9ff4b24cf6b752d43f193aa4415fe5077c159996d497" dependencies = [ "base64ct", ] @@ -6072,8 +6077,8 @@ dependencies = [ "pest", "pest_meta", "proc-macro2 1.0.66", - "quote 1.0.33", - "syn 2.0.29", + "quote 1.0.32", + "syn 2.0.28", ] [[package]] @@ -6084,7 +6089,7 @@ checksum = "56af0a30af74d0445c0bf6d9d051c979b516a1a5af790d251daee76005420a48" dependencies = [ "once_cell", "pest", - "sha2", + "sha2 0.10.7", ] [[package]] @@ -6160,8 +6165,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4359fd9c9171ec6e8c62926d6faaf553a8dc3f64e1507e76da7911b4f6a04405" dependencies = [ "proc-macro2 1.0.66", - "quote 1.0.33", - "syn 2.0.29", + "quote 1.0.32", + "syn 2.0.28", ] [[package]] @@ -6190,12 +6195,14 @@ dependencies = [ [[package]] name = "pkcs8" -version = "0.10.2" +version = "0.7.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f950b2377845cebe5cf8b5165cb3cc1a5e0fa5cfa3e1f7f55707d8fd82e0a7b7" +checksum = "ee3ef9b64d26bad0536099c816c6734379e45bbd5f14798def6809e5cc350447" dependencies = [ "der", + "pem-rfc7468", "spki", + "zeroize", ] [[package]] @@ -6210,12 +6217,6 @@ version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "989d43012e2ca1c4a02507c67282691a0a3207f9dc67cec596b43fe925b3d325" -[[package]] -name = "platforms" -version = "3.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e3d7ddaed09e0eb771a79ab0fd64609ba0afb0a8366421957936ad14cbd13630" - [[package]] name = "plotters" version = "0.3.4" @@ -6309,7 +6310,7 @@ dependencies = [ "md-5", "memchr", "rand 0.8.5", - "sha2", + "sha2 0.10.7", "stringprep", ] @@ -6441,7 +6442,7 @@ checksum = "da25490ff9892aab3fcf7c36f08cfb902dd3e71ca0f9f9517bea02a73a5ce38c" dependencies = [ "proc-macro-error-attr", "proc-macro2 1.0.66", - "quote 1.0.33", + "quote 1.0.32", "syn 1.0.109", "version_check", ] @@ -6453,7 +6454,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a1be40180e52ecc98ad80b184934baf3d0d29f979574e439af5a55274b35f869" dependencies = [ "proc-macro2 1.0.66", - "quote 1.0.33", + "quote 1.0.32", "version_check", ] @@ -6562,7 +6563,7 @@ dependencies = [ "anyhow", "itertools 0.10.5", "proc-macro2 1.0.66", - "quote 1.0.33", + "quote 1.0.32", "syn 1.0.109", ] @@ -6605,7 +6606,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "16b845dbfca988fa33db069c0e230574d15a3088f147a87b64c7589eb662c9ac" dependencies = [ "proc-macro2 1.0.66", - "quote 1.0.33", + "quote 1.0.32", "syn 1.0.109", ] @@ -6714,7 +6715,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b22a693222d716a9587786f37ac3f6b4faedb5b80c23914e7303ff5a1d8016e9" dependencies = [ "proc-macro2 1.0.66", - "quote 1.0.33", + "quote 1.0.32", "syn 1.0.109", ] @@ -6729,9 +6730,9 @@ dependencies = [ [[package]] name = "quote" -version = "1.0.33" +version = "1.0.32" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5267fca4496028628a95160fc423a33e8b2e6af8a5302579e322e4b520293cae" +checksum = "50f3b39ccfb720540debaa0164757101c08ecb8d326b15358ce76a62c7e85965" dependencies = [ "proc-macro2 1.0.66", ] @@ -7157,7 +7158,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ff26ed6c7c4dfc2aa9480b86a60e3c7233543a270a680e10758a507c5a4ce476" dependencies = [ "proc-macro2 1.0.66", - "quote 1.0.33", + "quote 1.0.32", "syn 1.0.109", ] @@ -7363,9 +7364,9 @@ dependencies = [ [[package]] name = "rustls-webpki" -version = "0.101.2" +version = "0.101.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "513722fd73ad80a71f72b61009ea1b584bcfa1483ca93949c8f290298837fa59" +checksum = "261e9e0888cba427c3316e6322805653c9425240b6fd96cee7cb671ab70ab8d0" dependencies = [ "ring", "untrusted", @@ -7610,8 +7611,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "aafe972d60b0b9bee71a91b92fee2d4fb3c9d7e8f6b179aa99f27203d99a4816" dependencies = [ "proc-macro2 1.0.66", - "quote 1.0.33", - "syn 2.0.29", + "quote 1.0.32", + "syn 2.0.28", ] [[package]] @@ -7621,8 +7622,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e578a843d40b4189a4d66bba51d7684f57da5bd7c304c64e14bd63efbef49509" dependencies = [ "proc-macro2 1.0.66", - "quote 1.0.33", - "syn 2.0.29", + "quote 1.0.32", + "syn 2.0.28", ] [[package]] @@ -7673,8 +7674,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8725e1dfadb3a50f7e5ce0b1a540466f6ed3fe7a0fca2ac2b8b831d31316bd00" dependencies = [ "proc-macro2 1.0.66", - "quote 1.0.33", - "syn 2.0.29", + "quote 1.0.32", + "syn 2.0.28", ] [[package]] @@ -7748,7 +7749,7 @@ checksum = "e182d6ec6f05393cc0e5ed1bf81ad6db3a8feedf8ee515ecdd369809bcce8082" dependencies = [ "darling 0.13.4", "proc-macro2 1.0.66", - "quote 1.0.33", + "quote 1.0.32", "syn 1.0.109", ] @@ -7760,8 +7761,8 @@ checksum = "9197f1ad0e3c173a0222d3c4404fb04c3afe87e962bcb327af73e8301fa203c7" dependencies = [ "darling 0.20.3", "proc-macro2 1.0.66", - "quote 1.0.33", - "syn 2.0.29", + "quote 1.0.32", + "syn 2.0.28", ] [[package]] @@ -7797,7 +7798,7 @@ checksum = "f5058ada175748e33390e40e872bd0fe59a19f265d0158daa551c5a88a76009c" dependencies = [ "cfg-if", "cpufeatures", - "digest", + "digest 0.10.7", ] [[package]] @@ -7808,7 +7809,20 @@ checksum = "f04293dc80c3993519f2d7f6f511707ee7094fe0c6d3406feb330cdb3540eba3" dependencies = [ "cfg-if", "cpufeatures", - "digest", + "digest 0.10.7", +] + +[[package]] +name = "sha2" +version = "0.9.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4d58a1e1bf39749807d89cf2d98ac2dfa0ff1cb3faa38fbb64dd88ac8013d800" +dependencies = [ + "block-buffer 0.9.0", + "cfg-if", + "cpufeatures", + "digest 0.9.0", + "opaque-debug", ] [[package]] @@ -7819,7 +7833,7 @@ checksum = "479fb9d862239e610720565ca91403019f2f00410f1864c5aa7479b950a76ed8" dependencies = [ "cfg-if", "cpufeatures", - "digest", + "digest 0.10.7", ] [[package]] @@ -7828,7 +7842,7 @@ version = "0.10.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bdf0c33fae925bdc080598b84bc15c55e7b9a4a43b3c704da051f977469691c9" dependencies = [ - "digest", + "digest 0.10.7", "keccak", ] @@ -7883,9 +7897,9 @@ dependencies = [ [[package]] name = "signatory" -version = "0.27.1" +version = "0.23.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c1e303f8205714074f6068773f0e29527e0453937fe837c9717d066635b65f31" +checksum = "5dfecc059e81632eef1dd9b79e22fc28b8fe69b30d3357512a77a0ad8ee3c782" dependencies = [ "pkcs8", "rand_core 0.6.4", @@ -7895,12 +7909,9 @@ dependencies = [ [[package]] name = "signature" -version = "2.0.0" +version = "1.6.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8fe458c98333f9c8152221191a77e2a44e8325d0193484af2e9421a53019e57d" -dependencies = [ - "digest", -] +checksum = "74233d3b3b2f6d4b006dc19dee745e73e2a6bfb6f93607cd3b02bd5b00797d7c" [[package]] name = "simd-abstraction" @@ -8021,7 +8032,7 @@ checksum = "990079665f075b699031e9c08fd3ab99be5029b96f3b78dc0709e8f77e4efebf" dependencies = [ "heck 0.4.1", "proc-macro2 1.0.66", - "quote 1.0.33", + "quote 1.0.32", "syn 1.0.109", ] @@ -8068,11 +8079,10 @@ dependencies = [ [[package]] name = "spki" -version = "0.7.2" +version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9d1e996ef02c474957d681f1b05213dfb0abab947b446a62d37770b23500184a" +checksum = "5c01a0c15da1b0b0e1494112e7af814a678fec9bd157881b49beac661e9b6f32" dependencies = [ - "base64ct", "der", ] @@ -8172,7 +8182,7 @@ dependencies = [ "heck 0.3.3", "proc-macro-error", "proc-macro2 1.0.66", - "quote 1.0.33", + "quote 1.0.32", "syn 1.0.109", ] @@ -8193,9 +8203,9 @@ checksum = "6069ca09d878a33f883cc06aaa9718ede171841d3832450354410b718b097232" dependencies = [ "heck 0.4.1", "proc-macro2 1.0.66", - "quote 1.0.33", + "quote 1.0.32", "rustversion", - "syn 2.0.29", + "syn 2.0.28", ] [[package]] @@ -8232,18 +8242,18 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "72b64191b275b66ffe2469e8af2c1cfe3bafa67b529ead792a6d0160888b4237" dependencies = [ "proc-macro2 1.0.66", - "quote 1.0.33", + "quote 1.0.32", "unicode-ident", ] [[package]] name = "syn" -version = "2.0.29" +version = "2.0.28" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c324c494eba9d92503e6f1ef2e6df781e78f6a7705a0202d9801b198807d518a" +checksum = "04361975b3f5e348b2189d8dc55bc942f278b2d482a6a0365de5bdd62d351567" dependencies = [ "proc-macro2 1.0.66", - "quote 1.0.33", + "quote 1.0.32", "unicode-ident", ] @@ -8253,6 +8263,18 @@ version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "20518fe4a4c9acf048008599e464deb21beeae3d3578418951a189c235a7a9a8" +[[package]] +name = "synstructure" +version = "0.12.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f36bdaa60a83aca3921b5259d5400cbf5e90fc51931376a9bd4a0eb79aa7210f" +dependencies = [ + "proc-macro2 1.0.66", + "quote 1.0.32", + "syn 1.0.109", + "unicode-xid 0.2.4", +] + [[package]] name = "syslog" version = "6.1.0" @@ -8388,22 +8410,22 @@ dependencies = [ [[package]] name = "thiserror" -version = "1.0.47" +version = "1.0.44" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "97a802ec30afc17eee47b2855fc72e0c4cd62be9b4efe6591edde0ec5bd68d8f" +checksum = "611040a08a0439f8248d1990b111c95baa9c704c805fa1f62104b39655fd7f90" dependencies = [ "thiserror-impl", ] [[package]] name = "thiserror-impl" -version = "1.0.47" +version = "1.0.44" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6bb623b56e39ab7dcd4b1b98bb6c8f8d907ed255b18de254088016b27a8ee19b" +checksum = "090198534930841fab3a5d1bb637cde49e339654e606195f8d9c76eeb081dc96" dependencies = [ "proc-macro2 1.0.66", - "quote 1.0.33", - "syn 2.0.29", + "quote 1.0.32", + "syn 2.0.28", ] [[package]] @@ -8438,10 +8460,11 @@ dependencies = [ [[package]] name = "time" -version = "0.3.23" +version = "0.3.25" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "59e399c068f43a5d116fedaf73b203fa4f9c519f17e2b34f63221d3792f81446" +checksum = "b0fdd63d58b18d663fbdf70e049f00a22c8e42be082203be7f26589213cd75ea" dependencies = [ + "deranged", "itoa", "libc", "num_threads", @@ -8458,9 +8481,9 @@ checksum = "7300fbefb4dadc1af235a9cef3737cea692a9d97e1b9cbcd4ebdae6f8868e6fb" [[package]] name = "time-macros" -version = "0.2.10" +version = "0.2.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "96ba15a897f3c86766b757e5ac7221554c6750054d74d5b28844fce5fb36a6c4" +checksum = "eb71511c991639bb078fd5bf97757e03914361c48100d52878b8e52b46fb92cd" dependencies = [ "time-core", ] @@ -8547,8 +8570,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "630bdcf245f78637c13ec01ffae6187cca34625e8c63150d424b59e55af2675e" dependencies = [ "proc-macro2 1.0.66", - "quote 1.0.33", - "syn 2.0.29", + "quote 1.0.32", + "syn 2.0.28", ] [[package]] @@ -8779,7 +8802,7 @@ dependencies = [ "prettyplease", "proc-macro2 1.0.66", "prost-build", - "quote 1.0.33", + "quote 1.0.32", "syn 1.0.109", ] @@ -8883,7 +8906,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4017f8f45139870ca7e672686113917c71c7a6e02d4924eda67186083c03081a" dependencies = [ "proc-macro2 1.0.66", - "quote 1.0.33", + "quote 1.0.32", "syn 1.0.109", ] @@ -9141,7 +9164,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "89851716b67b937e393b3daa8423e67ddfc4bbbf1654bcf05488e95e0828db0c" dependencies = [ "proc-macro2 1.0.66", - "quote 1.0.33", + "quote 1.0.32", "syn 1.0.109", ] @@ -9152,7 +9175,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "64cba322cb9b7bc6ca048de49e83918223f35e7a86311267013afff257004870" dependencies = [ "proc-macro2 1.0.66", - "quote 1.0.33", + "quote 1.0.32", "syn 1.0.109", ] @@ -9182,8 +9205,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bfc13d450dc4a695200da3074dacf43d449b968baee95e341920e47f61a3b40f" dependencies = [ "proc-macro2 1.0.66", - "quote 1.0.33", - "syn 2.0.29", + "quote 1.0.32", + "syn 2.0.28", ] [[package]] @@ -9397,7 +9420,7 @@ dependencies = [ "serde", "serde_json", "serde_yaml 0.9.25", - "sha2", + "sha2 0.10.7", "tempfile", "toml 0.7.6", ] @@ -9554,7 +9577,7 @@ dependencies = [ "serde_json", "serde_with 3.2.0", "serde_yaml 0.9.25", - "sha2", + "sha2 0.10.7", "similar-asserts", "smallvec", "smpl_jwt", @@ -9738,10 +9761,10 @@ dependencies = [ "darling 0.20.3", "once_cell", "proc-macro2 1.0.66", - "quote 1.0.33", + "quote 1.0.32", "serde", "serde_json", - "syn 2.0.29", + "syn 2.0.28", "tracing 0.1.37", ] @@ -9751,10 +9774,10 @@ version = "0.1.0" dependencies = [ "darling 0.20.3", "proc-macro2 1.0.66", - "quote 1.0.33", + "quote 1.0.32", "serde", "serde_derive_internals", - "syn 2.0.29", + "syn 2.0.28", "vector-config", "vector-config-common", ] @@ -9979,7 +10002,7 @@ dependencies = [ "serde", "serde_json", "sha-1", - "sha2", + "sha2 0.10.7", "sha3", "snafu", "strip-ansi-escapes 0.1.1", @@ -10024,7 +10047,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d257817081c7dffcdbab24b9e62d2def62e2ff7d00b1c20062551e6cccc145ff" dependencies = [ "proc-macro2 1.0.66", - "quote 1.0.33", + "quote 1.0.32", ] [[package]] @@ -10125,8 +10148,8 @@ dependencies = [ "log", "once_cell", "proc-macro2 1.0.66", - "quote 1.0.33", - "syn 2.0.29", + "quote 1.0.32", + "syn 2.0.28", "wasm-bindgen-shared", ] @@ -10148,7 +10171,7 @@ version = "0.2.87" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "dee495e55982a3bd48105a7b947fd2a9b4a8ae3010041b9e0faab3f9cd028f1d" dependencies = [ - "quote 1.0.33", + "quote 1.0.32", "wasm-bindgen-macro-support", ] @@ -10159,8 +10182,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "54681b18a46765f095758388f2d0cf16eb8d4169b639ab575a8f5693af210c7b" dependencies = [ "proc-macro2 1.0.66", - "quote 1.0.33", - "syn 2.0.29", + "quote 1.0.32", + "syn 2.0.28", "wasm-bindgen-backend", "wasm-bindgen-shared", ] @@ -10554,7 +10577,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6505e6815af7de1746a08f69c69606bb45695a17149517680f3b2149713b19a3" dependencies = [ "proc-macro2 1.0.66", - "quote 1.0.33", + "quote 1.0.32", "syn 1.0.109", ] @@ -10563,6 +10586,21 @@ name = "zeroize" version = "1.5.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c394b5bd0c6f669e7275d9c20aa90ae064cb22e75a1cad54e1b34088034b149f" +dependencies = [ + "zeroize_derive", +] + +[[package]] +name = "zeroize_derive" +version = "1.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3f8f187641dad4f680d25c4bfc4225b418165984179f26ca76ec4fb6441d3a17" +dependencies = [ + "proc-macro2 1.0.66", + "quote 1.0.32", + "syn 1.0.109", + "synstructure", +] [[package]] name = "zstd" diff --git a/Cargo.toml b/Cargo.toml index 1d20ee364bf53f..2cfada53e8271c 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -699,7 +699,7 @@ sinks-datadog_events = [] sinks-datadog_logs = [] sinks-datadog_metrics = ["protobuf-build", "dep:prost-reflect"] sinks-datadog_traces = ["protobuf-build", "dep:rmpv", "dep:rmp-serde", "dep:serde_bytes"] -sinks-elasticsearch = ["aws-core", "transforms-metric_to_log"] +sinks-elasticsearch = ["transforms-metric_to_log"] sinks-file = ["dep:async-compression"] sinks-gcp = ["dep:base64", "gcp"] sinks-greptimedb = ["dep:greptimedb-client"] @@ -714,7 +714,7 @@ sinks-nats = ["dep:async-nats", "dep:nkeys"] sinks-new_relic_logs = ["sinks-http"] sinks-new_relic = [] sinks-papertrail = ["dep:syslog"] -sinks-prometheus = ["aws-core", "dep:base64", "dep:prometheus-parser", "dep:snap"] +sinks-prometheus = ["dep:base64", "dep:prometheus-parser", "dep:snap"] sinks-pulsar = ["dep:apache-avro", "dep:pulsar", "dep:lru"] sinks-redis = ["dep:redis"] sinks-sematext = ["sinks-elasticsearch", "sinks-influxdb"] @@ -821,7 +821,7 @@ datadog-logs-integration-tests = ["sinks-datadog_logs"] datadog-metrics-integration-tests = ["sinks-datadog_metrics"] datadog-traces-integration-tests = ["sources-datadog_agent", "sinks-datadog_traces", "axum/tokio"] docker-logs-integration-tests = ["sources-docker_logs", "unix"] -es-integration-tests = ["sinks-elasticsearch"] +es-integration-tests = ["sinks-elasticsearch", "aws-core"] eventstoredb_metrics-integration-tests = ["sources-eventstoredb_metrics"] fluent-integration-tests = ["docker", "sources-fluent"] gcp-cloud-storage-integration-tests = ["sinks-gcp"] diff --git a/src/sinks/elasticsearch/common.rs b/src/sinks/elasticsearch/common.rs index d6bd3881e01d26..a085ac6de6f52e 100644 --- a/src/sinks/elasticsearch/common.rs +++ b/src/sinks/elasticsearch/common.rs @@ -1,6 +1,8 @@ use std::collections::HashMap; +#[cfg(feature = "aws-core")] use aws_credential_types::provider::SharedCredentialsProvider; +#[cfg(feature = "aws-core")] use aws_types::region::Region; use bytes::{Buf, Bytes}; use http::{Response, StatusCode, Uri}; @@ -32,10 +34,12 @@ pub struct ElasticsearchCommon { pub base_url: String, pub bulk_uri: Uri, pub http_auth: Option, + #[cfg(feature = "aws-core")] pub aws_auth: Option, pub mode: ElasticsearchCommonMode, pub request_builder: ElasticsearchRequestBuilder, pub tls_settings: TlsSettings, + #[cfg(feature = "aws-core")] pub region: Option, pub request: RequestConfig, pub query_params: HashMap, @@ -72,6 +76,7 @@ impl ElasticsearchCommon { let http_auth = authorization.choose_one(&uri.auth)?; let base_url = uri.uri.to_string().trim_end_matches('/').to_owned(); + #[cfg(feature = "aws-core")] let aws_auth = match &config.auth { Some(ElasticsearchAuth::Basic { .. }) | None => None, Some(ElasticsearchAuth::Aws(aws)) => { @@ -126,6 +131,7 @@ impl ElasticsearchCommon { metric_config.metric_tag_values, ); + #[cfg(feature = "aws-core")] let region = config.aws.as_ref().and_then(|config| config.region()); let version = if let Some(version) = *version { @@ -139,7 +145,9 @@ impl ElasticsearchCommon { match get_version( &base_url, &http_auth, + #[cfg(feature = "aws-core")] &aws_auth, + #[cfg(feature = "aws-core")] ®ion, &request, &tls_settings, @@ -198,11 +206,13 @@ impl ElasticsearchCommon { http_auth, base_url, bulk_uri, + #[cfg(feature = "aws-core")] aws_auth, mode, request_builder, query_params, request, + #[cfg(feature = "aws-core")] region, tls_settings, metric_to_log, @@ -249,7 +259,9 @@ impl ElasticsearchCommon { match get( &self.base_url, &self.http_auth, + #[cfg(feature = "aws-core")] &self.aws_auth, + #[cfg(feature = "aws-core")] &self.region, &self.request, client, @@ -264,6 +276,7 @@ impl ElasticsearchCommon { } } +#[cfg(feature = "aws-core")] pub async fn sign_request( request: &mut http::Request, credentials_provider: &SharedCredentialsProvider, @@ -275,8 +288,8 @@ pub async fn sign_request( async fn get_version( base_url: &str, http_auth: &Option, - aws_auth: &Option, - region: &Option, + #[cfg(feature = "aws-core")] aws_auth: &Option, + #[cfg(feature = "aws-core")] region: &Option, request: &RequestConfig, tls_settings: &TlsSettings, proxy_config: &ProxyConfig, @@ -291,9 +304,19 @@ async fn get_version( } let client = HttpClient::new(tls_settings.clone(), proxy_config)?; - let response = get(base_url, http_auth, aws_auth, region, request, client, "/") - .await - .map_err(|error| format!("Failed to get Elasticsearch API version: {}", error))?; + let response = get( + base_url, + http_auth, + #[cfg(feature = "aws-core")] + aws_auth, + #[cfg(feature = "aws-core")] + region, + request, + client, + "/", + ) + .await + .map_err(|error| format!("Failed to get Elasticsearch API version: {}", error))?; let (_, body) = response.into_parts(); let mut body = body::aggregate(body).await?; @@ -315,8 +338,8 @@ async fn get_version( async fn get( base_url: &str, http_auth: &Option, - aws_auth: &Option, - region: &Option, + #[cfg(feature = "aws-core")] aws_auth: &Option, + #[cfg(feature = "aws-core")] region: &Option, request: &RequestConfig, client: HttpClient, path: &str, @@ -331,8 +354,11 @@ async fn get( builder = builder.header(&header[..], &value[..]); } - let mut request = builder.body(Bytes::new())?; + let request = builder.body(Bytes::new())?; + #[cfg(feature = "aws-core")] + let mut request = request; + #[cfg(feature = "aws-core")] if let Some(credentials_provider) = aws_auth { sign_request(&mut request, credentials_provider, region).await?; } diff --git a/src/sinks/elasticsearch/config.rs b/src/sinks/elasticsearch/config.rs index 2295555dc8c728..b0332b13dd0c54 100644 --- a/src/sinks/elasticsearch/config.rs +++ b/src/sinks/elasticsearch/config.rs @@ -6,8 +6,9 @@ use std::{ use futures::{FutureExt, TryFutureExt}; use vector_config::configurable_component; +#[cfg(feature = "aws-core")] +use crate::aws::RegionOrEndpoint; use crate::{ - aws::RegionOrEndpoint, codecs::Transformer, config::{AcknowledgementsConfig, DataType, Input, SinkConfig, SinkContext}, event::{EventRef, LogEvent, Value}, @@ -153,6 +154,7 @@ pub struct ElasticsearchConfig { #[serde(default)] #[configurable(derived)] + #[cfg(feature = "aws-core")] pub aws: Option, #[serde(default)] @@ -215,6 +217,7 @@ impl Default for ElasticsearchConfig { request: Default::default(), auth: None, query: None, + #[cfg(feature = "aws-core")] aws: None, tls: None, endpoint_health: None, diff --git a/src/sinks/elasticsearch/mod.rs b/src/sinks/elasticsearch/mod.rs index 47e0f8869e807f..b7a95fa03e66f0 100644 --- a/src/sinks/elasticsearch/mod.rs +++ b/src/sinks/elasticsearch/mod.rs @@ -24,6 +24,7 @@ use snafu::Snafu; use vector_common::sensitive_string::SensitiveString; use vector_config::configurable_component; +#[cfg(feature = "aws-core")] use crate::aws::AwsAuthentication; use crate::{ event::{EventRef, LogEvent}, @@ -50,6 +51,7 @@ pub enum ElasticsearchAuth { password: SensitiveString, }, + #[cfg(feature = "aws-core")] /// Amazon OpenSearch Service-specific authentication. Aws(AwsAuthentication), } @@ -210,6 +212,7 @@ pub enum ParseError { IndexTemplate { source: TemplateParseError }, #[snafu(display("Batch action template parse error: {}", source))] BatchActionTemplate { source: TemplateParseError }, + #[cfg(feature = "aws-core")] #[snafu(display("aws.region required when AWS authentication is in use"))] RegionRequired, #[snafu(display("Endpoints option must be specified"))] diff --git a/src/sinks/elasticsearch/service.rs b/src/sinks/elasticsearch/service.rs index 4e68218cc95bca..e4ef28ec647844 100644 --- a/src/sinks/elasticsearch/service.rs +++ b/src/sinks/elasticsearch/service.rs @@ -4,7 +4,9 @@ use std::{ task::{Context, Poll}, }; +#[cfg(feature = "aws-core")] use aws_credential_types::provider::SharedCredentialsProvider; +#[cfg(feature = "aws-core")] use aws_types::region::Region; use bytes::Bytes; use futures::future::BoxFuture; @@ -17,6 +19,7 @@ use vector_common::{ }; use vector_core::{stream::DriverResponse, ByteSizeOf}; +#[cfg(feature = "aws-core")] use crate::sinks::elasticsearch::sign_request; use crate::{ event::{EventFinalizers, EventStatus, Finalizable}, @@ -96,10 +99,12 @@ impl ElasticsearchService { pub struct HttpRequestBuilder { pub bulk_uri: Uri, pub query_params: HashMap, + #[cfg(feature = "aws-core")] pub region: Option, pub compression: Compression, pub http_request_config: RequestConfig, pub http_auth: Option, + #[cfg(feature = "aws-core")] pub credentials_provider: Option, } @@ -110,8 +115,10 @@ impl HttpRequestBuilder { http_request_config: config.request.clone(), http_auth: common.http_auth.clone(), query_params: common.query_params.clone(), + #[cfg(feature = "aws-core")] region: common.region.clone(), compression: config.compression, + #[cfg(feature = "aws-core")] credentials_provider: common.aws_auth.clone(), } } @@ -140,10 +147,14 @@ impl HttpRequestBuilder { builder = auth.apply_builder(builder); } - let mut request = builder + let request = builder .body(es_req.payload) .expect("Invalid http request value used"); + #[cfg(feature = "aws-core")] + let mut request = request; + + #[cfg(feature = "aws-core")] if let Some(credentials_provider) = &self.credentials_provider { sign_request(&mut request, credentials_provider, &self.region).await?; } diff --git a/src/sinks/prometheus/mod.rs b/src/sinks/prometheus/mod.rs index dd0033c46c1b68..c092732b46d538 100644 --- a/src/sinks/prometheus/mod.rs +++ b/src/sinks/prometheus/mod.rs @@ -8,6 +8,7 @@ pub(crate) mod remote_write; use vector_config::configurable_component; +#[cfg(feature = "aws-core")] use crate::aws::AwsAuthentication; /// Authentication strategies. @@ -33,6 +34,7 @@ pub enum PrometheusRemoteWriteAuth { token: SensitiveString, }, + #[cfg(feature = "aws-core")] /// Amazon Prometheus Service-specific authentication. Aws(AwsAuthentication), } diff --git a/src/sinks/prometheus/remote_write.rs b/src/sinks/prometheus/remote_write.rs index a1e9b792fed4de..f60baf974e4f42 100644 --- a/src/sinks/prometheus/remote_write.rs +++ b/src/sinks/prometheus/remote_write.rs @@ -14,8 +14,9 @@ use vector_config::configurable_component; use vector_core::{ByteSizeOf, EstimatedJsonEncodedSizeOf}; use super::collector::{self, MetricCollector as _}; +#[cfg(feature = "aws-core")] +use crate::aws::RegionOrEndpoint; use crate::{ - aws::RegionOrEndpoint, config::{self, AcknowledgementsConfig, Input, SinkConfig}, event::{Event, Metric}, http::{Auth, HttpClient}, @@ -48,6 +49,7 @@ impl SinkBatchSettings for PrometheusRemoteWriteDefaultBatchSettings { enum Errors { #[snafu(display(r#"Prometheus remote_write sink cannot accept "set" metrics"#))] SetMetricInvalid, + #[cfg(feature = "aws-core")] #[snafu(display("aws.region required when AWS authentication is in use"))] AwsRegionRequired, } @@ -116,6 +118,7 @@ pub struct RemoteWriteConfig { #[configurable(derived)] pub auth: Option, + #[cfg(feature = "aws-core")] #[configurable(derived)] #[configurable(metadata(docs::advanced))] pub aws: Option, @@ -194,6 +197,7 @@ impl SinkConfig for RemoteWriteConfig { None, None, ), + #[cfg(feature = "aws-core")] Some(PrometheusRemoteWriteAuth::Aws(aws_auth)) => { let region = self .aws @@ -406,11 +410,14 @@ impl HttpRequestBuilder { builder = builder.header("X-Scope-OrgID", tenant_id); } - let mut request = builder.body(body.into()).unwrap(); + let request = builder.body(body.into()).unwrap(); + #[cfg(feature = "aws-core")] + let mut request = request; if let Some(http_auth) = &self.http_auth { http_auth.apply(&mut request); } + #[cfg(feature = "aws-core")] if let Some(credentials_provider) = &self.credentials_provider { sign_request(&mut request, credentials_provider, &self.aws_region).await?; } @@ -440,6 +447,7 @@ fn compress_block(compression: Compression, data: Bytes) -> Vec { } } +#[cfg(feature = "aws-core")] async fn sign_request( request: &mut http::Request, credentials_provider: &SharedCredentialsProvider,