設定角色
本文件提供路線最佳化功能的 Identity and Access Management (IAM) 角色和權限相關資訊。IAM 能讓您對特定 Route Optimization 資源授予精細的存取權,協助預防其他資源遭到存取;IAM 可讓您採用最小權限安全性原則,也就是規定使用者只能擁有實際所需的權限。
當主體 (使用者、群組或服務帳戶) 呼叫 Google Cloud API 時,該主體必須具備使用資源的適當 IAM 權限。如要將必要權限授予主體,請將 IAM 角色授予該主體。
如要熟悉 Google Cloud 的一般存取權管理方式,請參閱 IAM 總覽。
預先定義的 IAM 角色可讓授權者存取 Route Optimization,包括:
-
Route Optimization Editor (roles/routeoptimization.editor)
:授予使用者或服務帳戶對專案中路線最佳化資源的讀取和寫入權限。這包括呼叫 OptimizeTours
和 BatchOptimizeTours
的功能,以及使用 GetOperation
擷取長時間執行作業的功能。
-
Route Optimization Viewer (roles/routeoptimization.viewer)
:授予專案中路線最佳化資源的唯讀存取權。這個角色可讓您呼叫 OptimizeTours
,並使用 GetOperation
存取長時間執行作業。
您可以使用 Cloud SDK 為使用者主體建立繫結,藉此指派角色:
gcloud projects add-iam-policy-binding PROJECT \
--member user:someone@example.com \
--role roles/routeoptimization.editor
詳情請參閱「
使用 Google Cloud 控制台授予 IAM 角色」一文。
後續步驟
設定角色後,您必須建立 OAuth 權杖:
使用 OAuth
除非另有註明,否則本頁面中的內容是採用創用 CC 姓名標示 4.0 授權,程式碼範例則為阿帕契 2.0 授權。詳情請參閱《Google Developers 網站政策》。Java 是 Oracle 和/或其關聯企業的註冊商標。
上次更新時間:2024-12-03 (世界標準時間)。
[null,null,["上次更新時間:2024-12-03 (世界標準時間)。"],[[["Route Optimization utilizes Identity and Access Management (IAM) to control access to its resources, enabling you to grant specific permissions to users, groups, or service accounts."],["IAM roles like `Route Optimization Editor` and `Route Optimization Viewer` provide predefined permission sets for managing and viewing Route Optimization resources."],["Users or service accounts need appropriate IAM permissions to interact with Google Cloud APIs and use Route Optimization features like `OptimizeTours` and `BatchOptimizeTours`."],["The principle of least privilege is enforced by IAM, ensuring that users have only the necessary permissions for their tasks."],["After role configuration, an OAuth token is required for authentication when using Route Optimization."]]],["IAM roles control access to Route Optimization resources. Principals require appropriate IAM permissions to use Google Cloud APIs. The `Route Optimization Editor` role grants read/write access, including calling `OptimizeTours`, `BatchOptimizeTours`, and `GetOperation`. The `Route Optimization Viewer` role offers read-only access, enabling `OptimizeTours` and `GetOperation`. Roles are assigned to principals through IAM bindings in the Cloud SDK using `gcloud`. After roles are configured, you must create an OAuth token.\n"]]