google-cloud-platform - 无法为主题创建订阅
问题描述
我正在尝试使用 Google 部署管理器。
我创建了一个 YAML 文件,我在其中创建了一个主题和该主题的推送订阅。
resources:
- name: pubsub-topic
type: gcp-types/pubsub-v1:projects.topics
properties:
topic: "topic-01"
- name: pubsub-sub
type: gcp-types/pubsub-v1:projects.subscriptions
properties:
subscription: "gcf-01"
topic: "projects/my-project/topics/topic-01"
pushConfig:
pushEndpoint: "https://us-central1-my-project.cloudfunctions.net/helloWorld/"
ackDeadlineSeconds: 600
expirationPeriod:
当我运行命令时
cloud deployment-manager deployments create google-pub-sub --config C:\Development\GCP\DeploymentManager.yaml
我收到以下错误
部署的指纹为 xxxxxxxxxxxx== Waiting for create [operation-xxxxxxxx-xxxxxx-xxxx-xxxx]...失败。错误:(gcloud.deployment-manager.deployments.create)操作错误 [operation-xxxxx-xxxx-xxxx-xxxx]:错误:- 代码:RESOURCE_ERROR 位置:/deployments/google-pub-sub/resources/pubsub-sub消息:'{"ResourceType":"gcp-types/pubsub-v1:projects.subscriptions","ResourceErrorCode":"404","ResourceErrorMessage":{"code":404,"message":"找不到资源 ( resource=topic-01).","status":"NOT_FOUND","details":[],"statusMessage":"Not Found","requestPath":" https://pubsub.googleapis.
现在如果我运行命令
gcloud deployment-manager deployments update google-pub-sub --config C:\Development\GCP\DeploymentManager.yaml
有用。这是否意味着操作不是顺序的,并且系统正在尝试在创建主题之前创建订阅。
此外,我仍然无法将 ExpirationPeriod 设置为 Never。如果有人知道,请告诉我。
谢谢!!!
解决方案
好吧,我通过使用 YAML 文件中的引用解决了第一个问题,所以更改后的文件看起来像
resources:
- name: pubsub-topic
type: gcp-types/pubsub-v1:projects.topics
properties:
topic: "topic-01"
- name: pubsub-sub
type: gcp-types/pubsub-v1:projects.subscriptions
properties:
subscription: "gcf-01"
topic: $(ref.pubsub-topic.name)
pushConfig:
pushEndpoint: "https://us-central1-my-project.cloudfunctions.net/helloWorld/"
ackDeadlineSeconds: 600
expirationPolicy: {}
推荐阅读
- java - 为类创建别名
- jquery - 表转 JSON +rowspan 转海量
- scala - 使用数据帧的 Spark 会话化
- angular - 使用 npm 安装 Angular-cli 时出错
- c# - WSDL 数据类型“xxxx:AuthorizationFilter”不存在
- python - 字典 | 班级 | 来自 YAML 的命名元组
- android - IllegalArgumentException:AdConsent 库
- c# - 如何正确调用 Jira Rest API
- react-native - 在 FLATLIST 中绑定列表项 onpress ( React Native )
- javascript - my = f.input :title 中的标题是什么?