xref: /aosp_15_r20/external/googleapis/google/cloud/clouddms/v1/conversionworkspace_resources.proto (revision d5c09012810ac0c9f33fe448fb6da8260d444cc9)
1// Copyright 2023 Google LLC
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7//     http://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14
15syntax = "proto3";
16
17package google.cloud.clouddms.v1;
18
19import "google/api/field_behavior.proto";
20import "google/api/resource.proto";
21import "google/cloud/clouddms/v1/clouddms_resources.proto";
22import "google/protobuf/empty.proto";
23import "google/protobuf/struct.proto";
24import "google/protobuf/timestamp.proto";
25
26option csharp_namespace = "Google.Cloud.CloudDms.V1";
27option go_package = "cloud.google.com/go/clouddms/apiv1/clouddmspb;clouddmspb";
28option java_multiple_files = true;
29option java_outer_classname = "ConversionWorkspaceResourcesProto";
30option java_package = "com.google.cloud.clouddms.v1";
31option php_namespace = "Google\\Cloud\\CloudDms\\V1";
32option ruby_package = "Google::Cloud::CloudDMS::V1";
33
34// The type and version of a source or destination database.
35message DatabaseEngineInfo {
36  // Required. Engine type.
37  DatabaseEngine engine = 1 [(google.api.field_behavior) = REQUIRED];
38
39  // Required. Engine named version, for example 12.c.1.
40  string version = 2 [(google.api.field_behavior) = REQUIRED];
41}
42
43// The main conversion workspace resource entity.
44message ConversionWorkspace {
45  option (google.api.resource) = {
46    type: "datamigration.googleapis.com/ConversionWorkspace"
47    pattern: "projects/{project}/locations/{location}/conversionWorkspaces/{conversion_workspace}"
48    plural: "conversionWorkspaces"
49    singular: "conversionWorkspace"
50  };
51
52  // Full name of the workspace resource, in the form of:
53  // projects/{project}/locations/{location}/conversionWorkspaces/{conversion_workspace}.
54  string name = 1;
55
56  // Required. The source engine details.
57  DatabaseEngineInfo source = 2 [(google.api.field_behavior) = REQUIRED];
58
59  // Required. The destination engine details.
60  DatabaseEngineInfo destination = 3 [(google.api.field_behavior) = REQUIRED];
61
62  // Optional. A generic list of settings for the workspace.
63  // The settings are database pair dependant and can indicate default behavior
64  // for the mapping rules engine or turn on or off specific features.
65  // Such examples can be: convert_foreign_key_to_interleave=true,
66  // skip_triggers=false, ignore_non_table_synonyms=true
67  map<string, string> global_settings = 4
68      [(google.api.field_behavior) = OPTIONAL];
69
70  // Output only. Whether the workspace has uncommitted changes (changes which
71  // were made after the workspace was committed).
72  bool has_uncommitted_changes = 5 [(google.api.field_behavior) = OUTPUT_ONLY];
73
74  // Output only. The latest commit ID.
75  string latest_commit_id = 6 [(google.api.field_behavior) = OUTPUT_ONLY];
76
77  // Output only. The timestamp when the workspace was committed.
78  google.protobuf.Timestamp latest_commit_time = 7
79      [(google.api.field_behavior) = OUTPUT_ONLY];
80
81  // Output only. The timestamp when the workspace resource was created.
82  google.protobuf.Timestamp create_time = 9
83      [(google.api.field_behavior) = OUTPUT_ONLY];
84
85  // Output only. The timestamp when the workspace resource was last updated.
86  google.protobuf.Timestamp update_time = 10
87      [(google.api.field_behavior) = OUTPUT_ONLY];
88
89  // Optional. The display name for the workspace.
90  string display_name = 11 [(google.api.field_behavior) = OPTIONAL];
91}
92
93// Execution log of a background job.
94message BackgroundJobLogEntry {
95  // Final state after a job completes.
96  enum JobCompletionState {
97    // The status is not specified. This state is used when job is not yet
98    // finished.
99    JOB_COMPLETION_STATE_UNSPECIFIED = 0;
100
101    // Success.
102    SUCCEEDED = 1;
103
104    // Error.
105    FAILED = 2;
106  }
107
108  // Details regarding a Seed background job.
109  message SeedJobDetails {
110    // Output only. The connection profile which was used for the seed job.
111    string connection_profile = 1 [(google.api.field_behavior) = OUTPUT_ONLY];
112  }
113
114  // Details regarding an Import Rules background job.
115  message ImportRulesJobDetails {
116    // Output only. File names used for the import rules job.
117    repeated string files = 1 [(google.api.field_behavior) = OUTPUT_ONLY];
118
119    // Output only. The requested file format.
120    ImportRulesFileFormat file_format = 2
121        [(google.api.field_behavior) = OUTPUT_ONLY];
122  }
123
124  // Details regarding a Convert background job.
125  message ConvertJobDetails {
126    // Output only. AIP-160 based filter used to specify the entities to convert
127    string filter = 1 [(google.api.field_behavior) = OUTPUT_ONLY];
128  }
129
130  // Details regarding an Apply background job.
131  message ApplyJobDetails {
132    // Output only. The connection profile which was used for the apply job.
133    string connection_profile = 1 [(google.api.field_behavior) = OUTPUT_ONLY];
134
135    // Output only. AIP-160 based filter used to specify the entities to apply
136    string filter = 2 [(google.api.field_behavior) = OUTPUT_ONLY];
137  }
138
139  // The background job log entry ID.
140  string id = 1;
141
142  // The type of job that was executed.
143  BackgroundJobType job_type = 2;
144
145  // The timestamp when the background job was started.
146  google.protobuf.Timestamp start_time = 3;
147
148  // The timestamp when the background job was finished.
149  google.protobuf.Timestamp finish_time = 4;
150
151  // Output only. Job completion state, i.e. the final state after the job
152  // completed.
153  JobCompletionState completion_state = 5
154      [(google.api.field_behavior) = OUTPUT_ONLY];
155
156  // Output only. Job completion comment, such as how many entities were seeded,
157  // how many warnings were found during conversion, and similar information.
158  string completion_comment = 6 [(google.api.field_behavior) = OUTPUT_ONLY];
159
160  // Output only. Whether the client requested the conversion workspace to be
161  // committed after a successful completion of the job.
162  bool request_autocommit = 7 [(google.api.field_behavior) = OUTPUT_ONLY];
163
164  oneof job_details {
165    // Output only. Seed job details.
166    SeedJobDetails seed_job_details = 100
167        [(google.api.field_behavior) = OUTPUT_ONLY];
168
169    // Output only. Import rules job details.
170    ImportRulesJobDetails import_rules_job_details = 101
171        [(google.api.field_behavior) = OUTPUT_ONLY];
172
173    // Output only. Convert job details.
174    ConvertJobDetails convert_job_details = 102
175        [(google.api.field_behavior) = OUTPUT_ONLY];
176
177    // Output only. Apply job details.
178    ApplyJobDetails apply_job_details = 103
179        [(google.api.field_behavior) = OUTPUT_ONLY];
180  }
181}
182
183// A filter defining the entities that a mapping rule should be applied to.
184// When more than one field is specified, the rule is applied only to
185// entities which match all the fields.
186message MappingRuleFilter {
187  // Optional. The rule should be applied to entities whose parent entity
188  // (fully qualified name) matches the given value.
189  // For example, if the rule applies to a table entity, the expected value
190  // should be a schema (schema). If the rule applies to a column or index
191  // entity, the expected value can be either a schema (schema) or a table
192  // (schema.table)
193  string parent_entity = 1 [(google.api.field_behavior) = OPTIONAL];
194
195  // Optional. The rule should be applied to entities whose non-qualified name
196  // starts with the given prefix.
197  string entity_name_prefix = 2 [(google.api.field_behavior) = OPTIONAL];
198
199  // Optional. The rule should be applied to entities whose non-qualified name
200  // ends with the given suffix.
201  string entity_name_suffix = 3 [(google.api.field_behavior) = OPTIONAL];
202
203  // Optional. The rule should be applied to entities whose non-qualified name
204  // contains the given string.
205  string entity_name_contains = 4 [(google.api.field_behavior) = OPTIONAL];
206
207  // Optional. The rule should be applied to specific entities defined by their
208  // fully qualified names.
209  repeated string entities = 5 [(google.api.field_behavior) = OPTIONAL];
210}
211
212// Definition of a transformation that is to be applied to a group of entities
213// in the source schema. Several such transformations can be applied to an
214// entity sequentially to define the corresponding entity in the target schema.
215message MappingRule {
216  option (google.api.resource) = {
217    type: "datamigration.googleapis.com/MappingRule"
218    pattern: "projects/{project}/locations/{location}/conversionWorkspaces/{conversion_workspace}/mappingRules/{mapping_rule}"
219    plural: "mappingRules"
220    singular: "mappingRule"
221  };
222
223  // The current mapping rule state such as enabled, disabled or deleted.
224  enum State {
225    // The state of the mapping rule is unknown.
226    STATE_UNSPECIFIED = 0;
227
228    // The rule is enabled.
229    ENABLED = 1;
230
231    // The rule is disabled.
232    DISABLED = 2;
233
234    // The rule is logically deleted.
235    DELETED = 3;
236  }
237
238  // Full name of the mapping rule resource, in the form of:
239  // projects/{project}/locations/{location}/conversionWorkspaces/{set}/mappingRule/{rule}.
240  string name = 1;
241
242  // Optional. A human readable name
243  string display_name = 2 [(google.api.field_behavior) = OPTIONAL];
244
245  // Optional. The mapping rule state
246  State state = 3 [(google.api.field_behavior) = OPTIONAL];
247
248  // Required. The rule scope
249  DatabaseEntityType rule_scope = 4 [(google.api.field_behavior) = REQUIRED];
250
251  // Required. The rule filter
252  MappingRuleFilter filter = 5 [(google.api.field_behavior) = REQUIRED];
253
254  // Required. The order in which the rule is applied. Lower order rules are
255  // applied before higher value rules so they may end up being overridden.
256  int64 rule_order = 6 [(google.api.field_behavior) = REQUIRED];
257
258  // Output only. The revision ID of the mapping rule.
259  // A new revision is committed whenever the mapping rule is changed in any
260  // way. The format is an 8-character hexadecimal string.
261  string revision_id = 7 [(google.api.field_behavior) = OUTPUT_ONLY];
262
263  // Output only. The timestamp that the revision was created.
264  google.protobuf.Timestamp revision_create_time = 8
265      [(google.api.field_behavior) = OUTPUT_ONLY];
266
267  // The rule specific details.
268  oneof details {
269    // Optional. Rule to specify how a single entity should be renamed.
270    SingleEntityRename single_entity_rename = 102
271        [(google.api.field_behavior) = OPTIONAL];
272
273    // Optional. Rule to specify how multiple entities should be renamed.
274    MultiEntityRename multi_entity_rename = 103
275        [(google.api.field_behavior) = OPTIONAL];
276
277    // Optional. Rule to specify how multiple entities should be relocated into
278    // a different schema.
279    EntityMove entity_move = 105 [(google.api.field_behavior) = OPTIONAL];
280
281    // Optional. Rule to specify how a single column is converted.
282    SingleColumnChange single_column_change = 106
283        [(google.api.field_behavior) = OPTIONAL];
284
285    // Optional. Rule to specify how multiple columns should be converted to a
286    // different data type.
287    MultiColumnDatatypeChange multi_column_data_type_change = 107
288        [(google.api.field_behavior) = OPTIONAL];
289
290    // Optional. Rule to specify how the data contained in a column should be
291    // transformed (such as trimmed, rounded, etc) provided that the data meets
292    // certain criteria.
293    ConditionalColumnSetValue conditional_column_set_value = 108
294        [(google.api.field_behavior) = OPTIONAL];
295
296    // Optional. Rule to specify how multiple tables should be converted with an
297    // additional rowid column.
298    ConvertRowIdToColumn convert_rowid_column = 114
299        [(google.api.field_behavior) = OPTIONAL];
300
301    // Optional. Rule to specify the primary key for a table
302    SetTablePrimaryKey set_table_primary_key = 115
303        [(google.api.field_behavior) = OPTIONAL];
304
305    // Optional. Rule to specify how a single package is converted.
306    SinglePackageChange single_package_change = 116
307        [(google.api.field_behavior) = OPTIONAL];
308
309    // Optional. Rule to change the sql code for an entity, for example,
310    // function, procedure.
311    SourceSqlChange source_sql_change = 117
312        [(google.api.field_behavior) = OPTIONAL];
313
314    // Optional. Rule to specify the list of columns to include or exclude from
315    // a table.
316    FilterTableColumns filter_table_columns = 118
317        [(google.api.field_behavior) = OPTIONAL];
318  }
319}
320
321// Options to configure rule type SingleEntityRename.
322// The rule is used to rename an entity.
323//
324// The rule filter field can refer to only one entity.
325//
326// The rule scope can be one of: Database, Schema, Table, Column, Constraint,
327// Index, View, Function, Stored Procedure, Materialized View, Sequence, UDT,
328// Synonym
329message SingleEntityRename {
330  // Required. The new name of the destination entity
331  string new_name = 1 [(google.api.field_behavior) = REQUIRED];
332}
333
334// Options to configure rule type MultiEntityRename.
335// The rule is used to rename multiple entities.
336//
337// The rule filter field can refer to one or more entities.
338//
339// The rule scope can be one of: Database, Schema, Table, Column, Constraint,
340// Index, View, Function, Stored Procedure, Materialized View, Sequence, UDT
341message MultiEntityRename {
342  // Optional. The pattern used to generate the new entity's name. This pattern
343  // must include the characters '{name}', which will be replaced with the name
344  // of the original entity. For example, the pattern 't_{name}' for an entity
345  // name jobs would be converted to 't_jobs'.
346  //
347  // If unspecified, the default value for this field is '{name}'
348  string new_name_pattern = 1 [(google.api.field_behavior) = OPTIONAL];
349
350  // Optional. Additional transformation that can be done on the source entity
351  // name before it is being used by the new_name_pattern, for example lower
352  // case. If no transformation is desired, use NO_TRANSFORMATION
353  EntityNameTransformation source_name_transformation = 2
354      [(google.api.field_behavior) = OPTIONAL];
355}
356
357// Options to configure rule type EntityMove.
358// The rule is used to move an entity to a new schema.
359//
360// The rule filter field can refer to one or more entities.
361//
362// The rule scope can be one of: Table, Column, Constraint, Index, View,
363// Function, Stored Procedure, Materialized View, Sequence, UDT
364message EntityMove {
365  // Required. The new schema
366  string new_schema = 1 [(google.api.field_behavior) = REQUIRED];
367}
368
369// Options to configure rule type SingleColumnChange.
370// The rule is used to change the properties of a column.
371//
372// The rule filter field can refer to one entity.
373//
374// The rule scope can be one of: Column.
375//
376// When using this rule, if a field is not specified than the destination
377// column's configuration will be the same as the one in the source column..
378message SingleColumnChange {
379  // Optional. Column data type name.
380  string data_type = 1 [(google.api.field_behavior) = OPTIONAL];
381
382  // Optional. Charset override - instead of table level charset.
383  string charset = 2 [(google.api.field_behavior) = OPTIONAL];
384
385  // Optional. Collation override - instead of table level collation.
386  string collation = 3 [(google.api.field_behavior) = OPTIONAL];
387
388  // Optional. Column length - e.g. 50 as in varchar (50) - when relevant.
389  int64 length = 4 [(google.api.field_behavior) = OPTIONAL];
390
391  // Optional. Column precision - e.g. 8 as in double (8,2) - when relevant.
392  int32 precision = 5 [(google.api.field_behavior) = OPTIONAL];
393
394  // Optional. Column scale - e.g. 2 as in double (8,2) - when relevant.
395  int32 scale = 6 [(google.api.field_behavior) = OPTIONAL];
396
397  // Optional. Column fractional seconds precision - e.g. 2 as in timestamp (2)
398  // - when relevant.
399  int32 fractional_seconds_precision = 7
400      [(google.api.field_behavior) = OPTIONAL];
401
402  // Optional. Is the column of array type.
403  bool array = 8 [(google.api.field_behavior) = OPTIONAL];
404
405  // Optional. The length of the array, only relevant if the column type is an
406  // array.
407  int32 array_length = 9 [(google.api.field_behavior) = OPTIONAL];
408
409  // Optional. Is the column nullable.
410  bool nullable = 10 [(google.api.field_behavior) = OPTIONAL];
411
412  // Optional. Is the column auto-generated/identity.
413  bool auto_generated = 11 [(google.api.field_behavior) = OPTIONAL];
414
415  // Optional. Is the column a UDT (User-defined Type).
416  bool udt = 12 [(google.api.field_behavior) = OPTIONAL];
417
418  // Optional. Custom engine specific features.
419  google.protobuf.Struct custom_features = 13
420      [(google.api.field_behavior) = OPTIONAL];
421
422  // Optional. Specifies the list of values allowed in the column.
423  repeated string set_values = 14 [(google.api.field_behavior) = OPTIONAL];
424
425  // Optional. Comment associated with the column.
426  string comment = 15 [(google.api.field_behavior) = OPTIONAL];
427}
428
429// Options to configure rule type MultiColumnDatatypeChange.
430// The rule is used to change the data type and associated properties of
431// multiple columns at once.
432//
433// The rule filter field can refer to one or more entities.
434//
435// The rule scope can be one of:Column.
436//
437// This rule requires additional filters to be specified beyond the basic rule
438// filter field, which is the source data type, but the rule supports additional
439// filtering capabilities such as the minimum and maximum field length. All
440// additional filters which are specified are required to be met in order for
441// the rule to be applied (logical AND between the fields).
442message MultiColumnDatatypeChange {
443  // Required. Filter on source data type.
444  string source_data_type_filter = 1 [(google.api.field_behavior) = REQUIRED];
445
446  // Filter on source column parameters.
447  oneof source_filter {
448    // Optional. Filter for text-based data types like varchar.
449    SourceTextFilter source_text_filter = 100
450        [(google.api.field_behavior) = OPTIONAL];
451
452    // Optional. Filter for fixed point number data types such as
453    // NUMERIC/NUMBER.
454    SourceNumericFilter source_numeric_filter = 101
455        [(google.api.field_behavior) = OPTIONAL];
456  }
457
458  // Required. New data type.
459  string new_data_type = 2 [(google.api.field_behavior) = REQUIRED];
460
461  // Optional. Column length - e.g. varchar (50) - if not specified and relevant
462  // uses the source column length.
463  int64 override_length = 3 [(google.api.field_behavior) = OPTIONAL];
464
465  // Optional. Column scale - when relevant - if not specified and relevant
466  // uses the source column scale.
467  int32 override_scale = 4 [(google.api.field_behavior) = OPTIONAL];
468
469  // Optional. Column precision - when relevant - if not specified and relevant
470  // uses the source column precision.
471  int32 override_precision = 5 [(google.api.field_behavior) = OPTIONAL];
472
473  // Optional. Column fractional seconds precision - used only for timestamp
474  // based datatypes - if not specified and relevant uses the source column
475  // fractional seconds precision.
476  int32 override_fractional_seconds_precision = 6
477      [(google.api.field_behavior) = OPTIONAL];
478
479  // Optional. Custom engine specific features.
480  google.protobuf.Struct custom_features = 7
481      [(google.api.field_behavior) = OPTIONAL];
482}
483
484// Filter for text-based data types like varchar.
485message SourceTextFilter {
486  // Optional. The filter will match columns with length greater than or equal
487  // to this number.
488  int64 source_min_length_filter = 1 [(google.api.field_behavior) = OPTIONAL];
489
490  // Optional. The filter will match columns with length smaller than or equal
491  // to this number.
492  int64 source_max_length_filter = 2 [(google.api.field_behavior) = OPTIONAL];
493}
494
495// Filter for fixed point number data types such as NUMERIC/NUMBER
496message SourceNumericFilter {
497  // Optional. The filter will match columns with scale greater than or equal to
498  // this number.
499  int32 source_min_scale_filter = 1 [(google.api.field_behavior) = OPTIONAL];
500
501  // Optional. The filter will match columns with scale smaller than or equal to
502  // this number.
503  int32 source_max_scale_filter = 2 [(google.api.field_behavior) = OPTIONAL];
504
505  // Optional. The filter will match columns with precision greater than or
506  // equal to this number.
507  int32 source_min_precision_filter = 3
508      [(google.api.field_behavior) = OPTIONAL];
509
510  // Optional. The filter will match columns with precision smaller than or
511  // equal to this number.
512  int32 source_max_precision_filter = 4
513      [(google.api.field_behavior) = OPTIONAL];
514
515  // Required. Enum to set the option defining the datatypes numeric filter has
516  // to be applied to
517  NumericFilterOption numeric_filter_option = 5
518      [(google.api.field_behavior) = REQUIRED];
519}
520
521// Options to configure rule type ConditionalColumnSetValue.
522// The rule is used to transform the data which is being replicated/migrated.
523//
524// The rule filter field can refer to one or more entities.
525//
526// The rule scope can be one of: Column.
527message ConditionalColumnSetValue {
528  oneof source_filter {
529    // Optional. Optional filter on source column length. Used for text based
530    // data types like varchar.
531    SourceTextFilter source_text_filter = 100
532        [(google.api.field_behavior) = OPTIONAL];
533
534    // Optional. Optional filter on source column precision and scale. Used for
535    // fixed point numbers such as NUMERIC/NUMBER data types.
536    SourceNumericFilter source_numeric_filter = 101
537        [(google.api.field_behavior) = OPTIONAL];
538  }
539
540  // Required. Description of data transformation during migration.
541  ValueTransformation value_transformation = 1
542      [(google.api.field_behavior) = REQUIRED];
543
544  // Optional. Custom engine specific features.
545  google.protobuf.Struct custom_features = 2
546      [(google.api.field_behavior) = OPTIONAL];
547}
548
549// Description of data transformation during migration as part of the
550// ConditionalColumnSetValue.
551message ValueTransformation {
552  oneof filter {
553    // Optional. Value is null
554    google.protobuf.Empty is_null = 100
555        [(google.api.field_behavior) = OPTIONAL];
556
557    // Optional. Value is found in the specified list.
558    ValueListFilter value_list = 101 [(google.api.field_behavior) = OPTIONAL];
559
560    // Optional. Filter on relation between source value and compare value of
561    // type integer.
562    IntComparisonFilter int_comparison = 102
563        [(google.api.field_behavior) = OPTIONAL];
564
565    // Optional. Filter on relation between source value and compare value of
566    // type double.
567    DoubleComparisonFilter double_comparison = 103
568        [(google.api.field_behavior) = OPTIONAL];
569  }
570
571  oneof action {
572    // Optional. Set to null
573    google.protobuf.Empty assign_null = 200
574        [(google.api.field_behavior) = OPTIONAL];
575
576    // Optional. Set to a specific value (value is converted to fit the target
577    // data type)
578    AssignSpecificValue assign_specific_value = 201
579        [(google.api.field_behavior) = OPTIONAL];
580
581    // Optional. Set to min_value - if integer or numeric, will use
582    // int.minvalue, etc
583    google.protobuf.Empty assign_min_value = 202
584        [(google.api.field_behavior) = OPTIONAL];
585
586    // Optional. Set to max_value - if integer or numeric, will use
587    // int.maxvalue, etc
588    google.protobuf.Empty assign_max_value = 203
589        [(google.api.field_behavior) = OPTIONAL];
590
591    // Optional. Allows the data to change scale
592    RoundToScale round_scale = 204 [(google.api.field_behavior) = OPTIONAL];
593
594    // Optional. Applies a hash function on the data
595    ApplyHash apply_hash = 205 [(google.api.field_behavior) = OPTIONAL];
596  }
597}
598
599// Options to configure rule type ConvertROWIDToColumn.
600// The rule is used to add column rowid to destination tables based on an Oracle
601// rowid function/property.
602//
603// The rule filter field can refer to one or more entities.
604//
605// The rule scope can be one of: Table.
606//
607// This rule requires additional filter to be specified beyond the basic rule
608// filter field, which is whether or not to work on tables which already have a
609// primary key defined.
610message ConvertRowIdToColumn {
611  // Required. Only work on tables without primary key defined
612  bool only_if_no_primary_key = 1 [(google.api.field_behavior) = REQUIRED];
613}
614
615// Options to configure rule type SetTablePrimaryKey.
616// The rule is used to specify the columns and name to configure/alter the
617// primary key of a table.
618//
619// The rule filter field can refer to one entity.
620//
621// The rule scope can be one of: Table.
622message SetTablePrimaryKey {
623  // Required. List of column names for the primary key
624  repeated string primary_key_columns = 1
625      [(google.api.field_behavior) = REQUIRED];
626
627  // Optional. Name for the primary key
628  string primary_key = 2 [(google.api.field_behavior) = OPTIONAL];
629}
630
631// Options to configure rule type SinglePackageChange.
632// The rule is used to alter the sql code for a package entities.
633//
634// The rule filter field can refer to one entity.
635//
636// The rule scope can be: Package
637message SinglePackageChange {
638  // Optional. Sql code for package description
639  string package_description = 1 [(google.api.field_behavior) = OPTIONAL];
640
641  // Optional. Sql code for package body
642  string package_body = 2 [(google.api.field_behavior) = OPTIONAL];
643}
644
645// Options to configure rule type SourceSqlChange.
646// The rule is used to alter the sql code for database entities.
647//
648// The rule filter field can refer to one entity.
649//
650// The rule scope can be: StoredProcedure, Function, Trigger, View
651message SourceSqlChange {
652  // Required. Sql code for source (stored procedure, function, trigger or view)
653  string sql_code = 1 [(google.api.field_behavior) = REQUIRED];
654}
655
656// Options to configure rule type FilterTableColumns.
657// The rule is used to filter the list of columns to include or exclude from a
658// table.
659//
660// The rule filter field can refer to one entity.
661//
662// The rule scope can be: Table
663//
664// Only one of the two lists can be specified for the rule.
665message FilterTableColumns {
666  // Optional. List of columns to be included for a particular table.
667  repeated string include_columns = 1 [(google.api.field_behavior) = OPTIONAL];
668
669  // Optional. List of columns to be excluded for a particular table.
670  repeated string exclude_columns = 2 [(google.api.field_behavior) = OPTIONAL];
671}
672
673// A list of values to filter by in ConditionalColumnSetValue
674message ValueListFilter {
675  // Required. Indicates whether the filter matches rows with values that are
676  // present in the list or those with values not present in it.
677  ValuePresentInList value_present_list = 1
678      [(google.api.field_behavior) = REQUIRED];
679
680  // Required. The list to be used to filter by
681  repeated string values = 2 [(google.api.field_behavior) = REQUIRED];
682
683  // Required. Whether to ignore case when filtering by values. Defaults to
684  // false
685  bool ignore_case = 3 [(google.api.field_behavior) = REQUIRED];
686}
687
688// Filter based on relation between source value and compare value of type
689// integer in ConditionalColumnSetValue
690message IntComparisonFilter {
691  // Required. Relation between source value and compare value
692  ValueComparison value_comparison = 1 [(google.api.field_behavior) = REQUIRED];
693
694  // Required. Integer compare value to be used
695  int64 value = 2 [(google.api.field_behavior) = REQUIRED];
696}
697
698// Filter based on relation between source
699// value and compare value of type double in ConditionalColumnSetValue
700message DoubleComparisonFilter {
701  // Required. Relation between source value and compare value
702  ValueComparison value_comparison = 1 [(google.api.field_behavior) = REQUIRED];
703
704  // Required. Double compare value to be used
705  double value = 2 [(google.api.field_behavior) = REQUIRED];
706}
707
708// Set to a specific value (value is converted to fit the target data type)
709message AssignSpecificValue {
710  // Required. Specific value to be assigned
711  string value = 1 [(google.api.field_behavior) = REQUIRED];
712}
713
714// Apply a hash function on the value.
715message ApplyHash {
716  oneof hash_function {
717    // Optional. Generate UUID from the data's byte array
718    google.protobuf.Empty uuid_from_bytes = 100
719        [(google.api.field_behavior) = OPTIONAL];
720  }
721}
722
723// This allows the data to change scale, for example if the source is 2 digits
724// after the decimal point, specify round to scale value = 2. If for example the
725// value needs to be converted to an integer, use round to scale value = 0.
726message RoundToScale {
727  // Required. Scale value to be used
728  int32 scale = 1 [(google.api.field_behavior) = REQUIRED];
729}
730
731// The base entity type for all the database related entities.
732// The message contains the entity name, the name of its parent, the entity
733// type, and the specific details per entity type.
734message DatabaseEntity {
735  // The type of database entities tree.
736  enum TreeType {
737    // Tree type unspecified.
738    TREE_TYPE_UNSPECIFIED = 0;
739
740    // Tree of entities loaded from a source database.
741    SOURCE = 1;
742
743    // Tree of entities converted from the source tree using the mapping rules.
744    DRAFT = 2;
745
746    // Tree of entities observed on the destination database.
747    DESTINATION = 3;
748  }
749
750  // The short name (e.g. table name) of the entity.
751  string short_name = 1;
752
753  // The full name of the parent entity (e.g. schema name).
754  string parent_entity = 2;
755
756  // The type of tree the entity belongs to.
757  TreeType tree = 3;
758
759  // The type of the database entity (table, view, index, ...).
760  DatabaseEntityType entity_type = 4;
761
762  // Details about entity mappings.
763  // For source tree entities, this holds the draft entities which were
764  // generated by the mapping rules.
765  // For draft tree entities, this holds the source entities which were
766  // converted to form the draft entity.
767  // Destination entities will have no mapping details.
768  repeated EntityMapping mappings = 5;
769
770  // Details about the entity DDL script. Multiple DDL scripts are provided for
771  // child entities such as a table entity will have one DDL for the table with
772  // additional DDLs for each index, constraint and such.
773  repeated EntityDdl entity_ddl = 6;
774
775  // Details about the various issues found for the entity.
776  repeated EntityIssue issues = 7;
777
778  // The specific body for each entity type.
779  oneof entity_body {
780    // Database.
781    DatabaseInstanceEntity database = 101;
782
783    // Schema.
784    SchemaEntity schema = 102;
785
786    // Table.
787    TableEntity table = 103;
788
789    // View.
790    ViewEntity view = 104;
791
792    // Sequence.
793    SequenceEntity sequence = 105;
794
795    // Stored procedure.
796    StoredProcedureEntity stored_procedure = 106;
797
798    // Function.
799    FunctionEntity database_function = 107;
800
801    // Synonym.
802    SynonymEntity synonym = 108;
803
804    // Package.
805    PackageEntity database_package = 109;
806
807    // UDT.
808    UDTEntity udt = 110;
809
810    // Materialized view.
811    MaterializedViewEntity materialized_view = 111;
812  }
813}
814
815// DatabaseInstance acts as a parent entity to other database entities.
816message DatabaseInstanceEntity {
817  // Custom engine specific features.
818  google.protobuf.Struct custom_features = 1;
819}
820
821// Schema typically has no parent entity, but can have a parent entity
822// DatabaseInstance (for database engines which support it).  For some database
823// engines, the terms  schema and user can be used interchangeably when they
824// refer to a namespace or a collection of other database entities. Can store
825// additional information which is schema specific.
826message SchemaEntity {
827  // Custom engine specific features.
828  google.protobuf.Struct custom_features = 1;
829}
830
831// Table's parent is a schema.
832message TableEntity {
833  // Table columns.
834  repeated ColumnEntity columns = 1;
835
836  // Table constraints.
837  repeated ConstraintEntity constraints = 2;
838
839  // Table indices.
840  repeated IndexEntity indices = 3;
841
842  // Table triggers.
843  repeated TriggerEntity triggers = 4;
844
845  // Custom engine specific features.
846  google.protobuf.Struct custom_features = 5;
847
848  // Comment associated with the table.
849  string comment = 6;
850}
851
852// Column is not used as an independent entity, it is retrieved as part of a
853// Table entity.
854message ColumnEntity {
855  // Column name.
856  string name = 1;
857
858  // Column data type.
859  string data_type = 2;
860
861  // Charset override - instead of table level charset.
862  string charset = 3;
863
864  // Collation override - instead of table level collation.
865  string collation = 4;
866
867  // Column length - e.g. varchar (50).
868  int64 length = 5;
869
870  // Column precision - when relevant.
871  int32 precision = 6;
872
873  // Column scale - when relevant.
874  int32 scale = 7;
875
876  // Column fractional second precision - used for timestamp based datatypes.
877  int32 fractional_seconds_precision = 8;
878
879  // Is the column of array type.
880  bool array = 9;
881
882  // If the column is array, of which length.
883  int32 array_length = 10;
884
885  // Is the column nullable.
886  bool nullable = 11;
887
888  // Is the column auto-generated/identity.
889  bool auto_generated = 12;
890
891  // Is the column a UDT.
892  bool udt = 13;
893
894  // Custom engine specific features.
895  google.protobuf.Struct custom_features = 14;
896
897  // Specifies the list of values allowed in the column.
898  // Only used for set data type.
899  repeated string set_values = 15;
900
901  // Comment associated with the column.
902  string comment = 16;
903
904  // Column order in the table.
905  int32 ordinal_position = 17;
906
907  // Default value of the column.
908  string default_value = 18;
909}
910
911// Constraint is not used as an independent entity, it is retrieved
912// as part of another entity such as Table or View.
913message ConstraintEntity {
914  // The name of the table constraint.
915  string name = 1;
916
917  // Type of constraint, for example unique, primary key, foreign key (currently
918  // only primary key is supported).
919  string type = 2;
920
921  // Table columns used as part of the Constraint, for example primary key
922  // constraint should list the columns which constitutes the key.
923  repeated string table_columns = 3;
924
925  // Custom engine specific features.
926  google.protobuf.Struct custom_features = 4;
927
928  // Reference columns which may be associated with the constraint. For example,
929  // if the constraint is a FOREIGN_KEY, this represents the list of full names
930  // of referenced columns by the foreign key.
931  repeated string reference_columns = 5;
932
933  // Reference table which may be associated with the constraint. For example,
934  // if the constraint is a FOREIGN_KEY, this represents the list of full name
935  // of the referenced table by the foreign key.
936  string reference_table = 6;
937
938  // Table which is associated with the constraint. In case the constraint
939  // is defined on a table, this field is left empty as this information is
940  // stored in parent_name. However, if constraint is defined on a view, this
941  // field stores the table name on which the view is defined.
942  string table_name = 7;
943}
944
945// Index is not used as an independent entity, it is retrieved as part of a
946// Table entity.
947message IndexEntity {
948  // The name of the index.
949  string name = 1;
950
951  // Type of index, for example B-TREE.
952  string type = 2;
953
954  // Table columns used as part of the Index, for example B-TREE index should
955  // list the columns which constitutes the index.
956  repeated string table_columns = 3;
957
958  // Boolean value indicating whether the index is unique.
959  bool unique = 4;
960
961  // Custom engine specific features.
962  google.protobuf.Struct custom_features = 5;
963}
964
965// Trigger is not used as an independent entity, it is retrieved as part of a
966// Table entity.
967message TriggerEntity {
968  // The name of the trigger.
969  string name = 1;
970
971  // The DML, DDL, or database events that fire the trigger, for example
972  // INSERT, UPDATE.
973  repeated string triggering_events = 2;
974
975  // Indicates when the trigger fires, for example BEFORE STATEMENT, AFTER EACH
976  // ROW.
977  string trigger_type = 3;
978
979  // The SQL code which creates the trigger.
980  string sql_code = 4;
981
982  // Custom engine specific features.
983  google.protobuf.Struct custom_features = 5;
984}
985
986// View's parent is a schema.
987message ViewEntity {
988  // The SQL code which creates the view.
989  string sql_code = 1;
990
991  // Custom engine specific features.
992  google.protobuf.Struct custom_features = 2;
993
994  // View constraints.
995  repeated ConstraintEntity constraints = 3;
996}
997
998// Sequence's parent is a schema.
999message SequenceEntity {
1000  // Increment value for the sequence.
1001  int64 increment = 1;
1002
1003  // Start number for the sequence represented as bytes to accommodate large.
1004  // numbers
1005  bytes start_value = 2;
1006
1007  // Maximum number for the sequence represented as bytes to accommodate large.
1008  // numbers
1009  bytes max_value = 3;
1010
1011  // Minimum number for the sequence represented as bytes to accommodate large.
1012  // numbers
1013  bytes min_value = 4;
1014
1015  // Indicates whether the sequence value should cycle through.
1016  bool cycle = 5;
1017
1018  // Indicates number of entries to cache / precreate.
1019  int64 cache = 6;
1020
1021  // Custom engine specific features.
1022  google.protobuf.Struct custom_features = 7;
1023}
1024
1025// Stored procedure's parent is a schema.
1026message StoredProcedureEntity {
1027  // The SQL code which creates the stored procedure.
1028  string sql_code = 1;
1029
1030  // Custom engine specific features.
1031  google.protobuf.Struct custom_features = 2;
1032}
1033
1034// Function's parent is a schema.
1035message FunctionEntity {
1036  // The SQL code which creates the function.
1037  string sql_code = 1;
1038
1039  // Custom engine specific features.
1040  google.protobuf.Struct custom_features = 2;
1041}
1042
1043// MaterializedView's parent is a schema.
1044message MaterializedViewEntity {
1045  // The SQL code which creates the view.
1046  string sql_code = 1;
1047
1048  // Custom engine specific features.
1049  google.protobuf.Struct custom_features = 2;
1050}
1051
1052// Synonym's parent is a schema.
1053message SynonymEntity {
1054  // The name of the entity for which the synonym is being created (the source).
1055  string source_entity = 1;
1056
1057  // The type of the entity for which the synonym is being created
1058  // (usually a table or a sequence).
1059  DatabaseEntityType source_type = 2;
1060
1061  // Custom engine specific features.
1062  google.protobuf.Struct custom_features = 3;
1063}
1064
1065// Package's parent is a schema.
1066message PackageEntity {
1067  // The SQL code which creates the package.
1068  string package_sql_code = 1;
1069
1070  // The SQL code which creates the package body. If the package specification
1071  // has cursors or subprograms, then the package body is mandatory.
1072  string package_body = 2;
1073
1074  // Custom engine specific features.
1075  google.protobuf.Struct custom_features = 3;
1076}
1077
1078// UDT's parent is a schema.
1079message UDTEntity {
1080  // The SQL code which creates the udt.
1081  string udt_sql_code = 1;
1082
1083  // The SQL code which creates the udt body.
1084  string udt_body = 2;
1085
1086  // Custom engine specific features.
1087  google.protobuf.Struct custom_features = 3;
1088}
1089
1090// Details of the mappings of a database entity.
1091message EntityMapping {
1092  // Source entity full name.
1093  // The source entity can also be a column, index or constraint using the
1094  // same naming notation schema.table.column.
1095  string source_entity = 1;
1096
1097  // Target entity full name.
1098  // The draft entity can also include a column, index or constraint using the
1099  // same naming notation schema.table.column.
1100  string draft_entity = 2;
1101
1102  // Type of source entity.
1103  DatabaseEntityType source_type = 4;
1104
1105  // Type of draft entity.
1106  DatabaseEntityType draft_type = 5;
1107
1108  // Entity mapping log entries.
1109  // Multiple rules can be effective and contribute changes to a converted
1110  // entity, such as a rule can handle the entity name, another rule can handle
1111  // an entity type. In addition, rules which did not change the entity are also
1112  // logged along with the reason preventing them to do so.
1113  repeated EntityMappingLogEntry mapping_log = 3;
1114}
1115
1116// A single record of a rule which was used for a mapping.
1117message EntityMappingLogEntry {
1118  // Which rule caused this log entry.
1119  string rule_id = 1;
1120
1121  // Rule revision ID.
1122  string rule_revision_id = 2;
1123
1124  // Comment.
1125  string mapping_comment = 3;
1126}
1127
1128// A single DDL statement for a specific entity
1129message EntityDdl {
1130  // Type of DDL (Create, Alter).
1131  string ddl_type = 1;
1132
1133  // The name of the database entity the ddl refers to.
1134  string entity = 2;
1135
1136  // The actual ddl code.
1137  string ddl = 3;
1138
1139  // The entity type (if the DDL is for a sub entity).
1140  DatabaseEntityType entity_type = 4;
1141
1142  // EntityIssues found for this ddl.
1143  repeated string issue_id = 100;
1144}
1145
1146// Issue related to the entity.
1147message EntityIssue {
1148  // Type of issue.
1149  enum IssueType {
1150    // Unspecified issue type.
1151    ISSUE_TYPE_UNSPECIFIED = 0;
1152
1153    // Issue originated from the DDL
1154    ISSUE_TYPE_DDL = 1;
1155
1156    // Issue originated during the apply process
1157    ISSUE_TYPE_APPLY = 2;
1158
1159    // Issue originated during the convert process
1160    ISSUE_TYPE_CONVERT = 3;
1161  }
1162
1163  // Severity of issue.
1164  enum IssueSeverity {
1165    // Unspecified issue severity
1166    ISSUE_SEVERITY_UNSPECIFIED = 0;
1167
1168    // Info
1169    ISSUE_SEVERITY_INFO = 1;
1170
1171    // Warning
1172    ISSUE_SEVERITY_WARNING = 2;
1173
1174    // Error
1175    ISSUE_SEVERITY_ERROR = 3;
1176  }
1177
1178  // Issue position.
1179  message Position {
1180    // Issue line number
1181    int32 line = 1;
1182
1183    // Issue column number
1184    int32 column = 2;
1185
1186    // Issue offset
1187    int32 offset = 3;
1188
1189    // Issue length
1190    int32 length = 4;
1191  }
1192
1193  // Unique Issue ID.
1194  string id = 1;
1195
1196  // The type of the issue.
1197  IssueType type = 2;
1198
1199  // Severity of the issue
1200  IssueSeverity severity = 3;
1201
1202  // Issue detailed message
1203  string message = 4;
1204
1205  // Error/Warning code
1206  string code = 5;
1207
1208  // The ddl which caused the issue, if relevant.
1209  optional string ddl = 6;
1210
1211  // The position of the issue found, if relevant.
1212  optional Position position = 7;
1213
1214  // The entity type (if the DDL is for a sub entity).
1215  DatabaseEntityType entity_type = 8;
1216}
1217
1218// Enum used by ValueListFilter to indicate whether the source value is in the
1219// supplied list
1220enum ValuePresentInList {
1221  // Value present in list unspecified
1222  VALUE_PRESENT_IN_LIST_UNSPECIFIED = 0;
1223
1224  // If the source value is in the supplied list at value_list
1225  VALUE_PRESENT_IN_LIST_IF_VALUE_LIST = 1;
1226
1227  // If the source value is not in the supplied list at value_list
1228  VALUE_PRESENT_IN_LIST_IF_VALUE_NOT_LIST = 2;
1229}
1230
1231// The type of database entities supported,
1232enum DatabaseEntityType {
1233  // Unspecified database entity type.
1234  DATABASE_ENTITY_TYPE_UNSPECIFIED = 0;
1235
1236  // Schema.
1237  DATABASE_ENTITY_TYPE_SCHEMA = 1;
1238
1239  // Table.
1240  DATABASE_ENTITY_TYPE_TABLE = 2;
1241
1242  // Column.
1243  DATABASE_ENTITY_TYPE_COLUMN = 3;
1244
1245  // Constraint.
1246  DATABASE_ENTITY_TYPE_CONSTRAINT = 4;
1247
1248  // Index.
1249  DATABASE_ENTITY_TYPE_INDEX = 5;
1250
1251  // Trigger.
1252  DATABASE_ENTITY_TYPE_TRIGGER = 6;
1253
1254  // View.
1255  DATABASE_ENTITY_TYPE_VIEW = 7;
1256
1257  // Sequence.
1258  DATABASE_ENTITY_TYPE_SEQUENCE = 8;
1259
1260  // Stored Procedure.
1261  DATABASE_ENTITY_TYPE_STORED_PROCEDURE = 9;
1262
1263  // Function.
1264  DATABASE_ENTITY_TYPE_FUNCTION = 10;
1265
1266  // Synonym.
1267  DATABASE_ENTITY_TYPE_SYNONYM = 11;
1268
1269  // Package.
1270  DATABASE_ENTITY_TYPE_DATABASE_PACKAGE = 12;
1271
1272  // UDT.
1273  DATABASE_ENTITY_TYPE_UDT = 13;
1274
1275  // Materialized View.
1276  DATABASE_ENTITY_TYPE_MATERIALIZED_VIEW = 14;
1277
1278  // Database.
1279  DATABASE_ENTITY_TYPE_DATABASE = 15;
1280}
1281
1282// Entity Name Transformation Types
1283enum EntityNameTransformation {
1284  // Entity name transformation unspecified.
1285  ENTITY_NAME_TRANSFORMATION_UNSPECIFIED = 0;
1286
1287  // No transformation.
1288  ENTITY_NAME_TRANSFORMATION_NO_TRANSFORMATION = 1;
1289
1290  // Transform to lower case.
1291  ENTITY_NAME_TRANSFORMATION_LOWER_CASE = 2;
1292
1293  // Transform to upper case.
1294  ENTITY_NAME_TRANSFORMATION_UPPER_CASE = 3;
1295
1296  // Transform to capitalized case.
1297  ENTITY_NAME_TRANSFORMATION_CAPITALIZED_CASE = 4;
1298}
1299
1300// The types of jobs that can be executed in the background.
1301enum BackgroundJobType {
1302  // Unspecified background job type.
1303  BACKGROUND_JOB_TYPE_UNSPECIFIED = 0;
1304
1305  // Job to seed from the source database.
1306  BACKGROUND_JOB_TYPE_SOURCE_SEED = 1;
1307
1308  // Job to convert the source database into a draft of the destination
1309  // database.
1310  BACKGROUND_JOB_TYPE_CONVERT = 2;
1311
1312  // Job to apply the draft tree onto the destination.
1313  BACKGROUND_JOB_TYPE_APPLY_DESTINATION = 3;
1314
1315  // Job to import and convert mapping rules from an external source such as an
1316  // ora2pg config file.
1317  BACKGROUND_JOB_TYPE_IMPORT_RULES_FILE = 5;
1318}
1319
1320// The format for the import rules file.
1321enum ImportRulesFileFormat {
1322  // Unspecified rules format.
1323  IMPORT_RULES_FILE_FORMAT_UNSPECIFIED = 0;
1324
1325  // HarbourBridge session file.
1326  IMPORT_RULES_FILE_FORMAT_HARBOUR_BRIDGE_SESSION_FILE = 1;
1327
1328  // Ora2Pg configuration file.
1329  IMPORT_RULES_FILE_FORMAT_ORATOPG_CONFIG_FILE = 2;
1330}
1331
1332// Enum used by IntComparisonFilter and DoubleComparisonFilter to indicate the
1333// relation between source value and compare value.
1334enum ValueComparison {
1335  // Value comparison unspecified.
1336  VALUE_COMPARISON_UNSPECIFIED = 0;
1337
1338  // Value is smaller than the Compare value.
1339  VALUE_COMPARISON_IF_VALUE_SMALLER_THAN = 1;
1340
1341  // Value is smaller or equal than the Compare value.
1342  VALUE_COMPARISON_IF_VALUE_SMALLER_EQUAL_THAN = 2;
1343
1344  // Value is larger than the Compare value.
1345  VALUE_COMPARISON_IF_VALUE_LARGER_THAN = 3;
1346
1347  // Value is larger or equal than the Compare value.
1348  VALUE_COMPARISON_IF_VALUE_LARGER_EQUAL_THAN = 4;
1349}
1350
1351// Specifies the columns on which numeric filter needs to be applied.
1352enum NumericFilterOption {
1353  // Numeric filter option unspecified
1354  NUMERIC_FILTER_OPTION_UNSPECIFIED = 0;
1355
1356  // Numeric filter option that matches all numeric columns.
1357  NUMERIC_FILTER_OPTION_ALL = 1;
1358
1359  // Numeric filter option that matches columns having numeric datatypes with
1360  // specified precision and scale within the limited range of filter.
1361  NUMERIC_FILTER_OPTION_LIMIT = 2;
1362
1363  // Numeric filter option that matches only the numeric columns with no
1364  // precision and scale specified.
1365  NUMERIC_FILTER_OPTION_LIMITLESS = 3;
1366}
1367