问题描述
对于那些非常了解GCP的人来说,它对用户和权限控制有一些局限性".
For those who knows GCP well, it has some "limitations" about user and permissions control.
例如,数据存储区没有任何方法来管理数据库本身的用户角色,并且仅具有平台的IAM.
The Datastore, for example, doesn't have any way to manage user roles of the database itself and it has only the IAM of the plataform.
因此,Google的员工建议其客户使用GCP的多个项目和文件夹来对此进行更多控制.我已经看了一段时间了.
Because of that, Google's employees advise their customers to use multiple projects and folders of the GCP to have more control in that. I have seen it for a while.
问题是:如何在Spring Cloud GCP上连接到GCP多个项目的多个资源?我们的应用程序应从不同的项目访问数据存储区和其他资源,我在此方面苦苦挣扎.
The question is: How to connect to multiple resources of multiple projects of GCP on Spring Cloud GCP? We have applications that should access Datastore and other resources from different projects and I'm struggling here with that.
即使Spring Cloud GCP不支持多个GCP项目,是否有解决方法?
Even if Spring Cloud GCP doesn't support for multiple GCP projects, there is any workaround?
谢谢大家.
推荐答案
您可以使用为每个单独的服务提供的低级客户端库,使用如下提供的构建器来创建实例,以便将pubsub发布到具有不同项目ID的主题
You can use low-level client libraries provided for each individual service, to create an instance using builder provided like below for pubsub publishing to a topic with different project id.
ProjectTopicName topicName = ProjectTopicName.of(projectId, topic);
publisher = Publisher.newBuilder(topicName)
.setChannelProvider(transportChannelProvider)
.setCredentialsProvider(credentialsProvider)
.build();
然后,您可以创建一个bean并在您的应用程序中将其自动连接以使用它.尽管要使用带有多个项目ID的spring-cloud-gcp-pubsub,您可以参考答案
You can then create a bean and autowire this in your app to use it.Although for using spring-cloud-gcp-pubsub with multiple project ids you can refer this answer
这篇关于如何将Spring Cloud GCP用于多个Google项目的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!