diff --git a/CMakeLists.txt b/CMakeLists.txt
index 88ea4bce529..f6a7fce3b73 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1872,7 +1872,6 @@ add_library(grpc
src/core/ext/filters/rbac/rbac_service_config_parser.cc
src/core/ext/filters/stateful_session/stateful_session_filter.cc
src/core/ext/filters/stateful_session/stateful_session_service_config_parser.cc
- src/core/ext/gcp/metadata_query.cc
src/core/ext/transport/chttp2/alpn/alpn.cc
src/core/ext/transport/chttp2/client/chttp2_connector.cc
src/core/ext/transport/chttp2/server/chttp2_server.cc
@@ -2603,6 +2602,7 @@ add_library(grpc
src/core/tsi/ssl_transport_security_utils.cc
src/core/tsi/transport_security.cc
src/core/tsi/transport_security_grpc.cc
+ src/core/util/gcp_metadata_query.cc
src/core/util/http_client/format_request.cc
src/core/util/http_client/httpcli.cc
src/core/util/http_client/httpcli_security_connector.cc
diff --git a/Makefile b/Makefile
index 27a67eab1ef..273bbf87d17 100644
--- a/Makefile
+++ b/Makefile
@@ -703,7 +703,6 @@ LIBGRPC_SRC = \
src/core/ext/filters/rbac/rbac_service_config_parser.cc \
src/core/ext/filters/stateful_session/stateful_session_filter.cc \
src/core/ext/filters/stateful_session/stateful_session_service_config_parser.cc \
- src/core/ext/gcp/metadata_query.cc \
src/core/ext/transport/chttp2/alpn/alpn.cc \
src/core/ext/transport/chttp2/client/chttp2_connector.cc \
src/core/ext/transport/chttp2/server/chttp2_server.cc \
@@ -1456,6 +1455,7 @@ LIBGRPC_SRC = \
src/core/util/alloc.cc \
src/core/util/android/log.cc \
src/core/util/atm.cc \
+ src/core/util/gcp_metadata_query.cc \
src/core/util/http_client/format_request.cc \
src/core/util/http_client/httpcli.cc \
src/core/util/http_client/httpcli_security_connector.cc \
diff --git a/Package.swift b/Package.swift
index f9aabb060b5..d9e723fc3d3 100644
--- a/Package.swift
+++ b/Package.swift
@@ -193,8 +193,6 @@ let package = Package(
"src/core/ext/filters/stateful_session/stateful_session_filter.h",
"src/core/ext/filters/stateful_session/stateful_session_service_config_parser.cc",
"src/core/ext/filters/stateful_session/stateful_session_service_config_parser.h",
- "src/core/ext/gcp/metadata_query.cc",
- "src/core/ext/gcp/metadata_query.h",
"src/core/ext/transport/chttp2/alpn/alpn.cc",
"src/core/ext/transport/chttp2/alpn/alpn.h",
"src/core/ext/transport/chttp2/client/chttp2_connector.cc",
@@ -1914,6 +1912,8 @@ let package = Package(
"src/core/util/alloc.h",
"src/core/util/android/log.cc",
"src/core/util/atm.cc",
+ "src/core/util/gcp_metadata_query.cc",
+ "src/core/util/gcp_metadata_query.h",
"src/core/util/http_client/format_request.cc",
"src/core/util/http_client/format_request.h",
"src/core/util/http_client/httpcli.cc",
diff --git a/build_autogenerated.yaml b/build_autogenerated.yaml
index d10a96a9b1e..b8f416001e3 100644
--- a/build_autogenerated.yaml
+++ b/build_autogenerated.yaml
@@ -261,7 +261,6 @@ libs:
- src/core/ext/filters/rbac/rbac_service_config_parser.h
- src/core/ext/filters/stateful_session/stateful_session_filter.h
- src/core/ext/filters/stateful_session/stateful_session_service_config_parser.h
- - src/core/ext/gcp/metadata_query.h
- src/core/ext/transport/chttp2/alpn/alpn.h
- src/core/ext/transport/chttp2/client/chttp2_connector.h
- src/core/ext/transport/chttp2/server/chttp2_server.h
@@ -1205,6 +1204,7 @@ libs:
- src/core/tsi/transport_security.h
- src/core/tsi/transport_security_grpc.h
- src/core/tsi/transport_security_interface.h
+ - src/core/util/gcp_metadata_query.h
- src/core/util/http_client/format_request.h
- src/core/util/http_client/httpcli.h
- src/core/util/http_client/httpcli_ssl_credentials.h
@@ -1287,7 +1287,6 @@ libs:
- src/core/ext/filters/rbac/rbac_service_config_parser.cc
- src/core/ext/filters/stateful_session/stateful_session_filter.cc
- src/core/ext/filters/stateful_session/stateful_session_service_config_parser.cc
- - src/core/ext/gcp/metadata_query.cc
- src/core/ext/transport/chttp2/alpn/alpn.cc
- src/core/ext/transport/chttp2/client/chttp2_connector.cc
- src/core/ext/transport/chttp2/server/chttp2_server.cc
@@ -2018,6 +2017,7 @@ libs:
- src/core/tsi/ssl_transport_security_utils.cc
- src/core/tsi/transport_security.cc
- src/core/tsi/transport_security_grpc.cc
+ - src/core/util/gcp_metadata_query.cc
- src/core/util/http_client/format_request.cc
- src/core/util/http_client/httpcli.cc
- src/core/util/http_client/httpcli_security_connector.cc
diff --git a/config.m4 b/config.m4
index deff264db93..42a31912190 100644
--- a/config.m4
+++ b/config.m4
@@ -78,7 +78,6 @@ if test "$PHP_GRPC" != "no"; then
src/core/ext/filters/rbac/rbac_service_config_parser.cc \
src/core/ext/filters/stateful_session/stateful_session_filter.cc \
src/core/ext/filters/stateful_session/stateful_session_service_config_parser.cc \
- src/core/ext/gcp/metadata_query.cc \
src/core/ext/transport/chttp2/alpn/alpn.cc \
src/core/ext/transport/chttp2/client/chttp2_connector.cc \
src/core/ext/transport/chttp2/server/chttp2_server.cc \
@@ -831,6 +830,7 @@ if test "$PHP_GRPC" != "no"; then
src/core/util/alloc.cc \
src/core/util/android/log.cc \
src/core/util/atm.cc \
+ src/core/util/gcp_metadata_query.cc \
src/core/util/http_client/format_request.cc \
src/core/util/http_client/httpcli.cc \
src/core/util/http_client/httpcli_security_connector.cc \
@@ -1402,7 +1402,6 @@ if test "$PHP_GRPC" != "no"; then
PHP_ADD_BUILD_DIR($ext_builddir/src/core/ext/filters/message_size)
PHP_ADD_BUILD_DIR($ext_builddir/src/core/ext/filters/rbac)
PHP_ADD_BUILD_DIR($ext_builddir/src/core/ext/filters/stateful_session)
- PHP_ADD_BUILD_DIR($ext_builddir/src/core/ext/gcp)
PHP_ADD_BUILD_DIR($ext_builddir/src/core/ext/transport/chttp2/alpn)
PHP_ADD_BUILD_DIR($ext_builddir/src/core/ext/transport/chttp2/client)
PHP_ADD_BUILD_DIR($ext_builddir/src/core/ext/transport/chttp2/server)
diff --git a/config.w32 b/config.w32
index 6a05a877cf8..6007bd959b0 100644
--- a/config.w32
+++ b/config.w32
@@ -43,7 +43,6 @@ if (PHP_GRPC != "no") {
"src\\core\\ext\\filters\\rbac\\rbac_service_config_parser.cc " +
"src\\core\\ext\\filters\\stateful_session\\stateful_session_filter.cc " +
"src\\core\\ext\\filters\\stateful_session\\stateful_session_service_config_parser.cc " +
- "src\\core\\ext\\gcp\\metadata_query.cc " +
"src\\core\\ext\\transport\\chttp2\\alpn\\alpn.cc " +
"src\\core\\ext\\transport\\chttp2\\client\\chttp2_connector.cc " +
"src\\core\\ext\\transport\\chttp2\\server\\chttp2_server.cc " +
@@ -796,6 +795,7 @@ if (PHP_GRPC != "no") {
"src\\core\\util\\alloc.cc " +
"src\\core\\util\\android\\log.cc " +
"src\\core\\util\\atm.cc " +
+ "src\\core\\util\\gcp_metadata_query.cc " +
"src\\core\\util\\http_client\\format_request.cc " +
"src\\core\\util\\http_client\\httpcli.cc " +
"src\\core\\util\\http_client\\httpcli_security_connector.cc " +
@@ -1396,7 +1396,6 @@ if (PHP_GRPC != "no") {
FSO.CreateFolder(base_dir+"\\ext\\grpc\\src\\core\\ext\\filters\\message_size");
FSO.CreateFolder(base_dir+"\\ext\\grpc\\src\\core\\ext\\filters\\rbac");
FSO.CreateFolder(base_dir+"\\ext\\grpc\\src\\core\\ext\\filters\\stateful_session");
- FSO.CreateFolder(base_dir+"\\ext\\grpc\\src\\core\\ext\\gcp");
FSO.CreateFolder(base_dir+"\\ext\\grpc\\src\\core\\ext\\transport");
FSO.CreateFolder(base_dir+"\\ext\\grpc\\src\\core\\ext\\transport\\chttp2");
FSO.CreateFolder(base_dir+"\\ext\\grpc\\src\\core\\ext\\transport\\chttp2\\alpn");
diff --git a/gRPC-C++.podspec b/gRPC-C++.podspec
index 75ed86a5b98..b91516be325 100644
--- a/gRPC-C++.podspec
+++ b/gRPC-C++.podspec
@@ -302,7 +302,6 @@ Pod::Spec.new do |s|
'src/core/ext/filters/rbac/rbac_service_config_parser.h',
'src/core/ext/filters/stateful_session/stateful_session_filter.h',
'src/core/ext/filters/stateful_session/stateful_session_service_config_parser.h',
- 'src/core/ext/gcp/metadata_query.h',
'src/core/ext/transport/binder/client/binder_connector.cc',
'src/core/ext/transport/binder/client/binder_connector.h',
'src/core/ext/transport/binder/client/channel_create.cc',
@@ -1304,6 +1303,7 @@ Pod::Spec.new do |s|
'src/core/tsi/transport_security_grpc.h',
'src/core/tsi/transport_security_interface.h',
'src/core/util/alloc.h',
+ 'src/core/util/gcp_metadata_query.h',
'src/core/util/http_client/format_request.h',
'src/core/util/http_client/httpcli.h',
'src/core/util/http_client/httpcli_ssl_credentials.h',
@@ -1594,7 +1594,6 @@ Pod::Spec.new do |s|
'src/core/ext/filters/rbac/rbac_service_config_parser.h',
'src/core/ext/filters/stateful_session/stateful_session_filter.h',
'src/core/ext/filters/stateful_session/stateful_session_service_config_parser.h',
- 'src/core/ext/gcp/metadata_query.h',
'src/core/ext/transport/binder/client/binder_connector.h',
'src/core/ext/transport/binder/client/channel_create_impl.h',
'src/core/ext/transport/binder/client/connection_id_generator.h',
@@ -2578,6 +2577,7 @@ Pod::Spec.new do |s|
'src/core/tsi/transport_security_grpc.h',
'src/core/tsi/transport_security_interface.h',
'src/core/util/alloc.h',
+ 'src/core/util/gcp_metadata_query.h',
'src/core/util/http_client/format_request.h',
'src/core/util/http_client/httpcli.h',
'src/core/util/http_client/httpcli_ssl_credentials.h',
diff --git a/gRPC-Core.podspec b/gRPC-Core.podspec
index 8a7878202a4..9667c4b3873 100644
--- a/gRPC-Core.podspec
+++ b/gRPC-Core.podspec
@@ -312,8 +312,6 @@ Pod::Spec.new do |s|
'src/core/ext/filters/stateful_session/stateful_session_filter.h',
'src/core/ext/filters/stateful_session/stateful_session_service_config_parser.cc',
'src/core/ext/filters/stateful_session/stateful_session_service_config_parser.h',
- 'src/core/ext/gcp/metadata_query.cc',
- 'src/core/ext/gcp/metadata_query.h',
'src/core/ext/transport/chttp2/alpn/alpn.cc',
'src/core/ext/transport/chttp2/alpn/alpn.h',
'src/core/ext/transport/chttp2/client/chttp2_connector.cc',
@@ -2029,6 +2027,8 @@ Pod::Spec.new do |s|
'src/core/util/alloc.h',
'src/core/util/android/log.cc',
'src/core/util/atm.cc',
+ 'src/core/util/gcp_metadata_query.cc',
+ 'src/core/util/gcp_metadata_query.h',
'src/core/util/http_client/format_request.cc',
'src/core/util/http_client/format_request.h',
'src/core/util/http_client/httpcli.cc',
@@ -2396,7 +2396,6 @@ Pod::Spec.new do |s|
'src/core/ext/filters/rbac/rbac_service_config_parser.h',
'src/core/ext/filters/stateful_session/stateful_session_filter.h',
'src/core/ext/filters/stateful_session/stateful_session_service_config_parser.h',
- 'src/core/ext/gcp/metadata_query.h',
'src/core/ext/transport/chttp2/alpn/alpn.h',
'src/core/ext/transport/chttp2/client/chttp2_connector.h',
'src/core/ext/transport/chttp2/server/chttp2_server.h',
@@ -3360,6 +3359,7 @@ Pod::Spec.new do |s|
'src/core/tsi/transport_security_grpc.h',
'src/core/tsi/transport_security_interface.h',
'src/core/util/alloc.h',
+ 'src/core/util/gcp_metadata_query.h',
'src/core/util/http_client/format_request.h',
'src/core/util/http_client/httpcli.h',
'src/core/util/http_client/httpcli_ssl_credentials.h',
diff --git a/grpc.gemspec b/grpc.gemspec
index 15b48f8cb0e..8292d7a115f 100644
--- a/grpc.gemspec
+++ b/grpc.gemspec
@@ -199,8 +199,6 @@ Gem::Specification.new do |s|
s.files += %w( src/core/ext/filters/stateful_session/stateful_session_filter.h )
s.files += %w( src/core/ext/filters/stateful_session/stateful_session_service_config_parser.cc )
s.files += %w( src/core/ext/filters/stateful_session/stateful_session_service_config_parser.h )
- s.files += %w( src/core/ext/gcp/metadata_query.cc )
- s.files += %w( src/core/ext/gcp/metadata_query.h )
s.files += %w( src/core/ext/transport/chttp2/alpn/alpn.cc )
s.files += %w( src/core/ext/transport/chttp2/alpn/alpn.h )
s.files += %w( src/core/ext/transport/chttp2/client/chttp2_connector.cc )
@@ -1916,6 +1914,8 @@ Gem::Specification.new do |s|
s.files += %w( src/core/util/alloc.h )
s.files += %w( src/core/util/android/log.cc )
s.files += %w( src/core/util/atm.cc )
+ s.files += %w( src/core/util/gcp_metadata_query.cc )
+ s.files += %w( src/core/util/gcp_metadata_query.h )
s.files += %w( src/core/util/http_client/format_request.cc )
s.files += %w( src/core/util/http_client/format_request.h )
s.files += %w( src/core/util/http_client/httpcli.cc )
diff --git a/grpc.gyp b/grpc.gyp
index 2327e4ad03a..a6c4e944833 100644
--- a/grpc.gyp
+++ b/grpc.gyp
@@ -312,7 +312,7 @@
'src/core/ext/filters/server_config_selector/server_config_selector_filter.cc',
'src/core/ext/filters/stateful_session/stateful_session_filter.cc',
'src/core/ext/filters/stateful_session/stateful_session_service_config_parser.cc',
- 'src/core/ext/gcp/metadata_query.cc',
+ 'src/core/util/gcp_metadata_query.cc',
'src/core/ext/transport/chttp2/alpn/alpn.cc',
'src/core/ext/transport/chttp2/client/chttp2_connector.cc',
'src/core/ext/transport/chttp2/server/chttp2_server.cc',
diff --git a/package.xml b/package.xml
index ffe1342e92b..1be34c03fb5 100644
--- a/package.xml
+++ b/package.xml
@@ -181,8 +181,6 @@
-
-
@@ -1898,6 +1896,8 @@
+
+
diff --git a/src/core/BUILD b/src/core/BUILD
index 354b3d9fcab..103fdea4f59 100644
--- a/src/core/BUILD
+++ b/src/core/BUILD
@@ -7199,10 +7199,10 @@ grpc_cc_library(
grpc_cc_library(
name = "gcp_metadata_query",
srcs = [
- "ext/gcp/metadata_query.cc",
+ "util/gcp_metadata_query.cc",
],
hdrs = [
- "ext/gcp/metadata_query.h",
+ "util/gcp_metadata_query.h",
],
external_deps = [
"absl/functional:any_invocable",
diff --git a/src/core/resolver/google_c2p/google_c2p_resolver.cc b/src/core/resolver/google_c2p/google_c2p_resolver.cc
index 74239361742..50cdf52a928 100644
--- a/src/core/resolver/google_c2p/google_c2p_resolver.cc
+++ b/src/core/resolver/google_c2p/google_c2p_resolver.cc
@@ -33,7 +33,6 @@
#include
#include
-#include "src/core/ext/gcp/metadata_query.h"
#include "src/core/lib/channel/channel_args.h"
#include "src/core/lib/config/core_configuration.h"
#include "src/core/lib/gprpp/debug_location.h"
@@ -49,6 +48,7 @@
#include "src/core/resolver/resolver.h"
#include "src/core/resolver/resolver_factory.h"
#include "src/core/resolver/resolver_registry.h"
+#include "src/core/util/gcp_metadata_query.h"
#include "src/core/util/json/json.h"
#include "src/core/util/json/json_writer.h"
#include "src/core/xds/grpc/xds_client_grpc.h"
@@ -82,10 +82,10 @@ class GoogleCloud2ProdResolver final : public Resolver {
std::string metadata_server_name_ = "metadata.google.internal.";
bool shutdown_ = false;
- OrphanablePtr zone_query_;
+ OrphanablePtr zone_query_;
absl::optional zone_;
- OrphanablePtr ipv6_query_;
+ OrphanablePtr ipv6_query_;
absl::optional supports_ipv6_;
};
@@ -152,8 +152,8 @@ void GoogleCloud2ProdResolver::StartLocked() {
return;
}
// Using xDS. Start metadata server queries.
- zone_query_ = MakeOrphanable(
- metadata_server_name_, std::string(MetadataQuery::kZoneAttribute),
+ zone_query_ = MakeOrphanable(
+ metadata_server_name_, std::string(GcpMetadataQuery::kZoneAttribute),
&pollent_,
[resolver = RefAsSubclass()](
std::string /* attribute */,
@@ -166,8 +166,8 @@ void GoogleCloud2ProdResolver::StartLocked() {
DEBUG_LOCATION);
},
Duration::Seconds(10));
- ipv6_query_ = MakeOrphanable(
- metadata_server_name_, std::string(MetadataQuery::kIPv6Attribute),
+ ipv6_query_ = MakeOrphanable(
+ metadata_server_name_, std::string(GcpMetadataQuery::kIPv6Attribute),
&pollent_,
[resolver = RefAsSubclass()](
std::string /* attribute */,
diff --git a/src/core/ext/gcp/metadata_query.cc b/src/core/util/gcp_metadata_query.cc
similarity index 83%
rename from src/core/ext/gcp/metadata_query.cc
rename to src/core/util/gcp_metadata_query.cc
index dd2e0603641..1281134f042 100644
--- a/src/core/ext/gcp/metadata_query.cc
+++ b/src/core/util/gcp_metadata_query.cc
@@ -16,7 +16,9 @@
//
//
-#include "src/core/ext/gcp/metadata_query.h"
+#include
+
+#include "src/core/util/gcp_metadata_query.h"
#include
@@ -34,7 +36,6 @@
#include
#include
#include
-#include
#include "src/core/lib/debug/trace.h"
#include "src/core/lib/gprpp/ref_counted_ptr.h"
@@ -47,29 +48,29 @@ namespace grpc_core {
TraceFlag grpc_metadata_query_trace(false, "metadata_query");
-constexpr const char MetadataQuery::kZoneAttribute[];
-constexpr const char MetadataQuery::kClusterNameAttribute[];
-constexpr const char MetadataQuery::kRegionAttribute[];
-constexpr const char MetadataQuery::kInstanceIdAttribute[];
-constexpr const char MetadataQuery::kIPv6Attribute[];
+constexpr const char GcpMetadataQuery::kZoneAttribute[];
+constexpr const char GcpMetadataQuery::kClusterNameAttribute[];
+constexpr const char GcpMetadataQuery::kRegionAttribute[];
+constexpr const char GcpMetadataQuery::kInstanceIdAttribute[];
+constexpr const char GcpMetadataQuery::kIPv6Attribute[];
-MetadataQuery::MetadataQuery(
+GcpMetadataQuery::GcpMetadataQuery(
std::string attribute, grpc_polling_entity* pollent,
absl::AnyInvocable /* result */)>
callback,
Duration timeout)
- : MetadataQuery("metadata.google.internal.", std::move(attribute), pollent,
- std::move(callback), timeout) {}
+ : GcpMetadataQuery("metadata.google.internal.", std::move(attribute),
+ pollent, std::move(callback), timeout) {}
-MetadataQuery::MetadataQuery(
+GcpMetadataQuery::GcpMetadataQuery(
std::string metadata_server_name, std::string attribute,
grpc_polling_entity* pollent,
absl::AnyInvocable /* result */)>
callback,
Duration timeout)
- : InternallyRefCounted(nullptr, 2),
+ : InternallyRefCounted(nullptr, 2),
attribute_(std::move(attribute)),
callback_(std::move(callback)) {
GRPC_CLOSURE_INIT(&on_done_, OnDone, this, nullptr);
@@ -90,15 +91,17 @@ MetadataQuery::MetadataQuery(
http_request_->Start();
}
-MetadataQuery::~MetadataQuery() { grpc_http_response_destroy(&response_); }
+GcpMetadataQuery::~GcpMetadataQuery() {
+ grpc_http_response_destroy(&response_);
+}
-void MetadataQuery::Orphan() {
+void GcpMetadataQuery::Orphan() {
http_request_.reset();
Unref();
}
-void MetadataQuery::OnDone(void* arg, grpc_error_handle error) {
- auto* self = static_cast(arg);
+void GcpMetadataQuery::OnDone(void* arg, grpc_error_handle error) {
+ auto* self = static_cast(arg);
if (GRPC_TRACE_FLAG_ENABLED(grpc_metadata_query_trace)) {
gpr_log(GPR_INFO, "MetadataServer Query for %s: HTTP status: %d, error: %s",
self->attribute_.c_str(), self->response_.status,
diff --git a/src/core/ext/gcp/metadata_query.h b/src/core/util/gcp_metadata_query.h
similarity index 90%
rename from src/core/ext/gcp/metadata_query.h
rename to src/core/util/gcp_metadata_query.h
index 395c1e6d995..fda085d1f9c 100644
--- a/src/core/ext/gcp/metadata_query.h
+++ b/src/core/util/gcp_metadata_query.h
@@ -14,16 +14,16 @@
// limitations under the License.
//
-#ifndef GRPC_SRC_CORE_EXT_GCP_METADATA_QUERY_H
-#define GRPC_SRC_CORE_EXT_GCP_METADATA_QUERY_H
+#ifndef GRPC_SRC_CORE_UTIL_GCP_METADATA_QUERY_H
+#define GRPC_SRC_CORE_UTIL_GCP_METADATA_QUERY_H
+
+#include
#include
#include "absl/functional/any_invocable.h"
#include "absl/status/statusor.h"
-#include
-
#include "src/core/lib/gprpp/orphanable.h"
#include "src/core/lib/gprpp/time.h"
#include "src/core/lib/iomgr/closure.h"
@@ -36,7 +36,7 @@ namespace grpc_core {
// Fetches the value of an attribute from the MetadataServer on a GCP
// environment.
-class MetadataQuery : public InternallyRefCounted {
+class GcpMetadataQuery : public InternallyRefCounted {
public:
static constexpr const char kZoneAttribute[] =
"/computeMetadata/v1/instance/zone";
@@ -49,7 +49,7 @@ class MetadataQuery : public InternallyRefCounted {
static constexpr const char kIPv6Attribute[] =
"/computeMetadata/v1/instance/network-interfaces/0/ipv6s";
- MetadataQuery(
+ GcpMetadataQuery(
std::string attribute, grpc_polling_entity* pollent,
absl::AnyInvocable /* result */)>
@@ -58,7 +58,7 @@ class MetadataQuery : public InternallyRefCounted {
// Alternative ctor allows overriding the metadata server address, mainly
// to inject fakes in tests
- MetadataQuery(
+ GcpMetadataQuery(
std::string metadata_server_name, std::string attribute,
grpc_polling_entity* pollent,
absl::AnyInvocable {
callback,
Duration timeout);
- ~MetadataQuery() override;
+ ~GcpMetadataQuery() override;
void Orphan() override;
@@ -84,4 +84,4 @@ class MetadataQuery : public InternallyRefCounted {
} // namespace grpc_core
-#endif // GRPC_SRC_CORE_EXT_GCP_METADATA_QUERY_H
+#endif // GRPC_SRC_CORE_UTIL_GCP_METADATA_QUERY_H
diff --git a/src/cpp/ext/gcp/environment_autodetect.cc b/src/cpp/ext/gcp/environment_autodetect.cc
index b4963ffa7ea..5d2307ceec6 100644
--- a/src/cpp/ext/gcp/environment_autodetect.cc
+++ b/src/cpp/ext/gcp/environment_autodetect.cc
@@ -33,7 +33,6 @@
#include
#include
-#include "src/core/ext/gcp/metadata_query.h"
#include "src/core/lib/debug/trace.h"
#include "src/core/lib/event_engine/default_event_engine.h"
#include "src/core/lib/gprpp/crash.h"
@@ -49,6 +48,7 @@
#include "src/core/lib/iomgr/polling_entity.h"
#include "src/core/lib/iomgr/pollset.h"
#include "src/core/lib/slice/slice.h"
+#include "src/core/util/gcp_metadata_query.h"
namespace grpc {
namespace internal {
@@ -202,18 +202,18 @@ class EnvironmentAutoDetectHelper
resource_.labels.emplace("namespace_name", GetNamespaceName());
resource_.labels.emplace("pod_name", GetPodName());
resource_.labels.emplace("container_name", GetContainerName());
- attributes_to_fetch_.emplace(grpc_core::MetadataQuery::kZoneAttribute,
+ attributes_to_fetch_.emplace(grpc_core::GcpMetadataQuery::kZoneAttribute,
"location");
attributes_to_fetch_.emplace(
- grpc_core::MetadataQuery::kClusterNameAttribute, "cluster_name");
+ grpc_core::GcpMetadataQuery::kClusterNameAttribute, "cluster_name");
}
// Cloud Functions
else if (grpc_core::GetEnv("FUNCTION_NAME").has_value() ||
grpc_core::GetEnv("FUNCTION_TARGET").has_value()) {
resource_.resource_type = "cloud_function";
resource_.labels.emplace("function_name", GetFunctionName());
- attributes_to_fetch_.emplace(grpc_core::MetadataQuery::kRegionAttribute,
- "region");
+ attributes_to_fetch_.emplace(
+ grpc_core::GcpMetadataQuery::kRegionAttribute, "region");
}
// Cloud Run
else if (grpc_core::GetEnv("K_CONFIGURATION").has_value()) {
@@ -221,15 +221,15 @@ class EnvironmentAutoDetectHelper
resource_.labels.emplace("revision_name", GetRevisionName());
resource_.labels.emplace("service_name", GetServiceName());
resource_.labels.emplace("configuration_name", GetConfiguratioName());
- attributes_to_fetch_.emplace(grpc_core::MetadataQuery::kRegionAttribute,
- "location");
+ attributes_to_fetch_.emplace(
+ grpc_core::GcpMetadataQuery::kRegionAttribute, "location");
}
// App Engine
else if (grpc_core::GetEnv("GAE_SERVICE").has_value()) {
resource_.resource_type = "gae_app";
resource_.labels.emplace("module_id", GetModuleId());
resource_.labels.emplace("version_id", GetVersionId());
- attributes_to_fetch_.emplace(grpc_core::MetadataQuery::kZoneAttribute,
+ attributes_to_fetch_.emplace(grpc_core::GcpMetadataQuery::kZoneAttribute,
"zone");
}
// Assume GCE
@@ -237,8 +237,8 @@ class EnvironmentAutoDetectHelper
assuming_gce_ = true;
resource_.resource_type = "gce_instance";
attributes_to_fetch_.emplace(
- grpc_core::MetadataQuery::kInstanceIdAttribute, "instance_id");
- attributes_to_fetch_.emplace(grpc_core::MetadataQuery::kZoneAttribute,
+ grpc_core::GcpMetadataQuery::kInstanceIdAttribute, "instance_id");
+ attributes_to_fetch_.emplace(grpc_core::GcpMetadataQuery::kZoneAttribute,
"zone");
}
FetchMetadataServerAttributesAsynchronouslyLocked();
@@ -248,7 +248,7 @@ class EnvironmentAutoDetectHelper
ABSL_EXCLUSIVE_LOCKS_REQUIRED(mu_) {
CHECK(!attributes_to_fetch_.empty());
for (auto& element : attributes_to_fetch_) {
- queries_.push_back(grpc_core::MakeOrphanable(
+ queries_.push_back(grpc_core::MakeOrphanable(
element.first, &pollent_,
[this](std::string attribute, absl::StatusOr result) {
if (GRPC_TRACE_FLAG_ENABLED(grpc_environment_autodetect_trace)) {
@@ -317,7 +317,7 @@ class EnvironmentAutoDetectHelper
absl::flat_hash_map
attributes_to_fetch_ ABSL_GUARDED_BY(mu_);
- std::vector> queries_
+ std::vector> queries_
ABSL_GUARDED_BY(mu_);
EnvironmentAutoDetect::ResourceType resource_ ABSL_GUARDED_BY(mu_);
// This would be true if we are assuming the resource to be GCE. In this case,
diff --git a/src/python/grpcio/grpc_core_dependencies.py b/src/python/grpcio/grpc_core_dependencies.py
index f8d44cc6a01..4bbf8be728d 100644
--- a/src/python/grpcio/grpc_core_dependencies.py
+++ b/src/python/grpcio/grpc_core_dependencies.py
@@ -52,7 +52,6 @@ CORE_SOURCE_FILES = [
'src/core/ext/filters/rbac/rbac_service_config_parser.cc',
'src/core/ext/filters/stateful_session/stateful_session_filter.cc',
'src/core/ext/filters/stateful_session/stateful_session_service_config_parser.cc',
- 'src/core/ext/gcp/metadata_query.cc',
'src/core/ext/transport/chttp2/alpn/alpn.cc',
'src/core/ext/transport/chttp2/client/chttp2_connector.cc',
'src/core/ext/transport/chttp2/server/chttp2_server.cc',
@@ -805,6 +804,7 @@ CORE_SOURCE_FILES = [
'src/core/util/alloc.cc',
'src/core/util/android/log.cc',
'src/core/util/atm.cc',
+ 'src/core/util/gcp_metadata_query.cc',
'src/core/util/http_client/format_request.cc',
'src/core/util/http_client/httpcli.cc',
'src/core/util/http_client/httpcli_security_connector.cc',
diff --git a/tools/doxygen/Doxyfile.c++.internal b/tools/doxygen/Doxyfile.c++.internal
index 55526bff491..a10113a9727 100644
--- a/tools/doxygen/Doxyfile.c++.internal
+++ b/tools/doxygen/Doxyfile.c++.internal
@@ -1160,8 +1160,6 @@ src/core/ext/filters/stateful_session/stateful_session_filter.cc \
src/core/ext/filters/stateful_session/stateful_session_filter.h \
src/core/ext/filters/stateful_session/stateful_session_service_config_parser.cc \
src/core/ext/filters/stateful_session/stateful_session_service_config_parser.h \
-src/core/ext/gcp/metadata_query.cc \
-src/core/ext/gcp/metadata_query.h \
src/core/ext/transport/binder/client/binder_connector.cc \
src/core/ext/transport/binder/client/binder_connector.h \
src/core/ext/transport/binder/client/channel_create.cc \
@@ -2915,6 +2913,8 @@ src/core/util/alloc.cc \
src/core/util/alloc.h \
src/core/util/android/log.cc \
src/core/util/atm.cc \
+src/core/util/gcp_metadata_query.cc \
+src/core/util/gcp_metadata_query.h \
src/core/util/http_client/format_request.cc \
src/core/util/http_client/format_request.h \
src/core/util/http_client/httpcli.cc \
diff --git a/tools/doxygen/Doxyfile.core.internal b/tools/doxygen/Doxyfile.core.internal
index da2bfa5b6fd..e51c424f306 100644
--- a/tools/doxygen/Doxyfile.core.internal
+++ b/tools/doxygen/Doxyfile.core.internal
@@ -964,8 +964,6 @@ src/core/ext/filters/stateful_session/stateful_session_filter.cc \
src/core/ext/filters/stateful_session/stateful_session_filter.h \
src/core/ext/filters/stateful_session/stateful_session_service_config_parser.cc \
src/core/ext/filters/stateful_session/stateful_session_service_config_parser.h \
-src/core/ext/gcp/metadata_query.cc \
-src/core/ext/gcp/metadata_query.h \
src/core/ext/transport/README.md \
src/core/ext/transport/binder/README.md \
src/core/ext/transport/chttp2/README.md \
@@ -2697,6 +2695,8 @@ src/core/util/alloc.cc \
src/core/util/alloc.h \
src/core/util/android/log.cc \
src/core/util/atm.cc \
+src/core/util/gcp_metadata_query.cc \
+src/core/util/gcp_metadata_query.h \
src/core/util/http_client/format_request.cc \
src/core/util/http_client/format_request.h \
src/core/util/http_client/httpcli.cc \