Skip to content

Commit 0b75726

Browse files
authored
fix: Addng UI validations for MySql and PostgreSQL (#759)
1 parent 1615d75 commit 0b75726

File tree

2 files changed

+352
-0
lines changed

2 files changed

+352
-0
lines changed

modules/mysql/metadata.display.yaml

Lines changed: 200 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,12 +31,57 @@ spec:
3131
activation_policy:
3232
name: activation_policy
3333
title: Activation Policy
34+
enumValueLabels:
35+
- label: ALWAYS
36+
value: ALWAYS
37+
- label: NEVER
38+
value: NEVER
39+
- label: ON_DEMAND
40+
value: ON_DEMAND
3441
additional_databases:
3542
name: additional_databases
3643
title: Additional Databases
44+
properties:
45+
name:
46+
name: name
47+
title: Database Name
48+
regexValidation: ^[a-zA-Z][a-zA-Z0-9_]{0,63}$
49+
validation: Database names must be between 1 and 64 characters long, start with a letter, and can only contain letters, numbers, and underscores.
50+
charset:
51+
name: charset
52+
title: Charset
53+
regexValidation: ^[a-zA-Z0-9]+$
54+
validation: Database charset should contain only letters and numbers (e.g. 'utf8').
55+
collation:
56+
name: collation
57+
title: Collation
58+
regexValidation: ^[a-z0-9_]+$
59+
validation: Database collation should contain only lowercase letters, numbers, and underscores.
3760
additional_users:
3861
name: additional_users
3962
title: Additional Users
63+
properties:
64+
name:
65+
name: name
66+
title: User Name
67+
regexValidation: ^[a-zA-Z][a-zA-Z0-9_]{0,31}$
68+
validation: User names must be between 1 and 32 characters long, start with a letter, and can only contain letters, numbers, and underscores.
69+
type:
70+
name: type
71+
title: Type
72+
enumValueLabels:
73+
- label: BUILT_IN
74+
value: BUILT_IN
75+
- label: CLOUD_IAM_USER
76+
value: CLOUD_IAM_USER
77+
- label: CLOUD_IAM_SERVICE_ACCOUNT
78+
value: CLOUD_IAM_SERVICE_ACCOUNT
79+
- label: CLOUD_IAM_GROUP
80+
value: CLOUD_IAM_GROUP
81+
- label: CLOUD_IAM_GROUP_USER
82+
value: CLOUD_IAM_GROUP_USER
83+
- label: CLOUD_IAM_GROUP_SERVICE_ACCOUNT
84+
value: CLOUD_IAM_GROUP_SERVICE_ACCOUNT
4085
availability_type:
4186
name: availability_type
4287
title: Availability Type
@@ -58,9 +103,21 @@ spec:
58103
value:
59104
enabled: true
60105
binary_log_enabled: true
106+
properties:
107+
retention_unit:
108+
name: retention_unit
109+
title: Retention Unit
110+
enumValueLabels:
111+
- label: COUNT
112+
value: COUNT
61113
connector_enforcement:
62114
name: connector_enforcement
63115
title: Connector Enforcement
116+
enumValueLabels:
117+
- label: REQUIRED
118+
value: REQUIRED
119+
- label: NOT_REQUIRED
120+
value: NOT_REQUIRED
64121
create_timeout:
65122
name: create_timeout
66123
title: Create Timeout
@@ -95,9 +152,13 @@ spec:
95152
db_charset:
96153
name: db_charset
97154
title: Db Charset
155+
regexValidation: ^[a-z0-9]+$
156+
validation: Database charset should contain only lowercase letters and numbers.
98157
db_collation:
99158
name: db_collation
100159
title: Db Collation
160+
regexValidation: ^[a-z0-9_]+$
161+
validation: Database collation should contain only lowercase letters, numbers, and underscores.
101162
db_name:
102163
name: db_name
103164
title: Db Name
@@ -120,6 +181,22 @@ spec:
120181
deny_maintenance_period:
121182
name: deny_maintenance_period
122183
title: Deny Maintenance Period
184+
properties:
185+
end_date:
186+
name: end_date
187+
title: End Date
188+
regexValidation: ^[0-9]{4}-(0[1-9]|1[0-2])-(0[1-9]|[1-2][0-9]|3[0-1])$
189+
validation: End date must be in YYYY-MM-DD format.
190+
start_date:
191+
name: start_date
192+
title: Start Date
193+
regexValidation: ^[0-9]{4}-(0[1-9]|1[0-2])-(0[1-9]|[1-2][0-9]|3[0-1])$
194+
validation: Start date must be in YYYY-MM-DD format.
195+
time:
196+
name: time
197+
title: Time
198+
regexValidation: ^([0-1]?[0-9]|2[0-3]):[0-5][0-9]:[0-5][0-9]$
199+
validation: Time must be in HH:MM:SS format (24-hour clock).
123200
disk_autoresize:
124201
name: disk_autoresize
125202
title: Disk Autoresize
@@ -139,6 +216,13 @@ spec:
139216
name: disk_type
140217
title: Disk Type
141218
level: 1
219+
enumValueLabels:
220+
- label: PD_SSD
221+
value: PD_SSD
222+
- label: PD_HDD
223+
value: PD_HDD
224+
- label: HYPERDISK_BALANCED
225+
value: HYPERDISK_BALANCED
142226
edition:
143227
name: edition
144228
title: Edition
@@ -177,12 +261,43 @@ spec:
177261
iam_users:
178262
name: iam_users
179263
title: Iam Users
264+
properties:
265+
email:
266+
name: email
267+
title: Email
268+
regexValidation: ^([a-zA-Z][a-zA-Z0-9_]{0,15}|[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,})$
269+
validation: Must be a valid email address or a Google service account email.
270+
type:
271+
name: type
272+
title: Type
273+
enumValueLabels:
274+
- label: BUILT_IN
275+
value: BUILT_IN
276+
- label: CLOUD_IAM_USER
277+
value: CLOUD_IAM_USER
278+
- label: CLOUD_IAM_SERVICE_ACCOUNT
279+
value: CLOUD_IAM_SERVICE_ACCOUNT
280+
- label: CLOUD_IAM_GROUP
281+
value: CLOUD_IAM_GROUP
282+
- label: CLOUD_IAM_GROUP_USER
283+
value: CLOUD_IAM_GROUP_USER
284+
- label: CLOUD_IAM_GROUP_SERVICE_ACCOUNT
285+
value: CLOUD_IAM_GROUP_SERVICE_ACCOUNT
180286
insights_config:
181287
name: insights_config
182288
title: Insights Config
183289
instance_type:
184290
name: instance_type
185291
title: Instance Type
292+
enumValueLabels:
293+
- label: SQL_INSTANCE_TYPE_UNSPECIFIED
294+
value: SQL_INSTANCE_TYPE_UNSPECIFIED
295+
- label: CLOUD_SQL_INSTANCE
296+
value: CLOUD_SQL_INSTANCE
297+
- label: ON_PREMISES_INSTANCE
298+
value: ON_PREMISES_INSTANCE
299+
- label: READ_REPLICA_INSTANCE
300+
value: READ_REPLICA_INSTANCE
186301
ip_configuration:
187302
name: ip_configuration
188303
title: Ip Configuration
@@ -193,6 +308,25 @@ spec:
193308
subtext: The VPC network used to enable private IP access to the Cloud SQL instance. Cannot be unset once configured.
194309
regexValidation: ^(?:http(?:s)?://.+/)?projects/((?:(?:[-a-z0-9]{1,63}\\.)*(?:[a-z](?:[-a-z0-9]{0,61}[a-z0-9])?):)?(?:[0-9]{1,19}|(?:[a-z0-9](?:[-a-z0-9]{0,61}[a-z0-9])?)))/global/networks/((?:[a-z](?:[-a-z0-9]*[a-z0-9])?))$
195310
validation: Invalid format. Expected a valid Google Cloud network resource name, e.g. projects/{project}/global/networks/{network}.
311+
ssl_mode:
312+
name: ssl_mode
313+
title: Ssl Mode
314+
enumValueLabels:
315+
- label: ALLOW_UNENCRYPTED_AND_ENCRYPTED
316+
value: ALLOW_UNENCRYPTED_AND_ENCRYPTED
317+
- label: ENCRYPTED_ONLY
318+
value: ENCRYPTED_ONLY
319+
- label: TRUSTED_CLIENT_CERTIFICATE_REQUIRED
320+
value: TRUSTED_CLIENT_CERTIFICATE_REQUIRED
321+
authorized_networks:
322+
name: authorized_networks
323+
title: Authorized Networks
324+
properties:
325+
value:
326+
name: value
327+
title: Value
328+
regexValidation: ^((25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)\.){3}(25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)\/(3[0-2]|[1-2]\d|\d)$
329+
validation: Must be a valid IPv4 address in CIDR format.
196330
level: 1
197331
maintenance_window_day:
198332
name: maintenance_window_day
@@ -221,6 +355,9 @@ spec:
221355
name: pricing_plan
222356
title: Pricing Plan
223357
level: 1
358+
enumValueLabels:
359+
- label: PER_USE
360+
value: PER_USE
224361
project_id:
225362
name: project_id
226363
title: Project Id
@@ -239,13 +376,71 @@ spec:
239376
read_replicas:
240377
name: read_replicas
241378
title: Read Replicas
379+
properties:
380+
name:
381+
name: name
382+
title: Read Replica Name
383+
regexValidation: ^[a-z][a-z0-9-]{0,95}[a-z0-9]$
384+
validation: Read replica names must be between 1 and 97 characters long, start with a lowercase letter, and end with a lowercase letter or number. Read replica names can only contain lowercase letters, numbers, and hyphens.
385+
edition:
386+
name: edition
387+
title: Edition
388+
enumValueLabels:
389+
- label: ENTERPRISE_PLUS
390+
value: ENTERPRISE_PLUS
391+
- label: ENTERPRISE
392+
value: ENTERPRISE
393+
availability_type:
394+
name: availability_type
395+
title: Availability Type
396+
enumValueLabels:
397+
- label: REGIONAL
398+
value: REGIONAL
399+
- label: ZONAL
400+
value: ZONAL
401+
disk_type:
402+
name: disk_type
403+
title: Disk Type
404+
enumValueLabels:
405+
- label: PD_SSD
406+
value: PD_SSD
407+
- label: PD_HDD
408+
value: PD_HDD
409+
ip_configuration:
410+
name: ip_configuration
411+
title: Ip Configuration
412+
properties:
413+
private_network:
414+
name: private_network
415+
title: Private Network
416+
regexValidation: ^(projects/[a-z0-9-]+/)?global/networks/[a-z0-9-]+$
417+
validation: Invalid format. Expected a valid Google Cloud network resource name, e.g. projects/{project}/global/networks/{network}.
418+
ssl_mode:
419+
name: ssl_mode
420+
title: Ssl Mode
421+
enumValueLabels:
422+
- label: ALLOW_UNENCRYPTED_AND_ENCRYPTED
423+
value: ALLOW_UNENCRYPTED_AND_ENCRYPTED
424+
- label: ENCRYPTED_ONLY
425+
value: ENCRYPTED_ONLY
426+
- label: TRUSTED_CLIENT_CERTIFICATE_REQUIRED
427+
value: TRUSTED_CLIENT_CERTIFICATE_REQUIRED
242428
region:
243429
name: region
244430
title: Region
245431
level: 1
246432
replica_database_version:
247433
name: replica_database_version
248434
title: Replica Database Version
435+
enumValueLabels:
436+
- label: MYSQL_8_4
437+
value: MYSQL_8_4
438+
- label: MYSQL_8_0
439+
value: MYSQL_8_0
440+
- label: MYSQL_5_6
441+
value: MYSQL_5_6
442+
- label: MYSQL_5_7
443+
value: MYSQL_5_7
249444
root_password:
250445
name: root_password
251446
title: Root Password
@@ -266,6 +461,9 @@ spec:
266461
user_deletion_policy:
267462
name: user_deletion_policy
268463
title: User Deletion Policy
464+
enumValueLabels:
465+
- label: ABANDON
466+
value: ABANDON
269467
user_host:
270468
name: user_host
271469
title: User Host
@@ -276,6 +474,8 @@ spec:
276474
name: user_name
277475
title: User Name
278476
level: 1
477+
regexValidation: ^[a-zA-Z0-9-]{1,16}$
478+
validation: User names must be between 1 and 16 characters long and can contain lowercase letters, numbers, and hyphens.
279479
user_password:
280480
name: user_password
281481
title: User Password

0 commit comments

Comments
 (0)