更新时间:2024-04-29 GMT+08:00
分享

提交合约

功能介绍

提交合约。

URI

POST /v1/{project_id}/eds/instances/{instance_id}/connectors/{connector_id}/contracts

表1 路径参数

参数

是否必选

参数类型

描述

instance_id

String

实例ID,开通的数据交换平台实例ID。

获取方法请参考获取实例ID

connector_id

String

连接器ID,指定数据交换平台下连接器的ID。

获取方法请参考获取连接器ID

project_id

String

项目ID。

获取方法请参考获取项目ID

请求参数

表2 请求Header参数

参数

是否必选

参数类型

描述

X-Auth-Token

String

用户Token,通过调用IAM服务获取用户Token接口获取(响应消息头中X-Subject-Token的值)。

表3 请求Body参数

参数

是否必选

参数类型

描述

contract_name

String

合约名称。

contract_description

String

合约描述。

owner_connector_id

String

提供者连接器ID。

subscribe_connector_id

String

订阅连接器ID。

subscriber_id

String

订阅人ID。

approver_id

String

审批人ID。

offer_id

String

Offer ID。

need_approval

Boolean

是否需要审批。

注:开启【需要审批】后,下载合约资源的加工产物时需要审批。

can_terminate

Boolean

是否允许提供方删除数据。

use_control_policies

Array of UseControlPoliciesInner objects

合约使用控制策略列表。

表4 UseControlPoliciesInner

参数

是否必选

参数类型

描述

action

String

执行动作过滤:

  • VIEW:查看
  • MODIFY:加工
  • DOWNLOAD:下载

枚举值:

  • VIEW
  • MODIFY
  • DOWNLOAD

when

TimeInterval object

限制使用时间。

how_many

Integer

限制使用次数。

where

Array of strings

限制地点列表。

who

Array of strings

限制用户列表。

application

Array of strings

限制应用列表。

additional_attributes

DatabaseAttributes

object

策略的扩展属性。

user_type

String

限制用户类型。

  • USER :指定用户
  • TEAM :指定团队

枚举值:

  • USER
  • TEAM
表5 TimeInterval

参数

参数类型

描述

start_time

String

起始时间。

end_time

String

截止时间。

表6 DatabaseAttributes

参数

参数类型

描述

column

String

可见行。

rows

Arrays of RowDTO

可见列。

表7 RowDTO

参数

参数类型

描述

column_name

String

参数名称。

condition

String

参数条件。

value

String

参数条件值。

响应参数

状态码: 200

表8 响应Body参数

参数

参数类型

描述

data

ContractResult object

返回数据。

total

Long

总数。

error_code

String

错误码。

error_msg

String

错误描述。

表9 ContractResult

参数

参数类型

描述

contract_id

String

合约ID。

contract_name

String

合约名称。

result_code

String

操作结果返回码:

  • SUCCESS:操作成功
  • FAILED:操作失败

枚举值:

  • SUCCESS
  • FAILED

result_description

String

操作结果描述。

状态码: 400

表10 响应Body参数

参数

参数类型

描述

data

-

返回null

total

Long

总数。

error_code

String

错误码。

error_msg

String

错误描述。

状态码: 500

表11 响应Body参数

参数

参数类型

描述

data

-

返回null

total

Long

总数。

error_code

String

错误码。

error_msg

String

错误描述。

请求示例

提交合约。

POST https://{endpoint}/v1/{project_id}/eds/instances/{instance_id}/connectors/{connector_id}/contracts

{
  "contract_name" : "测试合约3",
  "approver_id" : "************",
  "offer_id" : "fbf85846-3782-46dc-affb-************",
  "owner_connector_id" : "b40b0d94-3201-4687-93aa-************",
  "subscribe_connector_id" : "c1bf9bd7-52fc-435b-ae55-************",
  "subscriber_id" : "************",
  "need_approval" : false,
  "can_terminate" : true,
  "use_control_policies" : [ {
    "action" : "VIEW",
    "when" : {
      "start_time" : "2023-11-16T18:18:14Z",
      "end_time" : "2023-12-16T18:18:14Z"
    },
    "how_many" : null,
    "where" : [ ],
    "who" : [ "************" ],
    "user_type" : null,
    "application" : [ "321ac118-758e-4324-9d41-************" ],
    "additional_attributes" : {
      "column" : "id,category",
      "rows" : [ {
        "column_name" : "id",
        "condition" : "!=",
        "value" : "1"
      } ]
    }
  }, {
    "action" : "DOWNLOAD",
    "when" : {
      "start_time" : "2023-11-16T18:18:14Z",
      "end_time" : "2023-12-16T18:18:14Z"
    },
    "how_many" : null,
    "where" : [ ],
    "who" : [ "************" ],
    "user_type" : null,
    "application" : [ "dae4237f-9880-4fb9-a618-************" ],
    "additional_attributes" : 
    {
       "column": null,
       "rows": null       
    }
  }, {
    "action" : "MODIFY",
    "when" : {
      "start_time" : "2023-11-16T18:18:14Z",
      "end_time" : "2023-12-16T18:18:14Z"
    },
    "how_many" : null,
    "where" : [ ],
    "who" : [ "************" ],
    "user_type" : null,
    "application" : [ "dae4237f-9880-4fb9-a618-************" ],
    "additional_attributes" : 
   {
       "column": null,
       "rows": null       
    }
  } ],
  "contract_description" : "OpenApi demo."
}

响应示例

状态码: 200

OK

  • 提交合约返回结构体。
    {
      "data" : {
        "contract_id" : "AGRTconnector-****3b53a05caccd4c53b509************",
        "contract_name" : "测试合约3",
        "result_code" : "SUCCESS",
        "result_description" : "success"
      },
      "total" : 0,
      "error_code" : null,
      "error_msg" : null
    }

状态码

状态码

描述

200

OK

400

Bad Request

500

Internal Server Error

错误码

请参见错误码

分享:

    相关文档

    相关产品