跳到主要內容

更新您的google cloud sdk

由於Google Cloud Platform的更新如火如荼
介紹一下更新的指令:"gcloud components update"
也許在使用舊版執行指令時候有發現
其實sdk會提示要做更新的動作...

$ gcloud components update
The following components will be removed:
    ----------------------------------------------------
    | App Engine SDK for Java |      1.8.6 | 144.29 MB |
    | Big Query CLI           |     2.0.16 |   1.38 MB |
    | Cloud SDK Core          | 2013.10.28 |   0.26 MB |
    | Cloud SDK Core (Extras) | 2013.10.25 |   0.00 MB |
    | Cloud Storage CLI       |       3.37 |   1.77 MB |
    | Compute Engine CLI      |     1.10.0 |   0.43 MB |
    ----------------------------------------------------
The following components will be installed:
    ----------------------------------------------------
    | App Engine SDK for Java |      1.8.7 | 144.70 MB |
    | Big Query CLI           |     2.0.17 |   1.38 MB |
    | Cloud SDK Core          | 2013.11.05 |   0.27 MB |
    | Cloud SDK Core (Extras) | 2013.11.05 |   0.00 MB |
    | Cloud Storage CLI       |       3.37 |   1.77 MB |
    | Compute Engine CLI      |     1.11.0 |   0.44 MB |
    ----------------------------------------------------
Do you want to continue (Y/n)?  Y
Creating update staging area...
Uninstalling core ... Done
Uninstalling core-nix ... Done
Uninstalling gcutil ... Done
...


然後也可以透過list的指令來列出目前安裝的個套件版本

$ gcloud components list
The following are the components available through the Google Cloud
SDK.  You may choose to install one or more of the pre-configured
packages (which contain everything you need to get started), and/or
any of the individual components below.
-------------------------------------------------------------------------------
|                                  Packages                                   |
|-----------------------------------------------------------------------------|
| Status        | Name                                 | ID            | Size |
|---------------+--------------------------------------+---------------+------|
| Not Installed | Cloud SDK for Go Developers (x86)    | pkg-go-x86    |      |
| Not Installed | Cloud SDK for Go Developers (x86_64) | pkg-go-x86_64 |      |
| Not Installed | Cloud SDK for Python Developers      | pkg-python    |      |
| Installed     | Cloud SDK for Java Developers        | pkg-java      |      |
-------------------------------------------------------------------------------

--------------------------------------------------------------------------------------------------
|                                     Individual Components                                      |
|------------------------------------------------------------------------------------------------|
| Status        | Name                                     | ID                      |      Size |
|---------------+------------------------------------------+-------------------------+-----------|
| Not Installed | App Engine Launcher Application for Mac  | gae-python-launcher-mac |   4.94 MB |
| Not Installed | App Engine SDK for Go (Mac OS X, x86)    | gae-go-darwin-x86       |  27.51 MB |
| Not Installed | App Engine SDK for Go (Mac OS X, x86_64) | gae-go-darwin-x86_64    |  27.75 MB |
| Not Installed | App Engine SDK for Python                | gae-python              |  37.01 MB |
| Installed     | App Engine SDK for Java                  | gae-java                | 144.70 MB |
| Installed     | Big Query CLI                            | bq                      |   1.38 MB |
| Installed     | Cloud SDK Core                           | core                    |   0.27 MB |
| Installed     | Cloud Storage CLI                        | gsutil                  |   1.77 MB |
| Installed     | Compute Engine CLI                       | gcutil                  |   0.44 MB |
--------------------------------------------------------------------------------------------------
To install new components or update existing ones, run:
 $ gcloud components update [component ids]

其他gcloud的指令可以透過-h來檢視help page喔∼

$ gcloud -h
usage: gcloud.py [-h] {auth,components,config} ...
Google Cloud Platform CLI/API
positional arguments:
  {auth,components,config}
    auth                Manage oauth2 credentials for the Google Cloud SDK.
    components          Install, update, or remove the tools in the Google
                        Cloud SDK.
    config              View and edit Google Cloud SDK properties.
optional arguments:
  -h, --help            show this help message and exit




留言

這個網誌中的熱門文章

透過Google Apps Script結合Google Form做即時郵件通知

體驗過Google Apps Script的功能後,也發現他結合GmailApps的模組 GmailApps的應用可以用在表單填寫完成後,做發信的通知 例如您開立了一個訂購的表單,為了要在第一時間通知商家有訂單進入 就可以直接呼叫Gmail做發信的通知,讓手持Smart Phone的我們可以很快的知道生意上門了! 下面規劃三個function,其中: onCommit():為form commit時候觸發的function,需要掛載於form commit trigger上 jsonArrToTable():目的將json array解析成為一個Table getLastRowTable():目的將整個table的回傳過濾為剩下第一筆(表頭,含有Form的欄位說明)與最後一筆(原則上就是剛剛送出的那一筆表單) 完整程式碼如下: function onCommit(){   var sheet = SpreadsheetApp.getActiveSheet();   var rows = sheet.getDataRange();   var numRows = rows.getNumRows();   var values = rows.getValues();   var content = getLastRowTable(values);   var htmlBody = "Hi Admin: <br/><br/>有訂單拉,檢查一下吧! <br/><br/>" + content + '<br/><br/>Send by Google Apps';   GmailApp.sendEmail(     " your-email-address@gmail.com ",      "Order Confirm Notice",      htmlBody,      {from: ' from-email-...

Apps Script連線MySQL或CloudSQL

Apps Script中連線資料庫也是使用jdbc connection string的方式來連結 感覺起來這邊似乎背後是透過GAE(畢竟也是Java Base的)來連線...(純猜的...) 下面先看看透過Apps Script來連線一般MySQL資料庫的方法: function testMySQL(){   var conn = Jdbc.getConnection('jdbc:mysql:// DB_IP_ADDRESS : DB_PORT / DB_NAME ', ' USERNAME ', ' PASSWORD ');     var stmt = conn.createStatement();   stmt.setMaxRows(100);   var start = new Date();   var sql = "select * from customers";   var rs = stmt.executeQuery(sql);   Logger.log('SQL:' + sql);   while(rs.next()){     Logger.log('['+new Date().toString() + ']' + rs.getString(1) + '::' + rs.getString(2) );   } } 上面範例中connection string的部份,DB_IP_ADDRESS為資料庫的IP位置,DB_PORT為資料庫的連線埠號,記得也把USERNAME與PASSWORD也改一下唷∼ 連線建立完成後,後面的操作也與Java版本相仿 透過建立statement之後,使用statment實體執行sql語句 最後透過result set將值fetch出來... 而Google的Cloud SQL也一樣可以在Apps Script中進行操作 操作之前,先了解一些資訊.... 在新的API Console中,我們可以找到Instance ID,這個值之後...

Google指令碼基本操作介紹 - Web Server篇

Google的指令碼是什麼東西呢?!原則上他就是Google的一份靜態檔案,但是透過Google的雲端服務平台的一些能力,將靜態檔案內的scriptlet片段拉到Google的後端作運算,寫起來就像在寫JavaScript(這邊說Node.js可能比較貼切,因為同為server side language)或JSP,而在scriptlet片段中,則可以操作許多Google的API服務,甚至他提供你連接JDBC的能力、URL呼叫的能力...等,宛如就是一套完整的雲端程式語言(這樣說應該不為過拉,這真是個創新!),有並駕於App Engine的氣勢喔! Google指令碼的範圍很廣,筆者也仍在摸索中,之前介紹過透過Sheet+指令碼做一個簡單的URL監控( 這裡 ),而本篇簡單介紹一下指令碼如何製作一個Web Server(嚴格說起來是Web Page拉,但是具備Server端運作功能喔!)。您將可以體驗到No-Hosting Web Server的威力! 指令碼是Google Drive的一個服務,Google將指令碼(Code)以檔案方式寄存在Drive中,類似的靜態檔案服務的應用,最近滿火紅的! 首先開啟指令碼時候,選擇"作為網路應用程式的指令碼",檔案開啟後,會有愈設定程式碼片段供編輯 程式碼片段大致上如下,是一個doGet function,Web base的指令碼需要認得doGet()作為server的進入點 如果選擇到空白專案的話,只要把doGet function建上即可 作為一個Cloud IDE,Google當然也有把Code Hint擺上來,透過簡單的提示,寫啟程是來就更容易拉! 而Web部分物件的建立主要是透過 HtmlService 這個模組來進行操作,我們利用他來output html, load static html page, load template html page..等,範例如下: Output HTML: // Script-as-app template. function doGet(e) {   return HtmlService. createHtmlOutput ("<h1>HELLO!</h1>...