Skip to content

Commit e98604e

Browse files
authored
chore: protocol update (#163)
* chore: proto update * chore: update docs * fix: ci * fix: test * chore: drop risk * chore: update * fix: lint * chore: protocol update * chore: update * chore: update
1 parent 6d02eb6 commit e98604e

25 files changed

+632
-454
lines changed

docs/data-sources/setting.md

Lines changed: 18 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,11 @@ The setting data source.
1717

1818
### Required
1919

20-
- `name` (String) The setting name in settings/{name} format. The name support "WORKSPACE_APPROVAL", "WORKSPACE_PROFILE", "DATA_CLASSIFICATION", "SEMANTIC_TYPES", "ENVIRONMENT", "PASSWORD_RESTRICTION", "SQL_RESULT_SIZE_LIMIT". Check the proto https://github.com/bytebase/bytebase/blob/main/proto/v1/v1/setting_service.proto#L109 for details
20+
- `name` (String) The setting name in settings/{name} format. The name support "WORKSPACE_APPROVAL", "WORKSPACE_PROFILE", "DATA_CLASSIFICATION", "SEMANTIC_TYPES", "ENVIRONMENT". Check the proto https://github.com/bytebase/bytebase/blob/main/proto/v1/v1/setting_service.proto#L109 for details
2121

2222
### Optional
2323

2424
- `classification` (Block List, Max: 1) Classification for data masking. Require ENTERPRISE subscription. (see [below for nested schema](#nestedblock--classification))
25-
- `password_restriction` (Block List, Max: 1) Restrict for login password (see [below for nested schema](#nestedblock--password_restriction))
2625
- `semantic_types` (Block Set) Semantic types for data masking. Require ENTERPRISE subscription. (see [below for nested schema](#nestedblock--semantic_types))
2726
- `workspace_profile` (Block List, Max: 1) (see [below for nested schema](#nestedblock--workspace_profile))
2827

@@ -42,10 +41,6 @@ Required:
4241
- `levels` (Block Set, Min: 1) (see [below for nested schema](#nestedblock--classification--levels))
4342
- `title` (String) The classification title. Optional.
4443

45-
Optional:
46-
47-
- `classification_from_config` (Boolean) If true, we will only store the classification in the config. Otherwise we will get the classification from table/column comment, and write back to the schema metadata.
48-
4944
<a id="nestedblock--classification--classifications"></a>
5045
### Nested Schema for `classification.classifications`
5146

@@ -74,20 +69,6 @@ Optional:
7469

7570

7671

77-
<a id="nestedblock--password_restriction"></a>
78-
### Nested Schema for `password_restriction`
79-
80-
Optional:
81-
82-
- `min_length` (Number) min_length is the minimum length for password, should no less than 8.
83-
- `password_rotation_in_seconds` (Number) password_rotation requires users to reset their password after the duration. The duration should be at least 86400 (one day).
84-
- `require_letter` (Boolean) require_letter requires the password must contains at least one letter, regardless of upper case or lower case.
85-
- `require_number` (Boolean) require_number requires the password must contains at least one number.
86-
- `require_reset_password_for_first_login` (Boolean) require_reset_password_for_first_login requires users to reset their password after the 1st login.
87-
- `require_special_character` (Boolean) require_special_character requires the password must contains at least one special character.
88-
- `require_uppercase_letter` (Boolean) require_uppercase_letter requires the password must contains at least one upper case letter.
89-
90-
9172
<a id="nestedblock--semantic_types"></a>
9273
### Nested Schema for `semantic_types`
9374

@@ -164,6 +145,7 @@ Required:
164145
Optional:
165146

166147
- `announcement` (Block List, Max: 1) Custom announcement. Will show as a banner in the Bytebase UI. Require ENTERPRISE subscription. (see [below for nested schema](#nestedblock--workspace_profile--announcement))
148+
- `branding_logo` (String) The branding logo as a data URI (e.g. data:image/png;base64,...).
167149
- `database_change_mode` (String) The workspace database change mode, support EDITOR or PIPELINE. Default PIPELINE
168150
- `disallow_password_signin` (Boolean) Whether to disallow password signin (except workspace admins). Require ENTERPRISE subscription
169151
- `disallow_signup` (Boolean) Disallow self-service signup, users can only be invited by the owner. Require PRO subscription.
@@ -172,7 +154,9 @@ Optional:
172154
- `enforce_identity_domain` (Boolean) Only user and group from the domains can be created and login.
173155
- `external_url` (String) The URL user visits Bytebase. The external URL is used for: 1. Constructing the correct callback URL when configuring the VCS provider. The callback URL points to the frontend; 2. Creating the correct webhook endpoint when configuring the project GitOps workflow. The webhook endpoint points to the backend.
174156
- `maximum_role_expiration_in_seconds` (Number) The max duration in seconds for role expired. If the value is less than or equal to 0, we will remove the setting. AKA no limit.
157+
- `password_restriction` (Block List, Max: 1) Password restriction settings. (see [below for nested schema](#nestedblock--workspace_profile--password_restriction))
175158
- `token_duration_in_seconds` (Number) The duration for login token in seconds. The duration should be at least 3600 (one hour).
159+
- `watermark` (Boolean) Whether to display watermark on pages. Requires ENTERPRISE license.
176160

177161
<a id="nestedblock--workspace_profile--announcement"></a>
178162
### Nested Schema for `workspace_profile.announcement`
@@ -184,6 +168,20 @@ Optional:
184168
- `text` (String) The text of announcement. Leave it as empty string can clear the announcement
185169

186170

171+
<a id="nestedblock--workspace_profile--password_restriction"></a>
172+
### Nested Schema for `workspace_profile.password_restriction`
173+
174+
Optional:
175+
176+
- `min_length` (Number) min_length is the minimum length for password, should be no less than 8.
177+
- `password_rotation_in_seconds` (Number) password_rotation requires users to reset their password after the duration. The duration should be at least 86400 (one day).
178+
- `require_letter` (Boolean) require_letter requires the password must contain at least one letter, regardless of upper case or lower case.
179+
- `require_number` (Boolean) require_number requires the password must contain at least one number.
180+
- `require_reset_password_for_first_login` (Boolean) require_reset_password_for_first_login requires users to reset their password after the 1st login.
181+
- `require_special_character` (Boolean) require_special_character requires the password must contain at least one special character.
182+
- `require_uppercase_letter` (Boolean) require_uppercase_letter requires the password must contain at least one upper case letter.
183+
184+
187185

188186
<a id="nestedblock--approval_flow"></a>
189187
### Nested Schema for `approval_flow`

docs/data-sources/user.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ The user data source.
1717

1818
### Required
1919

20-
- `name` (String) The user name in users/{user id or email} format.
20+
- `name` (String) The user name in users/{email} format.
2121

2222
### Read-Only
2323

docs/resources/review_config.md

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,28 @@ Required:
4141

4242
Optional:
4343

44-
- `comment` (String) The comment for the rule.
45-
- `payload` (String) The payload is a JSON string that varies by rule type. Check https://github.com/bytebase/bytebase/blob/main/proto/v1/v1/SQL_REVIEW_RULES_DOCUMENTATION.md#payload-structure-types for all details
44+
- `comment_convention_payload` (Block List, Max: 1) Comment convention payload for rules: COLUMN_COMMENT, TABLE_COMMENT. (see [below for nested schema](#nestedblock--rules--comment_convention_payload))
45+
- `naming_case_payload` (Boolean) Naming case payload for rule: NAMING_IDENTIFIER_CASE. Set to true for UPPER case, false for LOWER case.
46+
- `naming_payload` (Block List, Max: 1) Naming payload for rules: NAMING_TABLE, NAMING_COLUMN, NAMING_COLUMN_AUTO_INCREMENT, NAMING_INDEX_FK, NAMING_INDEX_IDX, NAMING_INDEX_UK, NAMING_INDEX_PK, TABLE_DROP_NAMING_CONVENTION. (see [below for nested schema](#nestedblock--rules--naming_payload))
47+
- `number_payload` (Number) Number payload for rules: STATEMENT_INSERT_ROW_LIMIT, STATEMENT_AFFECTED_ROW_LIMIT, STATEMENT_WHERE_MAXIMUM_LOGICAL_OPERATOR_COUNT, STATEMENT_MAXIMUM_LIMIT_VALUE, STATEMENT_MAXIMUM_JOIN_TABLE_COUNT, STATEMENT_MAXIMUM_STATEMENTS_IN_TRANSACTION, COLUMN_MAXIMUM_CHARACTER_LENGTH, COLUMN_MAXIMUM_VARCHAR_LENGTH, COLUMN_AUTO_INCREMENT_INITIAL_VALUE, INDEX_KEY_NUMBER_LIMIT, INDEX_TOTAL_NUMBER_LIMIT, TABLE_TEXT_FIELDS_TOTAL_LENGTH, TABLE_LIMIT_SIZE, SYSTEM_COMMENT_LENGTH, ADVICE_ONLINE_MIGRATION.
48+
- `string_array_payload` (List of String) String array payload for rules: COLUMN_REQUIRED, COLUMN_TYPE_DISALLOW_LIST, INDEX_PRIMARY_KEY_TYPE_ALLOWLIST, INDEX_TYPE_ALLOW_LIST, SYSTEM_CHARSET_ALLOWLIST, SYSTEM_COLLATION_ALLOWLIST, SYSTEM_FUNCTION_DISALLOWED_LIST, TABLE_DISALLOW_DDL, TABLE_DISALLOW_DML.
49+
- `string_payload` (String) String payload for rule: STATEMENT_QUERY_MINIMUM_PLAN_LEVEL.
50+
51+
<a id="nestedblock--rules--comment_convention_payload"></a>
52+
### Nested Schema for `rules.comment_convention_payload`
53+
54+
Optional:
55+
56+
- `max_length` (Number) The maximum length for the comment.
57+
- `required` (Boolean) Whether the comment is required.
58+
59+
60+
<a id="nestedblock--rules--naming_payload"></a>
61+
### Nested Schema for `rules.naming_payload`
62+
63+
Optional:
64+
65+
- `format` (String) The naming format regex pattern.
66+
- `max_length` (Number) The maximum length for the name.
4667

4768

docs/resources/setting.md

Lines changed: 18 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,13 @@ The setting resource.
1717

1818
### Required
1919

20-
- `name` (String) The setting name in settings/{name} format. The name support "WORKSPACE_APPROVAL", "WORKSPACE_PROFILE", "DATA_CLASSIFICATION", "SEMANTIC_TYPES", "ENVIRONMENT", "PASSWORD_RESTRICTION", "SQL_RESULT_SIZE_LIMIT". Check the proto https://github.com/bytebase/bytebase/blob/main/proto/v1/v1/setting_service.proto#L109 for details
20+
- `name` (String) The setting name in settings/{name} format. The name support "WORKSPACE_APPROVAL", "WORKSPACE_PROFILE", "DATA_CLASSIFICATION", "SEMANTIC_TYPES", "ENVIRONMENT". Check the proto https://github.com/bytebase/bytebase/blob/main/proto/v1/v1/setting_service.proto#L109 for details
2121

2222
### Optional
2323

2424
- `approval_flow` (Block List) Configure risk level and approval flow for different tasks. Require ENTERPRISE subscription. (see [below for nested schema](#nestedblock--approval_flow))
2525
- `classification` (Block List, Max: 1) Classification for data masking. Require ENTERPRISE subscription. (see [below for nested schema](#nestedblock--classification))
2626
- `environment_setting` (Block List) The environment (see [below for nested schema](#nestedblock--environment_setting))
27-
- `password_restriction` (Block List, Max: 1) Restrict for login password (see [below for nested schema](#nestedblock--password_restriction))
2827
- `semantic_types` (Block Set) Semantic types for data masking. Require ENTERPRISE subscription. (see [below for nested schema](#nestedblock--semantic_types))
2928
- `workspace_profile` (Block List, Max: 1) (see [below for nested schema](#nestedblock--workspace_profile))
3029

@@ -73,10 +72,6 @@ Required:
7372
- `levels` (Block Set, Min: 1) (see [below for nested schema](#nestedblock--classification--levels))
7473
- `title` (String) The classification title. Optional.
7574

76-
Optional:
77-
78-
- `classification_from_config` (Boolean) If true, we will only store the classification in the config. Otherwise we will get the classification from table/column comment, and write back to the schema metadata.
79-
8075
<a id="nestedblock--classification--classifications"></a>
8176
### Nested Schema for `classification.classifications`
8277

@@ -131,20 +126,6 @@ Read-Only:
131126

132127

133128

134-
<a id="nestedblock--password_restriction"></a>
135-
### Nested Schema for `password_restriction`
136-
137-
Optional:
138-
139-
- `min_length` (Number) min_length is the minimum length for password, should no less than 8.
140-
- `password_rotation_in_seconds` (Number) password_rotation requires users to reset their password after the duration. The duration should be at least 86400 (one day).
141-
- `require_letter` (Boolean) require_letter requires the password must contains at least one letter, regardless of upper case or lower case.
142-
- `require_number` (Boolean) require_number requires the password must contains at least one number.
143-
- `require_reset_password_for_first_login` (Boolean) require_reset_password_for_first_login requires users to reset their password after the 1st login.
144-
- `require_special_character` (Boolean) require_special_character requires the password must contains at least one special character.
145-
- `require_uppercase_letter` (Boolean) require_uppercase_letter requires the password must contains at least one upper case letter.
146-
147-
148129
<a id="nestedblock--semantic_types"></a>
149130
### Nested Schema for `semantic_types`
150131

@@ -221,6 +202,7 @@ Required:
221202
Optional:
222203

223204
- `announcement` (Block List, Max: 1) Custom announcement. Will show as a banner in the Bytebase UI. Require ENTERPRISE subscription. (see [below for nested schema](#nestedblock--workspace_profile--announcement))
205+
- `branding_logo` (String) The branding logo as a data URI (e.g. data:image/png;base64,...).
224206
- `database_change_mode` (String) The workspace database change mode, support EDITOR or PIPELINE. Default PIPELINE
225207
- `disallow_password_signin` (Boolean) Whether to disallow password signin (except workspace admins). Require ENTERPRISE subscription
226208
- `disallow_signup` (Boolean) Disallow self-service signup, users can only be invited by the owner. Require PRO subscription.
@@ -229,7 +211,9 @@ Optional:
229211
- `enforce_identity_domain` (Boolean) Only user and group from the domains can be created and login.
230212
- `external_url` (String) The URL user visits Bytebase. The external URL is used for: 1. Constructing the correct callback URL when configuring the VCS provider. The callback URL points to the frontend; 2. Creating the correct webhook endpoint when configuring the project GitOps workflow. The webhook endpoint points to the backend.
231213
- `maximum_role_expiration_in_seconds` (Number) The max duration in seconds for role expired. If the value is less than or equal to 0, we will remove the setting. AKA no limit.
214+
- `password_restriction` (Block List, Max: 1) Password restriction settings. (see [below for nested schema](#nestedblock--workspace_profile--password_restriction))
232215
- `token_duration_in_seconds` (Number) The duration for login token in seconds. The duration should be at least 3600 (one hour).
216+
- `watermark` (Boolean) Whether to display watermark on pages. Requires ENTERPRISE license.
233217

234218
<a id="nestedblock--workspace_profile--announcement"></a>
235219
### Nested Schema for `workspace_profile.announcement`
@@ -241,3 +225,17 @@ Optional:
241225
- `text` (String) The text of announcement. Leave it as empty string can clear the announcement
242226

243227

228+
<a id="nestedblock--workspace_profile--password_restriction"></a>
229+
### Nested Schema for `workspace_profile.password_restriction`
230+
231+
Optional:
232+
233+
- `min_length` (Number) min_length is the minimum length for password, should be no less than 8.
234+
- `password_rotation_in_seconds` (Number) password_rotation requires users to reset their password after the duration. The duration should be at least 86400 (one day).
235+
- `require_letter` (Boolean) require_letter requires the password must contain at least one letter, regardless of upper case or lower case.
236+
- `require_number` (Boolean) require_number requires the password must contain at least one number.
237+
- `require_reset_password_for_first_login` (Boolean) require_reset_password_for_first_login requires users to reset their password after the 1st login.
238+
- `require_special_character` (Boolean) require_special_character requires the password must contain at least one special character.
239+
- `require_uppercase_letter` (Boolean) require_uppercase_letter requires the password must contain at least one upper case letter.
240+
241+

docs/resources/user.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ The user resource.
3232
- `last_change_password_time` (String) The user last change password time.
3333
- `last_login_time` (String) The user last login time.
3434
- `mfa_enabled` (Boolean) The mfa_enabled flag means if the user has enabled MFA.
35-
- `name` (String) The user name in users/{user id or email} format.
35+
- `name` (String) The user name in users/{email} format.
3636
- `service_key` (String) The service key for service account.
3737
- `source` (String) Source means where the user comes from. For now we support Entra ID SCIM sync, so the source could be Entra ID.
3838
- `state` (String) The user is deleted or not.

examples/setup/approval_flow.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ resource "bytebase_setting" "approval_flow" {
1414
]
1515
}
1616

17-
source = "DML"
17+
source = "CHANGE_DATABASE"
1818
condition = "resource.environment_id == \"prod\" && statement.affected_rows >= 100"
1919
}
2020

examples/setup/main.tf

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,12 @@ resource "bytebase_setting" "workspace_profile" {
3333
workspace_profile {
3434
external_url = "https://bytebase.example.com"
3535
domains = ["bytebase.com"]
36+
37+
password_restriction {
38+
min_length = 8
39+
require_number = true
40+
require_reset_password_for_first_login = true
41+
}
3642
}
3743
}
3844

examples/setup/project.tf

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ resource "bytebase_project" "sample_project" {
1515
webhooks {
1616
title = "Sample webhook 1"
1717
type = "SLACK"
18-
url = "https://webhook.site/91fcd52a-39f1-4e7b-a43a-ddf72796d6b1"
18+
url = "https://hooks.slack.com"
1919
notification_types = [
2020
"NOTIFY_ISSUE_APPROVED",
2121
"NOTIFY_PIPELINE_ROLLOUT",
@@ -26,7 +26,7 @@ resource "bytebase_project" "sample_project" {
2626
webhooks {
2727
title = "Sample webhook 2"
2828
type = "LARK"
29-
url = "https://webhook.site/91fcd52a-39f1-4e7b-a43a-ddf72796d6b1"
29+
url = "https://open.larksuite.com"
3030
notification_types = [
3131
"ISSUE_APPROVAL_NOTIFY",
3232
"ISSUE_PIPELINE_STAGE_STATUS_UPDATE"

examples/setup/sql_review.tf

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -13,31 +13,33 @@ resource "bytebase_review_config" "sample" {
1313
bytebase_project.sample_project.name
1414
])
1515
rules {
16-
type = "column.no-null"
16+
type = "COLUMN_NO_NULL"
1717
engine = "MYSQL"
1818
level = "WARNING"
1919
}
2020
rules {
21-
type = "column.required"
22-
engine = "MYSQL"
23-
level = "ERROR"
24-
payload = "{\"list\":[\"id\",\"created_ts\",\"updated_ts\",\"creator_id\",\"updater_id\"]}"
21+
type = "COLUMN_REQUIRED"
22+
engine = "MYSQL"
23+
level = "ERROR"
24+
string_array_payload = ["id", "created_ts", "updated_ts", "creator_id", "updater_id"]
2525
}
2626
rules {
27-
type = "table.require-pk"
27+
type = "TABLE_REQUIRE_PK"
2828
engine = "MYSQL"
2929
level = "ERROR"
3030
}
3131
rules {
32-
type = "naming.column"
33-
engine = "MYSQL"
34-
level = "ERROR"
35-
payload = "{\"format\":\"^[a-z]+(_[a-z]+)*$\",\"maxLength\":64}"
32+
type = "NAMING_COLUMN"
33+
engine = "MYSQL"
34+
level = "ERROR"
35+
naming_payload {
36+
format = "^[a-z]+(_[a-z]+)*$"
37+
}
3638
}
3739
rules {
38-
type = "statement.maximum-limit-value"
39-
engine = "MYSQL"
40-
level = "ERROR"
41-
payload = "{\"number\":1000}"
40+
type = "STATEMENT_MAXIMUM_LIMIT_VALUE"
41+
engine = "MYSQL"
42+
level = "ERROR"
43+
number_payload = 1000
4244
}
4345
}

go.mod

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ go 1.24.4
55
toolchain go1.24.5
66

77
require (
8-
buf.build/gen/go/bytebase/bytebase/connectrpc/go v1.19.1-20251128062846-919a7a8657b9.2
9-
buf.build/gen/go/bytebase/bytebase/protocolbuffers/go v1.36.10-20251128062846-919a7a8657b9.1
8+
buf.build/gen/go/bytebase/bytebase/connectrpc/go v1.19.1-20251213023536-6609958f901e.2
9+
buf.build/gen/go/bytebase/bytebase/protocolbuffers/go v1.36.11-20251213023536-6609958f901e.1
1010
connectrpc.com/connect v1.19.1
1111
github.com/hashicorp/go-cty v1.5.0
1212
github.com/hashicorp/terraform-plugin-docs v0.13.0
@@ -15,11 +15,11 @@ require (
1515
github.com/pkg/errors v0.9.1
1616
google.golang.org/genproto v0.0.0-20250528174236-200df99c418a
1717
google.golang.org/genproto/googleapis/api v0.0.0-20250707201910-8d1bb00bc6a7
18-
google.golang.org/protobuf v1.36.10
18+
google.golang.org/protobuf v1.36.11
1919
)
2020

2121
require (
22-
buf.build/gen/go/bufbuild/protovalidate/protocolbuffers/go v1.36.10-20250912141014-52f32327d4b0.1 // indirect
22+
buf.build/gen/go/bufbuild/protovalidate/protocolbuffers/go v1.36.11-20250912141014-52f32327d4b0.1 // indirect
2323
github.com/Masterminds/goutils v1.1.1 // indirect
2424
github.com/Masterminds/semver/v3 v3.2.0 // indirect
2525
github.com/Masterminds/sprig/v3 v3.2.3 // indirect

0 commit comments

Comments
 (0)