GetWorkspaceAcrRamAuthorizeUrl - 获取 ACR 授权链接

更新时间:
复制 MD 格式

查询工作空间 ACR RAM 授权地址。

接口说明

ACR 与用户 OSS 挂载共用 Workspace 角色。无存量角色时使用 AliyunAgentCoreWorkspace-{workspaceId};存在有效旧 OSS 挂载角色时沿用并仅追加权限,不覆盖既有 OSS 策略。已固定的历史共享角色继续复用,不因新命名模板而重建或更名。必填 acrInstanceId、namespace、repository;地域与账号取 Workspace 上下文。返回后端解析的角色与目标仓库授权链接;不创建 ACR 或 Agent 执行版本、不下发运行时配置。完成授权后可 Verify,再创建或更新 Agent,无需调用独立 Ensure。

调试

您可以在OpenAPI Explorer中直接运行该接口,免去您计算签名的困扰。运行成功后,OpenAPI Explorer可以自动生成SDK代码示例。

调试

授权信息

下表是API对应的授权信息,可以在RAM权限策略语句的Action元素中使用,用来给RAM用户或RAM角色授予调用此API的权限。具体说明如下:

  • 操作:是指具体的权限点。

  • 访问级别:是指每个操作的访问级别,取值为写入(Write)、读取(Read)或列出(List)。

  • 资源类型:是指操作中支持授权的资源类型。具体说明如下:

    • 对于必选的资源类型,用前面加 * 表示。

    • 对于不支持资源级授权的操作,用全部资源表示。

  • 条件关键字:是指云产品自身定义的条件关键字。

  • 关联操作:是指成功执行操作所需要的其他权限。操作者必须同时具备关联操作的权限,操作才能成功。

操作

访问级别

资源类型

条件关键字

关联操作

agentcore:GetWorkspaceAcrRamAuthorizeUrl

get

*Workspace

acs:agentcore:{#regionId}:{#accountId}:workspace/{#WorkspaceId}

无 无

请求语法

GET /workspaces/{workspaceId}/acr/authorize HTTP/1.1

路径参数

名称

类型

必填

描述

示例值

workspaceId

string

是

工作空间 ID

ws-1234567890abcdef12345

请求参数

名称

类型

必填

描述

示例值

acrInstanceId

string

是

ACR 企业版实例 ID

cri-1234567890abcdef

namespace

string

是

目标 ACR 命名空间,对应 Agent artifact.container.namespace;不是 Kubernetes namespace。与实例和仓库一起确定授权范围。

example

repository

string

是

目标仓库名,对应 Agent artifact.container.repo;不包含 Tag、命名空间或路径分隔符。不接受通配符。

agent-image

返回参数

名称

类型

描述

示例值

object

查询工作空间 ACR RAM 授权地址响应

code

string

业务状态码

SUCCESS

data

object

响应数据

acrInstanceId

string

ACR 企业版实例 ID

cri-1234567890abcdef

authorizeUrl

string

为共享角色创建或追加目标 ACR 权限的 RAM 授权地址

https://ram.console.aliyun.com/authorize?request=%7B%22referrer%22%3A%22AgentCore%22%2C%22payloads%22%3A%5B%7B%22missionId%22%3A%22AgentCore.CustomRoleForOSSObjectRestore%22%2C%22roleName%22%3A%22AliyunAgentCoreWorkspace-ws-1234567890abcdef12345%22%2C%22rolePolicies%22%3A%5B%7B%22policyName%22%3A%22AgentCoreAcrPull-63373f3802583663d49465d8061e410a899d8f2936b8fc0cb9ec905b71f273c6%22%2C%22policyType%22%3A%22Custom%22%2C%22templateId%22%3A%22CrPullInstanceImage%22%2C%22templateValue%22%3A%7B%22crInstance%22%3A%22acs%3Acr%3Acn-hangzhou%3A1234567890123456%3Ainstance%2Fcri-1234567890abcdef%22%2C%22crRepository%22%3A%22acs%3Acr%3Acn-hangzhou%3A1234567890123456%3Arepository%2Fcri-1234567890abcdef%2Fexample%2Fagent-image%22%7D%7D%5D%7D%5D%7D

roleName

string

后端选定的共享角色名;前端不可编辑

AliyunAgentCoreWorkspace-ws-1234567890abcdef12345

roleSource

string

共享角色来源,不代表授权已完成

WORKSPACE_SHARED

workspaceId

string

工作空间 ID

ws-1234567890abcdef12345

httpStatusCode

integer

HTTP 状态码

200

message

string

响应消息

success

requestId

string

请求 ID

12345678-1234-1234-1234-123456789012

success

boolean

请求是否成功

true

示例

正常返回示例

JSON格式

{
  "code": "SUCCESS",
  "data": {
    "acrInstanceId": "cri-1234567890abcdef",
    "authorizeUrl": "https://ram.console.aliyun.com/authorize?request=%7B%22referrer%22%3A%22AgentCore%22%2C%22payloads%22%3A%5B%7B%22missionId%22%3A%22AgentCore.CustomRoleForOSSObjectRestore%22%2C%22roleName%22%3A%22AliyunAgentCoreWorkspace-ws-1234567890abcdef12345%22%2C%22rolePolicies%22%3A%5B%7B%22policyName%22%3A%22AgentCoreAcrPull-63373f3802583663d49465d8061e410a899d8f2936b8fc0cb9ec905b71f273c6%22%2C%22policyType%22%3A%22Custom%22%2C%22templateId%22%3A%22CrPullInstanceImage%22%2C%22templateValue%22%3A%7B%22crInstance%22%3A%22acs%3Acr%3Acn-hangzhou%3A1234567890123456%3Ainstance%2Fcri-1234567890abcdef%22%2C%22crRepository%22%3A%22acs%3Acr%3Acn-hangzhou%3A1234567890123456%3Arepository%2Fcri-1234567890abcdef%2Fexample%2Fagent-image%22%7D%7D%5D%7D%5D%7D",
    "roleName": "AliyunAgentCoreWorkspace-ws-1234567890abcdef12345",
    "roleSource": "WORKSPACE_SHARED",
    "workspaceId": "ws-1234567890abcdef12345"
  },
  "httpStatusCode": 200,
  "message": "success",
  "requestId": "12345678-1234-1234-1234-123456789012",
  "success": true
}

错误码

HTTP status code

错误码

错误信息

描述

400 InvalidParameter The specified request parameter is invalid.
400 AcrEditionUnsupported The ACR edition is not supported.
400 AcrAccountUnsupported The ACR account is not supported.
400 AcrRegionUnsupported The ACR region is not supported.
403 Forbidden The caller is not allowed to access the specified workspace.
404 Resource.NotFound The specified workspace or ACR operation does not exist.
503 AcrAuthorizationServiceUnavailable The authorization service is temporarily unavailable.
409 AcrRamUnauthorized The shared role is not authorized for the specified ACR instance.
409 AcrRoleConflict The workspace has conflicting authorization role references.
409 AcrPrerequisiteNotReady The workspace is not ready for private image access.
409 AcrCapacityUnsupported The workspace capacity mode is not supported.
409 WorkspaceDeleting The workspace is being deleted.

访问错误中心查看更多错误码。

变更历史

更多信息,参考变更详情。