googleapi compute.zoneOperations.wait 在哪里?尝试在 Typescript 中创建 Google 个 VM 实例
Where is googleapi compute.zoneOperations.wait? Trying to create Google VM instances in Typescript
我正在尝试在 Typescript 中使用类型安全 Google 云计算 API:https://cloud.google.com/compute/docs/reference/rest/beta/zoneOperations/wait。文档说它应该在测试版中可用,但在我的 IDE 和我的应用程序中,使用 googleapis@46.0.0
,我可以看到 wait
只能作为 "alpha",不在 "beta" 或 "v1" 中。我在应用程序中看到的错误是 TypeError: compute.zoneOperations.wait is not a function
。而且我发现如果没有一些特殊的 Google-fu,普通用户无法使用 alpha 函数。
所以我的问题是,如何使用 zoneOperations.wait
?
简化了,这是我创建 VM 实例的代码:
import { google } from 'googleapis'
// ...
const authClient = await google.auth.getClient({
scopes: [...]
})
const projectId = await google.auth.getProjectId()
const request = {
project: projectId,
zone: zone,
resource: vmConfig,
auth: authClient,
};
const response = await compute.instances.insert(request)
const operationId = response.data.id
if (!operationId)
throw new Error(`createInstance: Error creating instance ${vmName}`)
// Wait for the instance to be created: this is where it fails
const status = await compute.zoneOperations.wait({operation: operationId})
请注意实例 确实 创建成功(我可以在控制台中看到它。)
我知道我可以在循环中调用 zoneOperations.get
,但那既浪费又慢,因为我必须在调用之间睡觉。
有人使用这个 API 创建 VM 实例吗?
我在内部检查过,我们的产品工程师正在努力在 2020 年初为 compute.zoneOperations.wait 方法生成客户端库。但是,目前无法共享发布 ETA。
请记住,支持不包括 Alpha releases。产品
团队直接管理 Alpha 发布参与和各自的反馈
没有支持团队参与的渠道。
如果您对 Alpha 版发布或参与 Alpha 版有疑问
程序,请联系您的 account team or Sales.
我正在尝试在 Typescript 中使用类型安全 Google 云计算 API:https://cloud.google.com/compute/docs/reference/rest/beta/zoneOperations/wait。文档说它应该在测试版中可用,但在我的 IDE 和我的应用程序中,使用 googleapis@46.0.0
,我可以看到 wait
只能作为 "alpha",不在 "beta" 或 "v1" 中。我在应用程序中看到的错误是 TypeError: compute.zoneOperations.wait is not a function
。而且我发现如果没有一些特殊的 Google-fu,普通用户无法使用 alpha 函数。
所以我的问题是,如何使用 zoneOperations.wait
?
简化了,这是我创建 VM 实例的代码:
import { google } from 'googleapis'
// ...
const authClient = await google.auth.getClient({
scopes: [...]
})
const projectId = await google.auth.getProjectId()
const request = {
project: projectId,
zone: zone,
resource: vmConfig,
auth: authClient,
};
const response = await compute.instances.insert(request)
const operationId = response.data.id
if (!operationId)
throw new Error(`createInstance: Error creating instance ${vmName}`)
// Wait for the instance to be created: this is where it fails
const status = await compute.zoneOperations.wait({operation: operationId})
请注意实例 确实 创建成功(我可以在控制台中看到它。)
我知道我可以在循环中调用 zoneOperations.get
,但那既浪费又慢,因为我必须在调用之间睡觉。
有人使用这个 API 创建 VM 实例吗?
我在内部检查过,我们的产品工程师正在努力在 2020 年初为 compute.zoneOperations.wait 方法生成客户端库。但是,目前无法共享发布 ETA。
请记住,支持不包括 Alpha releases。产品 团队直接管理 Alpha 发布参与和各自的反馈 没有支持团队参与的渠道。
如果您对 Alpha 版发布或参与 Alpha 版有疑问 程序,请联系您的 account team or Sales.