热门标签 | HotTags
当前位置:  开发笔记 > 编程语言 > 正文

如何使用gcloud启用API

如何解决《如何使用gcloud启用API》经验,为你挑选了3个好方法。

我无法找到使用gcloud命令行程序来更改项目的Enabled API的方法.我的预感是,它将在计费"竞技场"中,但我一直试图找到这个,并有很多运气.



1> 小智..:

使用

gcloud services enable 

gcloud的相关文档

例:

gcloud services enable containerregistry.googleapis.com



2> Abdurrahman ..:

问题 对于当前的默认项目,请执行gcloud service-management list - 启用列出所有可用的API.

$ gcloud service-management list --enabled
Listed 0 items.

如果你看到类似上面的东西,即0项,那么你很可能会得到以下错误的项目的一些命令.

ERROR: (gcloud.compute.machine-types.list) Some requests did not succeed:
 - Project {PROJECT_ID} is not found and cannot be used for API calls

解决方案 您需要做的是以下内容

    列出可以启用的项目可用的API

输出很长,所以我建议你使用全局选项页面大小,例如

$ gcloud service-management list  --available --page-size=10 --sort-by="NAME"
NAME                           TITLE
picker.googleapis.com          Google Picker API
bigquery-json.googleapis.com   BigQuery API
chromewebstore.googleapis.com  Chrome Web Store API
tracing.googleapis.com         Google Tracing API
youtube.googleapis.com         YouTube Data API v3
actions.googleapis.com         Google Actions API
dataflow.googleapis.com        Google Dataflow API
serviceuser.googleapis.com     Google Service User API
fusiontables.googleapis.com    Fusion Tables API
surveys.googleapis.com         Surveys API

NAME                                 TITLE
reseller.googleapis.com              Google Apps Reseller API
speech.googleapis.com                Google Cloud Speech API
appsmarket-component.googleapis.com  Google Apps Marketplace SDK
bigtabletableadmin.googleapis.com    Google Cloud Bigtable Table Admin API
container.googleapis.com             Google Container Engine API
vision.googleapis.com                Google Cloud Vision API
storage-api.googleapis.com           Google Cloud Storage JSON API
weavecompanion.googleapis.com        Weave Companion API
ml.googleapis.com                    Google Cloud Machine Learning Engine
firebaserules.googleapis.com         Firebase Rules API

...

    最好还是检查您需要的特定可用API,例如检查我想要启用的Google Compute Engine API

    $ gcloud service-management list --available --filter='NAME:compute*' NAME TITLE compute-component.googleapis.com Google Compute Engine API

    为项目启用开票.

    $ gcloud alpha billing accounts projects link amghouse-some-project-1 --account-id=XXFFXX-B9XX37-2D5DX --format=json { "billingAccountName": "billingAccounts/XXFFXX-B9XX37-2D5DX", "billingEnabled": true, "name": "projects/amghouse-some-project-1 /billingInfo", "projectId": "amghouse-some-project-1 " }

    最后为您的项目启用api

`

$gcloud service-management enable compute-component.googleapis.com
Waiting for async operation operations/projectSettings.c6d11ddc-915f-4d66-9b98-237e473e7682 to complete...
Operation finished successfully. The following command can describe the Operation details:
 gcloud service-management operations describe operations/projectSettings.c6d11ddc-915f-4d66-9b98-237e473e7682

`

    并且为了更好的衡量,验证不会有害

`

$ gcloud service-management operations describe operations/projectSettings.c6d11ddc-915f-4d66-9b98-237e473e7682 --format=json
        {
          "done": true,
          "metadata": {
            "@type": "type.googleapis.com/google.api.servicemanagement.v1.OperationMetadata",
            "persisted": true,
            "resourceNames": [
              "services/compute-component.googleapis.com/projectSettings/"
            ],
            "startTime": "2017-04-08 23:30:22 WAT"
          },
          "name": "operations/projectSettings.c6d11ddc-915f-4d66-9b98-237e473e7682",
          "response": {
            "@type": "type.googleapis.com/google.api.servicemanagement.v1.EnableServiceResponse"
          }
        }

`

注意 请注意,如果没有将项目链接到计费信息,则尝试启用api将失败,并出现类似的错误

$ gcloud service-management enable compute-component.googleapis.com
ERROR: (gcloud.service-management.enable) FAILED_PRECONDITION: Operation does not satisfy the following requirements: billing-enabled {Billing must be enabled for activation of service '' in project 'amghouse-bct-sms-1' to proceed., https://console.developers.google.com/project/amghouse-bct-sms-1/settings}



3> Valentin..:

编辑:这已被弃用.见gcloud services答案.

看看service-management表面.有关gcloud help service-management更多帮助,请参阅gcloud help service-management enable有关启用新服务的帮助.使用gcloud service-management list列出可用的服务,让你可以找到你要启用的服务的名称.


"gcloud service-management"已被弃用,现在分为两个单独的命令 - "gcloud endpoints"和"gcloud services".后者(`gcloud services`)是用于为项目启用/禁用Google Cloud API的方法.
推荐阅读
  • SQL Server 2008 到底需要使用哪些端口?
    SQLServer2008到底需要使用哪些端口?-下面就来介绍下SQLServer2008中使用的端口有哪些:  首先,最常用最常见的就是1433端口。这个是数据库引擎的端口,如果 ... [详细]
  • Imtryingtofigureoutawaytogeneratetorrentfilesfromabucket,usingtheAWSSDKforGo.我正 ... [详细]
  • 本文介绍了如何使用PHP向系统日历中添加事件的方法,通过使用PHP技术可以实现自动添加事件的功能,从而实现全局通知系统和迅速记录工具的自动化。同时还提到了系统exchange自带的日历具有同步感的特点,以及使用web技术实现自动添加事件的优势。 ... [详细]
  • Android Studio Bumblebee | 2021.1.1(大黄蜂版本使用介绍)
    本文介绍了Android Studio Bumblebee | 2021.1.1(大黄蜂版本)的使用方法和相关知识,包括Gradle的介绍、设备管理器的配置、无线调试、新版本问题等内容。同时还提供了更新版本的下载地址和启动页面截图。 ... [详细]
  • 本文介绍了Hyperledger Fabric外部链码构建与运行的相关知识,包括在Hyperledger Fabric 2.0版本之前链码构建和运行的困难性,外部构建模式的实现原理以及外部构建和运行API的使用方法。通过本文的介绍,读者可以了解到如何利用外部构建和运行的方式来实现链码的构建和运行,并且不再受限于特定的语言和部署环境。 ... [详细]
  • ZSI.generate.Wsdl2PythonError: unsupported local simpleType restriction ... [详细]
  • SpringBoot整合SpringSecurity+JWT实现单点登录
    SpringBoot整合SpringSecurity+JWT实现单点登录,Go语言社区,Golang程序员人脉社 ... [详细]
  • 本文介绍了在go语言中利用(*interface{})(nil)传递参数类型的原理及应用。通过分析Martini框架中的injector类型的声明,解释了values映射表的作用以及parent Injector的含义。同时,讨论了该技术在实际开发中的应用场景。 ... [详细]
  • Summarize function is doing alignment without timezone ?
    Hi.Imtryingtogetsummarizefrom00:00otfirstdayofthismonthametric, ... [详细]
  • Flutter App 中创建模块并且依赖 Flutter
    在FlutterApp中打开对应的Android工程;并且向Android原生工程添加一个AndroidModule模块,并且在工程根settings. ... [详细]
  • UMTS基础知识汇总
    协议框架23G接口UMTS实体EntityNameDescriptionAuCAuthenticationCenterCBCCellBroadcastCenterC-RNCCon ... [详细]
  • FILETYPE*filetype.txt*ForVimversion6.4.文件类型*filetype**file-type*1.文件类型|filetypes|2.文件类型插 ... [详细]
  • 本文记录了在vue cli 3.x中移除console的一些采坑经验,通过使用uglifyjs-webpack-plugin插件,在vue.config.js中进行相关配置,包括设置minimizer、UglifyJsPlugin和compress等参数,最终成功移除了console。同时,还包括了一些可能出现的报错情况和解决方法。 ... [详细]
  • Android系统源码分析Zygote和SystemServer启动过程详解
    本文详细解析了Android系统源码中Zygote和SystemServer的启动过程。首先介绍了系统framework层启动的内容,帮助理解四大组件的启动和管理过程。接着介绍了AMS、PMS等系统服务的作用和调用方式。然后详细分析了Zygote的启动过程,解释了Zygote在Android启动过程中的决定作用。最后通过时序图展示了整个过程。 ... [详细]
  • return 语句竟然跳不出 for 循环?怎么肥事?
    松哥最近正在录制TienChin项目视频~采用SpringBoot+Vue3技术栈,里边会涉及到各种好玩 ... [详细]
author-avatar
zjymeimei706
这个家伙很懒,什么也没留下!
PHP1.CN | 中国最专业的PHP中文社区 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved | 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有