繁体   English   中英

如何将现有 GCP 数据存储索引导入 index.yaml

[英]How to import existing GCP datastore indexes to index.yaml

除了gcloud datastore indexes list之外,我找不到任何直接导出现有索引的方法

gcloud-list.yaml

---                   
ancestor: NONE   
indexId: CICAgOi36pgK 
kind: Session    
projectId: self-serve-dev-261801
properties:      
- direction: ASCENDING
  name: identityId        
- direction: ASCENDING                                                             
  name: endTime                                                                
state: READY                         
---     
ancestor: NONE                                     
indexId: CICAgJj7z4EL                           
kind: Feedback       
projectId: self-serve-dev-261801
properties:          
- direction: ASCENDING
  name: id           
- direction: ASCENDING
  name: entity       
- direction: ASCENDING
  name: value          
- direction: ASCENDING
  name: submitter    
- direction: ASCENDING
  name: createdOn    
- direction: ASCENDING
  name: updatedOn    

索引.yaml

indexes:

- kind: Task
  ancestor: no
  properties:
  - name: done
  - name: priority
    direction: desc

- kind: Task
  properties:
  - name: collaborators
    direction: asc
  - name: created
    direction: desc

- kind: TaskList
  ancestor: yes
  properties:
  - name: percent_complete
    direction: asc
  - name: type
    direction: asc

它是IndexId包含在实际索引中找不到的 IndexId。yaml 示例。

我想创建一个数据存储并使用 Terraform 模块将此索引导入其中。 我不知道如果我们尝试从 gcloud cli output 导入list output 是否会发生冲突。

值也不同NONE -> noASCENDING -> asc

我可以编写一个脚本将其转换为正确的格式。 这是唯一的方法吗?

您可以使用此存储库为 GCP 数据存储生成 index.yaml 文件。 https://github.com/ArunMuthuram/gcpDatastoreIndexYamlGenerator

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM