Google Cloud Dataflow可以在Go语言中运行而不需要外部IP地址吗?

huangapple go评论85阅读模式
英文:

Can Google Cloud Dataflow be run without an external IP address in Go?

问题

根据文档,可以在不使用公共 IP 的情况下运行 Dataflow。但是文档中只提供了 Java 和 Python 的信息,我找不到在 Go 中实现的方法 :-(。

英文:

According to the documentation it's possible to run Dataflow without using public IP. But it only have information for Java and Python. I'm not able to find a way to do it in Go :-(.

答案1

得分: 1

Go语言目前尚未在Dataflow上得到官方支持(因此缺乏文档),但是Go SDK中存在相同的标志,并且应该以完全相同的方式工作。

英文:

Go is not yet officially supported on Dataflow (hence the lack of documentation), but the same flags exist in the Go SDK and should work exactly the same way.

答案2

得分: 0

解决方案:
IpConfiguration: "WORKER_IP_PRIVATE"

上下文如下:

	response := dataflowService.Projects.Locations.Templates.Create(PROJECT_ID, location, &dataflow.CreateJobFromTemplateRequest{
	Environment: &dataflow.RuntimeEnvironment{
		AdditionalExperiments:   []string{},
		AdditionalUserLabels:    map[string]string{},
		BypassTempDirValidation: false,
		EnableStreamingEngine:   false,
		IpConfiguration:         "WORKER_IP_PRIVATE",
		KmsKeyName:              "",
		MachineType:             "",
		MaxWorkers:              0,
		Network:                 "",
		NumWorkers:              0,
		ServiceAccountEmail:     "",
		Subnetwork:              "https://www.googleapis.com/compute/v1/projects/" + HOST_PROJECT_ID + "/regions/europe-north1/subnetworks/" + SUBNETWORK + "",
		TempLocation:            "",
		WorkerRegion:            "",
		WorkerZone:              "",
		Zone:                    "",
		ForceSendFields:         []string{},
		NullFields:              []string{},
	},
英文:

Solution:
IpConfiguration: "WORKER_IP_PRIVATE"

Like this for context:

	response := dataflowService.Projects.Locations.Templates.Create(PROJECT_ID, location, &dataflow.CreateJobFromTemplateRequest{
	Environment: &dataflow.RuntimeEnvironment{
		AdditionalExperiments:   []string{},
		AdditionalUserLabels:    map[string]string{},
		BypassTempDirValidation: false,
		EnableStreamingEngine:   false,
		IpConfiguration:         "WORKER_IP_PRIVATE",
		KmsKeyName:              "",
		MachineType:             "",
		MaxWorkers:              0,
		Network:                 "",
		NumWorkers:              0,
		ServiceAccountEmail:     "",
		Subnetwork:              "https://www.googleapis.com/compute/v1/projects/" + HOST_PROJECT_ID + "/regions/europe-north1/subnetworks/" + SUBNETWORK + "",
		TempLocation:            "",
		WorkerRegion:            "",
		WorkerZone:              "",
		Zone:                    "",
		ForceSendFields:         []string{},
		NullFields:              []string{},
	},

huangapple
  • 本文由 发表于 2021年8月16日 18:48:55
  • 转载请务必保留本文链接:https://go.coder-hub.com/68801529.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定