winding-lines commented on code in PR #3541:
URL: https://github.com/apache/arrow-rs/pull/3541#discussion_r1086722962
##########
object_store/src/gcp/credential.rs:
##########
@@ -329,39 +319,69 @@ fn b64_encode_obj<T: serde::Serialize>(obj: &T) ->
Result<String> {
}
/// A provider that uses the Google Cloud Platform metadata server to fetch a
token.
+///
+/// <https://cloud.google.com/docs/authentication/get-id-token#metadata-server>
#[derive(Debug, Default)]
pub struct InstanceCredentialProvider {
audience: String,
+ client_options: ClientOptions,
}
impl InstanceCredentialProvider {
- pub fn new<T: Into<String>>(audience: T) -> Self {
+ /// Create a new [`InstanceCredentialProvider`], we need to control the
client in order to enable http access so save the options.
+ pub fn new<T: Into<String>>(audience: T, client_options: ClientOptions) ->
Self {
Self {
audience: audience.into(),
+ client_options: client_options.with_allow_http(true),
}
}
}
+/// Make a request to the metadata server to fetch a token, using a a given
hostname.
+async fn make_metadata_request(
+ client: &Client,
+ hostname: &str,
+ retry: &RetryConfig,
+ audience: &str,
+) -> Result<TokenResponse> {
+ let url = format!(
+ "http://{}/computeMetadata/v1/instance/service-accounts/default/token",
+ hostname
+ );
+ println!("gcp/credentials getting token from url: {}", url);
Review Comment:
oops, deleted
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]