xref: /aosp_15_r20/external/googleapis/google/cloud/bigquery/migration/v2/migration_entities.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.bigquery.migration.v2;
18
19import "google/api/field_behavior.proto";
20import "google/api/resource.proto";
21import "google/cloud/bigquery/migration/v2/migration_error_details.proto";
22import "google/cloud/bigquery/migration/v2/migration_metrics.proto";
23import "google/cloud/bigquery/migration/v2/translation_config.proto";
24import "google/protobuf/timestamp.proto";
25import "google/rpc/error_details.proto";
26
27option csharp_namespace = "Google.Cloud.BigQuery.Migration.V2";
28option go_package = "cloud.google.com/go/bigquery/migration/apiv2/migrationpb;migrationpb";
29option java_multiple_files = true;
30option java_outer_classname = "MigrationEntitiesProto";
31option java_package = "com.google.cloud.bigquery.migration.v2";
32option php_namespace = "Google\\Cloud\\BigQuery\\Migration\\V2";
33
34// A migration workflow which specifies what needs to be done for an EDW
35// migration.
36message MigrationWorkflow {
37  option (google.api.resource) = {
38    type: "bigquerymigration.googleapis.com/MigrationWorkflow"
39    pattern: "projects/{project}/locations/{location}/workflows/{workflow}"
40  };
41
42  // Possible migration workflow states.
43  enum State {
44    // Workflow state is unspecified.
45    STATE_UNSPECIFIED = 0;
46
47    // Workflow is in draft status, i.e. tasks are not yet eligible for
48    // execution.
49    DRAFT = 1;
50
51    // Workflow is running (i.e. tasks are eligible for execution).
52    RUNNING = 2;
53
54    // Workflow is paused. Tasks currently in progress may continue, but no
55    // further tasks will be scheduled.
56    PAUSED = 3;
57
58    // Workflow is complete. There should not be any task in a non-terminal
59    // state, but if they are (e.g. forced termination), they will not be
60    // scheduled.
61    COMPLETED = 4;
62  }
63
64  // Output only. Immutable. The unique identifier for the migration workflow.
65  // The ID is server-generated.
66  //
67  // Example: `projects/123/locations/us/workflows/345`
68  string name = 1 [
69    (google.api.field_behavior) = OUTPUT_ONLY,
70    (google.api.field_behavior) = IMMUTABLE
71  ];
72
73  // The display name of the workflow. This can be set to give a workflow
74  // a descriptive name. There is no guarantee or enforcement of uniqueness.
75  string display_name = 6;
76
77  // The tasks in a workflow in a named map. The name (i.e. key) has no
78  // meaning and is merely a convenient way to address a specific task
79  // in a workflow.
80  map<string, MigrationTask> tasks = 2;
81
82  // Output only. That status of the workflow.
83  State state = 3 [(google.api.field_behavior) = OUTPUT_ONLY];
84
85  // Time when the workflow was created.
86  google.protobuf.Timestamp create_time = 4;
87
88  // Time when the workflow was last updated.
89  google.protobuf.Timestamp last_update_time = 5;
90}
91
92// A single task for a migration which has details about the configuration of
93// the task.
94message MigrationTask {
95  // Possible states of a migration task.
96  enum State {
97    // The state is unspecified.
98    STATE_UNSPECIFIED = 0;
99
100    // The task is waiting for orchestration.
101    PENDING = 1;
102
103    // The task is assigned to an orchestrator.
104    ORCHESTRATING = 2;
105
106    // The task is running, i.e. its subtasks are ready for execution.
107    RUNNING = 3;
108
109    // Tha task is paused. Assigned subtasks can continue, but no new subtasks
110    // will be scheduled.
111    PAUSED = 4;
112
113    // The task finished successfully.
114    SUCCEEDED = 5;
115
116    // The task finished unsuccessfully.
117    FAILED = 6;
118  }
119
120  // The details of the task.
121  oneof task_details {
122    // Task configuration for Batch SQL Translation.
123    TranslationConfigDetails translation_config_details = 14;
124  }
125
126  // Output only. Immutable. The unique identifier for the migration task. The
127  // ID is server-generated.
128  string id = 1 [
129    (google.api.field_behavior) = OUTPUT_ONLY,
130    (google.api.field_behavior) = IMMUTABLE
131  ];
132
133  // The type of the task. This must be one of the supported task types:
134  // Translation_Teradata2BQ, Translation_Redshift2BQ, Translation_Bteq2BQ,
135  // Translation_Oracle2BQ, Translation_HiveQL2BQ, Translation_SparkSQL2BQ,
136  // Translation_Snowflake2BQ, Translation_Netezza2BQ,
137  // Translation_AzureSynapse2BQ, Translation_Vertica2BQ,
138  // Translation_SQLServer2BQ, Translation_Presto2BQ, Translation_MySQL2BQ,
139  // Translation_Postgresql2BQ.
140  string type = 2;
141
142  // Output only. The current state of the task.
143  State state = 4 [(google.api.field_behavior) = OUTPUT_ONLY];
144
145  // Output only. An explanation that may be populated when the task is in
146  // FAILED state.
147  google.rpc.ErrorInfo processing_error = 5
148      [(google.api.field_behavior) = OUTPUT_ONLY];
149
150  // Time when the task was created.
151  google.protobuf.Timestamp create_time = 6;
152
153  // Time when the task was last updated.
154  google.protobuf.Timestamp last_update_time = 7;
155}
156
157// A subtask for a migration which carries details about the configuration of
158// the subtask. The content of the details should not matter to the end user,
159// but is a contract between the subtask creator and subtask worker.
160message MigrationSubtask {
161  option (google.api.resource) = {
162    type: "bigquerymigration.googleapis.com/MigrationSubtask"
163    pattern: "projects/{project}/locations/{location}/workflows/{workflow}/subtasks/{subtask}"
164  };
165
166  // Possible states of a migration subtask.
167  enum State {
168    // The state is unspecified.
169    STATE_UNSPECIFIED = 0;
170
171    // The subtask is ready, i.e. it is ready for execution.
172    ACTIVE = 1;
173
174    // The subtask is running, i.e. it is assigned to a worker for execution.
175    RUNNING = 2;
176
177    // The subtask finished successfully.
178    SUCCEEDED = 3;
179
180    // The subtask finished unsuccessfully.
181    FAILED = 4;
182
183    // The subtask is paused, i.e., it will not be scheduled. If it was already
184    // assigned,it might still finish but no new lease renewals will be granted.
185    PAUSED = 5;
186
187    // The subtask is pending a dependency. It will be scheduled once its
188    // dependencies are done.
189    PENDING_DEPENDENCY = 6;
190  }
191
192  // Output only. Immutable. The resource name for the migration subtask. The ID
193  // is server-generated.
194  //
195  // Example: `projects/123/locations/us/workflows/345/subtasks/678`
196  string name = 1 [
197    (google.api.field_behavior) = OUTPUT_ONLY,
198    (google.api.field_behavior) = IMMUTABLE
199  ];
200
201  // The unique ID of the task to which this subtask belongs.
202  string task_id = 2;
203
204  // The type of the Subtask. The migration service does not check whether this
205  // is a known type. It is up to the task creator (i.e. orchestrator or worker)
206  // to ensure it only creates subtasks for which there are compatible workers
207  // polling for Subtasks.
208  string type = 3;
209
210  // Output only. The current state of the subtask.
211  State state = 5 [(google.api.field_behavior) = OUTPUT_ONLY];
212
213  // Output only. An explanation that may be populated when the task is in
214  // FAILED state.
215  google.rpc.ErrorInfo processing_error = 6
216      [(google.api.field_behavior) = OUTPUT_ONLY];
217
218  // Output only. Provides details to errors and issues encountered while
219  // processing the subtask. Presence of error details does not mean that the
220  // subtask failed.
221  repeated ResourceErrorDetail resource_error_details = 12
222      [(google.api.field_behavior) = OUTPUT_ONLY];
223
224  // The number or resources with errors. Note: This is not the total
225  // number of errors as each resource can have more than one error.
226  // This is used to indicate truncation by having a `resource_error_count`
227  // that is higher than the size of `resource_error_details`.
228  int32 resource_error_count = 13;
229
230  // Time when the subtask was created.
231  google.protobuf.Timestamp create_time = 7;
232
233  // Time when the subtask was last updated.
234  google.protobuf.Timestamp last_update_time = 8;
235
236  // The metrics for the subtask.
237  repeated TimeSeries metrics = 11;
238}
239