googleapis / googleapis/google-cloud-java
Cloud Function Service Client load credentials through String
- Langage dominant
- Java
- Étoiles
- 2.1k
- Forks
- 1.2k
- Merge moyen
- 1 j 23 h
- PR mergées (30 j)
- 154
Description
Thanks for stopping by to let us know something could be better!
**PLEASE READ**: If you have a support contract with Google, please create an issue in the [support console](https://cloud.google.com/support/) instead of filing on GitHub. This will ensure a timely response.
**Is your feature request related to a problem? Please describe.**
I want to load my GCP credentials for the Cloud Function Service Client thru env variable of json string (that contains the contents of GCP credentials) but I can't find it [here](https://github.com/googleapis/google-cloud-java/blob/0d6459c4c189f572e07640b3789f0cc8cd2a2a45/java-functions/google-cloud-functions/src/main/java/com/google/cloud/functions/v1/CloudFunctionsServiceClient.java#L151). Is it not supported?
```json
{
"type": "external_account",
"audience": "//iam.googleapis.com/projects/blabla/locations/blabla/workloadIdentityPools/...",
"subject_token_type": "urn:ietf:params:aws:token-type:aws4_request",
"token_url": "https://sts.googleapis.com/v1/token",
"credential_source": {
"environment_id": "aws1",
"region_url": "http://someip/latest/meta-data/placement/availability-zone",
"url": "http://someip/latest/meta-data/iam/security-credentials",
"regional_cred_verification_url": "https://sts.{region}.amazonaws.com?Action=GetCallerIdentity&Version=2011-06-15"
},
"service_account_impersonation_url": "https://iamcredentials.googleapis.com/v1/projects/-/serviceAccounts/blablabla"
}
```
**Describe the solution you'd like**
I would like a constructor for this client that uses a json string of the contents of the credentials file.
```java
### JsonNode type
public static final CloudFunctionsServiceClient create(JsonNode credentials) throws IOException {
return create(CloudFunctionsServiceSettings.newBuilder().build());
}
### String type
public static final CloudFunctionsServiceClient create(String jsonCredentials) throws IOException {
return create(CloudFunctionsServiceSettings.newBuilder().build());
}
```
**Describe alternatives you've considered**
Used the file and the credential json file path set as an environment variable, but our security measures dictate that no credentials are to be saved as files.
Guide de contribution
Ouvrir le guide de contribution
Évaluation
Cette issue n'a pas encore été évaluée.