はじめに
下記ができる必要があります
- GCPのプロジェクトを作れる
- Admin Google管理者権限持ってる
作ったり消したり何回かしたので手順違うかもです
セットアップ
公式に従ってやりましょう
https://github.com/GAM-team/GAM/wiki
GAMのインストール
Ubuntu 20.04でやった例
$ bash <(curl -s -S -L https://gam-shortn.appspot.com/gam-install)
~省略~
Can you run a full browser on this machine? (usually Y for MacOS, N for Linux if you SSH into this machine) N # ← ここで「N」
GAM is now installed. Are you ready to set up a Google API project for GAM? (yes or no) no # ← 初回なのでここで「no」
You can create an API project later by running:
gam create project
Here's information about your new GAM installation:
GAM 6.31 - https://jaylee.us/gam - staticx
Jay Lee <jay0lee@gmail.com>
Python 3.11.0 64-bit final
google-api-python-client 2.66.0
Linux Ubuntu 20.04 Focal Fossa x86_64
Path: /home/ubuntu/bin/gam
Your system time differs from admin.googleapis.com by less than 1 second
OpenSSL 3.0.7 1 Nov 2022
cryptography 38.0.3
admin.googleapis.com connects using TLSv1.3 TLS_AES_256_GCM_SHA384
GAM installation and setup complete!
Please restart your terminal shell or to get started right away run:
function gam() { "/home/ubuntu/bin/gam/gam" "$@" ; }
# コマンドを使えるようにする
$ function gam() { "/home/ubuntu/bin/gam/gam" "$@" ; }
GAM用のGCPプロジェクト作る
GAM用のGCPプロジェクトを作る
請求アカウントを付けなくてもAPI使えたのでそのままにしてます
$ gam create project
What is your Google Workspace admin email address? メールアドレス入れる
Go to the following link in your browser:
URLが表示されるのでクリックする
~省略~
https://console.cloud.google.com/apis/credentials/oauthclient?project=プロジェクト
APIとサービスの認証情報が開くので
1. Choose "Desktop App" or "Other" for "Application type".
2. Enter a desired value for "Name" or leave as is.
3. Click the blue "Create" button.
4. Copy the "client ID" value that shows on the next page.
を実施してその後表示されるClientIDのところにIDを記載する
コマンドへ権限の委譲
$ gam info domain
~省略~
s) Select all scopes
u) Unselect all scopes
e) Exit without changes
c) Continue to authorization
Please enter 0-31[r|a] or s|u|e|c: c # ←「c」を入力
What is your Google Workspace admin email address? メールアドレス
Go to the following link in your browser:
URLが表示されるのでクリック
Google認証と許可の画面が表示される
これでいけるはず
お試しユーザリストの取得
$ gam print users