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

获取同步权限策略

功能介绍

获取同步权限策略。

调试

您可以在API Explorer中调试该接口,支持自动认证鉴权。API Explorer可以自动生成SDK代码示例,并提供SDK代码示例调试功能。

URI

GET /v1/{project_id}/instances/{instance_id}/policies/policy

表1 路径参数

参数

是否必选

参数类型

描述

project_id

String

项目编号。获取方法,请参见获取项目ID

instance_id

String

LakeFormation实例ID。创建实例时自动生成。例如:2180518f-42b8-4947-b20b-adfc53981a25。

表2 Query参数

参数

是否必选

参数类型

描述

last_known_version

Long

最新已知版本。

supports_policy_deltas

Boolean

是否支持增量同步策略。默认为false。

is_return_policy_data

Boolean

是否返回权限策略数据。默认为true。

catalog_name

String

catalog名称。只能包含字母、数字和下划线,且长度为1~256个字符。

请求参数

表3 请求Header参数

参数

是否必选

参数类型

描述

X-Auth-Token

Array of strings

租户token。

响应参数

状态码: 200

表4 响应Body参数

参数

参数类型

描述

policy_version

Long

策略版本。

policy_updateTime

String

策略更新时间。

policies

Array of Policy objects

权限策略信息。

policy_deltas

Array of PolicyDelta objects

增量权限策略信息。

表5 Policy

参数

参数类型

描述

allow_exceptions

Array of PolicyItem objects

排除的允许策略。

conditions

Array of PolicyItemCondition objects

条件属性。

create_time

String

创建时间。

created_by

String

创建者。

data_mask_policy_items

Array of DataMaskPolicyItem objects

类掩码策略条目。

deny_exceptions

Array of PolicyItem objects

拒绝排除策略。

deny_policy_items

Array of PolicyItem objects

拒绝策略。

description

String

描述。

guid

String

唯一guid。

id

Long

主键。

is_audit_enabled

Boolean

是否支持审计。

is_default_policy

Boolean

是否默认策略。

is_deny_all_else

Boolean

是否拒绝所有。

is_enabled

Boolean

是否启动。

name

String

名。

options

Object

选项。

policy_items

Array of PolicyItem objects

策略信息数组。

policy_labels

Array of strings

策略便签。

policy_priority

Integer

策略优先级。

policy_type

Integer

策略类型。

resource_signature

String

资源签名。

resources

Map<String,PolicyResource>

资源。

row_filter_policy_items

Array of RowFilterPolicyItem objects

行过滤策略条目。

service

String

服务。

service_type

String

服务类型。

update_time

String

更新时间。

updated_by

String

更新者。

validity_schedules

Array of ValiditySchedule objects

验证周期。

version

Long

版本。

zone_name

String

域。

表6 PolicyDelta

参数

参数类型

描述

policy

Policy object

策略信息。

change_type

Integer

变更类型。

表7 DataMaskPolicyItem

参数

参数类型

描述

accesses

Array of PolicyItemAccess objects

访问数组。

conditions

Array of PolicyItemCondition objects

条件数组。

data_mask_info

PolicyItemDataMaskInfo object

列掩码策略信息。

delegate_admin

Boolean

是否支持传递。

groups

Array of strings

用户组。

roles

Array of strings

角色。

users

Array of strings

用户。

表8 PolicyItemDataMaskInfo

参数

参数类型

描述

condition_expr

String

条件表达式。

data_mask_type

String

列掩码类型。

value_expr

String

列掩码表达式。

表9 PolicyItem

参数

参数类型

描述

accesses

Array of PolicyItemAccess objects

访问控制数据。

conditions

Array of PolicyItemCondition objects

条件。

delegate_admin

Boolean

是否传递。

groups

Array of strings

组。

roles

Array of strings

角色。

users

Array of strings

用户。

表10 PolicyResource

参数

参数类型

描述

is_excludes

Boolean

是否排除。

is_recursive

Boolean

是否递归。

values

Array of strings

值。

表11 RowFilterPolicyItem

参数

参数类型

描述

accesses

Array of PolicyItemAccess objects

权限。

conditions

Array of PolicyItemCondition objects

条件。

delegate_admin

Boolean

是否传递。

groups

Array of strings

组。

roles

Array of strings

角色。

row_filter_info

PolicyItemRowFilterInfo object

行过滤。

users

Array of strings

用户。

表12 PolicyItemAccess

参数

参数类型

描述

is_allowed

Boolean

是否允许。

type

String

类型。

表13 PolicyItemCondition

参数

参数类型

描述

type

String

条件类型。

values

Array of strings

条件值。

表14 PolicyItemRowFilterInfo

参数

参数类型

描述

filter_expr

String

行过滤表达式。

表15 ValiditySchedule

参数

参数类型

描述

end_time

String

end时间。

recurrences

Array of ValidityRecurrence objects

策略递归。

start_time

String

开始时间。

time_zone

String

时间域。

表16 ValidityRecurrence

参数

参数类型

描述

interval

ValidityInterval object

时间间隔。

schedule

RecurrenceSchedule object

周期。

表17 ValidityInterval

参数

参数类型

描述

days

Integer

日。

hours

Integer

时。

minutes

Integer

分。

表18 RecurrenceSchedule

参数

参数类型

描述

day_of_month

String

日期按月。

day_of_week

String

日期按星期。

hour

String

时。

minute

String

分。

month

String

月。

year

String

年。

状态码: 400

表19 响应Body参数

参数

参数类型

描述

error_code

String

错误码。

error_msg

String

错误描述。

solution_msg

String

解决方案描述。

状态码: 404

表20 响应Body参数

参数

参数类型

描述

error_code

String

错误码。

error_msg

String

错误描述。

solution_msg

String

解决方案描述。

状态码: 500

表21 响应Body参数

参数

参数类型

描述

error_code

String

错误码。

error_msg

String

错误描述。

solution_msg

String

解决方案描述。

请求示例

GET https://{endpoint}/v1/{project_id}/instances/{instance_id}/policies/policy

响应示例

状态码: 200

OK

{
  "policy_version" : 217,
  "policy_updateTime" : "1657788005000",
  "policies" : [ {
    "allow_exceptions" : [ ],
    "data_mask_policy_items" : [ ],
    "deny_exceptions" : [ ],
    "deny_policy_items" : [ {
      "accesses" : [ {
        "is_allowed" : true,
        "type" : "select"
      } ],
      "conditions" : [ {
        "type" : "ip-range",
        "values" : [ "*.*.*.*" ]
      } ],
      "delegate_admin" : false,
      "groups" : [ "groupD" ],
      "roles" : [ ],
      "users" : [ ]
    } ],
    "id" : 39,
    "is_audit_enabled" : true,
    "is_default_policy" : false,
    "is_deny_all_else" : false,
    "is_enabled" : true,
    "name" : "database_a.test.[**]-table_all_column",
    "options" : { },
    "policy_items" : [ {
      "accesses" : [ {
        "is_allowed" : true,
        "type" : "select"
      } ],
      "conditions" : [ ],
      "delegate_admin" : true,
      "groups" : [ "groupA" ],
      "roles" : [ ],
      "users" : [ ]
    }, {
      "accesses" : [ {
        "is_allowed" : true,
        "type" : "select"
      } ],
      "conditions" : [ ],
      "delegate_admin" : true,
      "groups" : [ "groupB" ],
      "roles" : [ ],
      "users" : [ ]
    } ],
    "policy_labels" : [ ],
    "policy_priority" : 0,
    "policy_type" : 0,
    "resources" : {
      "database" : {
        "is_excludes" : false,
        "is_recursive" : false,
        "values" : [ "database_a" ]
      },
      "column" : {
        "is_excludes" : false,
        "is_recursive" : false,
        "values" : [ "**" ]
      },
      "table" : {
        "is_excludes" : false,
        "is_recursive" : false,
        "values" : [ "test" ]
      }
    },
    "row_filter_policy_items" : [ ],
    "service" : "Hive",
    "service_type" : "hive",
    "validity_schedules" : [ ]
  } ]
}

状态码: 400

Bad Request

{
  "error_code" : "common.01000001",
  "error_msg" : "failed to read http request, please check your input, code: 400, reason: Type mismatch., cause: TypeMismatchException"
}

状态码: 401

Unauthorized

{
  "error_code": 'APIG.1002',
  "error_msg": 'Incorrect token or token resolution failed'
}

状态码: 403

Forbidden

{
  "error" : {
    "code" : "403",
    "message" : "X-Auth-Token is invalid in the request",
    "error_code" : null,
    "error_msg" : null,
    "title" : "Forbidden"
  },
  "error_code" : "403",
  "error_msg" : "X-Auth-Token is invalid in the request",
  "title" : "Forbidden"
}

状态码: 404

Not Found

{
  "error_code" : "common.01000001",
  "error_msg" : "response status exception, code: 404"
}

状态码: 408

Request Timeout

{
  "error_code" : "common.00000408",
  "error_msg" : "timeout exception occurred"
}

状态码: 500

Internal Server Error

{
  "error_code" : "common.00000500",
  "error_msg" : "internal error"
}

状态码

状态码

描述

200

OK

400

Bad Request

401

Unauthorized

403

Forbidden

404

Not Found

408

Request Timeout

500

Internal Server Error

错误码

请参见错误码

分享:

    相关文档

    相关产品