1// Copyright 2020 The Cirq Developers
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 cirq.google.engine.client.quantum_v1alpha1.proto;
18
19import "google/api/annotations.proto";
20import "google/cloud/quantum_v1alpha1/proto/quantum.proto";
21import "google/protobuf/duration.proto";
22import "google/protobuf/empty.proto";
23import "google/protobuf/field_mask.proto";
24import "google/api/client.proto";
25
26// -
27service QuantumEngineService {
28  option (.google.api.default_host) = "quantum.googleapis.com";
29  option (.google.api.oauth_scopes) = "https://www.googleapis.com/auth/cloud-platform";
30
31  // -
32  rpc CreateQuantumProgram(CreateQuantumProgramRequest) returns (QuantumProgram) {
33    option (.google.api.http) = {
34      post: "/v1alpha1/{parent=projects/*}/programs"
35      body: "quantum_program"
36    };
37  }
38
39  // -
40  rpc GetQuantumProgram(GetQuantumProgramRequest) returns (QuantumProgram) {
41    option (.google.api.http) = {
42      get: "/v1alpha1/{name=projects/*/programs/*}"
43    };
44  }
45
46  // -
47  rpc ListQuantumPrograms(ListQuantumProgramsRequest) returns (ListQuantumProgramsResponse) {
48    option (.google.api.http) = {
49      get: "/v1alpha1/{parent=projects/*}/programs"
50    };
51  }
52
53  // -
54  rpc DeleteQuantumProgram(DeleteQuantumProgramRequest) returns (.google.protobuf.Empty) {
55    option (.google.api.http) = {
56      delete: "/v1alpha1/{name=projects/*/programs/*}"
57    };
58  }
59
60  // -
61  rpc UpdateQuantumProgram(UpdateQuantumProgramRequest) returns (QuantumProgram) {
62    option (.google.api.http) = {
63      patch: "/v1alpha1/{name=projects/*/programs/*}"
64      body: "quantum_program"
65    };
66  }
67
68  // -
69  rpc CreateQuantumJob(CreateQuantumJobRequest) returns (QuantumJob) {
70    option (.google.api.http) = {
71      post: "/v1alpha1/{parent=projects/*/programs/*}/jobs"
72      body: "quantum_job"
73    };
74  }
75
76  // -
77  rpc GetQuantumJob(GetQuantumJobRequest) returns (QuantumJob) {
78    option (.google.api.http) = {
79      get: "/v1alpha1/{name=projects/*/programs/*/jobs/*}"
80    };
81  }
82
83  // -
84  rpc ListQuantumJobs(ListQuantumJobsRequest) returns (ListQuantumJobsResponse) {
85    option (.google.api.http) = {
86      get: "/v1alpha1/{parent=projects/*/programs/*}/jobs"
87    };
88  }
89
90  // -
91  rpc DeleteQuantumJob(DeleteQuantumJobRequest) returns (.google.protobuf.Empty) {
92    option (.google.api.http) = {
93      delete: "/v1alpha1/{name=projects/*/programs/*/jobs/*}"
94    };
95  }
96
97  // -
98  rpc UpdateQuantumJob(UpdateQuantumJobRequest) returns (QuantumJob) {
99    option (.google.api.http) = {
100      patch: "/v1alpha1/{name=projects/*/programs/*/jobs/*}"
101      body: "quantum_job"
102    };
103  }
104
105  // -
106  rpc CancelQuantumJob(CancelQuantumJobRequest) returns (.google.protobuf.Empty) {
107    option (.google.api.http) = {
108      post: "/v1alpha1/{name=projects/*/programs/*/jobs/*}:cancel"
109      body: "*"
110    };
111  }
112
113  // -
114  rpc ListQuantumJobEvents(ListQuantumJobEventsRequest) returns (ListQuantumJobEventsResponse) {
115    option (.google.api.http) = {
116      get: "/v1alpha1/{parent=projects/*/programs/*/jobs/*}/events"
117    };
118  }
119
120  // -
121  rpc GetQuantumResult(GetQuantumResultRequest) returns (QuantumResult) {
122    option (.google.api.http) = {
123      get: "/v1alpha1/{parent=projects/*/programs/*/jobs/*}/result"
124    };
125  }
126
127  // -
128  rpc ListQuantumProcessors(ListQuantumProcessorsRequest) returns (ListQuantumProcessorsResponse) {
129    option (.google.api.http) = {
130      get: "/v1alpha1/{parent=projects/*}/processors"
131    };
132  }
133
134  // -
135  rpc GetQuantumProcessor(GetQuantumProcessorRequest) returns (QuantumProcessor) {
136    option (.google.api.http) = {
137      get: "/v1alpha1/{name=projects/*/processors/*}"
138    };
139  }
140
141  // -
142  rpc ListQuantumCalibrations(ListQuantumCalibrationsRequest) returns (ListQuantumCalibrationsResponse) {
143    option (.google.api.http) = {
144      get: "/v1alpha1/{parent=projects/*/processors/*}/calibrations"
145    };
146  }
147
148  // -
149  rpc GetQuantumCalibration(GetQuantumCalibrationRequest) returns (QuantumCalibration) {
150    option (.google.api.http) = {
151      get: "/v1alpha1/{name=projects/*/processors/*/calibrations/*}"
152    };
153  }
154
155  // -
156  rpc CreateQuantumReservation(CreateQuantumReservationRequest) returns (QuantumReservation) {
157    option (.google.api.http) = {
158      post: "/v1alpha1/{parent=projects/*/processors/*}/reservations"
159      body: "quantum_reservation"
160    };
161  }
162
163  // -
164  rpc CancelQuantumReservation(CancelQuantumReservationRequest) returns (QuantumReservation) {
165    option (.google.api.http) = {
166      post: "/v1alpha1/{name=projects/*/processors/*/reservations/*}:cancel"
167      body: "*"
168    };
169  }
170
171  // -
172  rpc DeleteQuantumReservation(DeleteQuantumReservationRequest) returns (.google.protobuf.Empty) {
173    option (.google.api.http) = {
174      delete: "/v1alpha1/{name=projects/*/processors/*/reservations/*}"
175    };
176  }
177
178  // -
179  rpc GetQuantumReservation(GetQuantumReservationRequest) returns (QuantumReservation) {
180    option (.google.api.http) = {
181      get: "/v1alpha1/{name=projects/*/processors/*/reservations/*}"
182    };
183  }
184
185  // -
186  rpc ListQuantumReservations(ListQuantumReservationsRequest) returns (ListQuantumReservationsResponse) {
187    option (.google.api.http) = {
188      get: "/v1alpha1/{parent=projects/*/processors/*}/reservations"
189    };
190  }
191
192  // -
193  rpc UpdateQuantumReservation(UpdateQuantumReservationRequest) returns (QuantumReservation) {
194    option (.google.api.http) = {
195      patch: "/v1alpha1/{name=projects/*/processors/*/reservations/*}"
196      body: "quantum_reservation"
197    };
198  }
199
200  // -
201  rpc QuantumRunStream(stream QuantumRunStreamRequest) returns (stream QuantumRunStreamResponse) {
202  }
203
204  // -
205  rpc ListQuantumReservationGrants(ListQuantumReservationGrantsRequest) returns (ListQuantumReservationGrantsResponse) {
206    option (.google.api.http) = {
207      get: "/v1alpha1/{parent=projects/*}/reservationGrant"
208    };
209  }
210
211  // -
212  rpc ReallocateQuantumReservationGrant(ReallocateQuantumReservationGrantRequest) returns (QuantumReservationGrant) {
213    option (.google.api.http) = {
214      post: "/v1alpha1/{name=projects/*/reservationGrant/*}:reallocate"
215      body: "*"
216    };
217  }
218
219  // -
220  rpc ListQuantumReservationBudgets(ListQuantumReservationBudgetsRequest) returns (ListQuantumReservationBudgetsResponse) {
221    option (.google.api.http) = {
222      get: "/v1alpha1/{parent=projects/*}/reservationBudgets"
223    };
224  }
225
226  // -
227  rpc ListQuantumTimeSlots(ListQuantumTimeSlotsRequest) returns (ListQuantumTimeSlotsResponse) {
228    option (.google.api.http) = {
229      get: "/v1alpha1/{parent=projects/*/processors/*}/timeSlots"
230    };
231  }
232}
233
234// -
235message CreateQuantumJobRequest {
236  // -
237  string parent = 1;
238
239  // -
240  QuantumJob quantum_job = 2;
241
242  // -
243  bool overwrite_existing_run_context = 3;
244}
245
246// -
247message GetQuantumJobRequest {
248  // -
249  string name = 1;
250
251  // -
252  bool return_run_context = 2;
253}
254
255// -
256message ListQuantumJobsRequest {
257  // -
258  string parent = 1;
259
260  // -
261  int32 page_size = 2;
262
263  // -
264  string page_token = 3;
265
266  // -
267  string filter = 4;
268}
269
270// -
271message ListQuantumJobsResponse {
272  // -
273  repeated QuantumJob jobs = 1;
274
275  // -
276  string next_page_token = 2;
277}
278
279// -
280message DeleteQuantumJobRequest {
281  // -
282  string name = 1;
283}
284
285// -
286message UpdateQuantumJobRequest {
287  // -
288  string name = 1;
289
290  // -
291  QuantumJob quantum_job = 2;
292
293  // -
294  .google.protobuf.FieldMask update_mask = 3;
295}
296
297// -
298message CancelQuantumJobRequest {
299  // -
300  string name = 1;
301}
302
303// -
304message ListQuantumJobEventsRequest {
305  // -
306  string parent = 1;
307
308  // -
309  int32 page_size = 2;
310
311  // -
312  string page_token = 3;
313}
314
315// -
316message ListQuantumJobEventsResponse {
317  // -
318  repeated QuantumJobEvent events = 1;
319
320  // -
321  string next_page_token = 2;
322}
323
324// -
325message GetQuantumResultRequest {
326  // -
327  string parent = 1;
328}
329
330// -
331message CreateQuantumProgramRequest {
332  // -
333  string parent = 1;
334
335  // -
336  QuantumProgram quantum_program = 2;
337
338  // -
339  bool overwrite_existing_source_code = 3;
340}
341
342// -
343message GetQuantumProgramRequest {
344  // -
345  string name = 1;
346
347  // -
348  bool return_code = 2;
349}
350
351// -
352message ListQuantumProgramsRequest {
353  // -
354  string parent = 1;
355
356  // -
357  int32 page_size = 2;
358
359  // -
360  string page_token = 3;
361
362  // -
363  string filter = 4;
364}
365
366// -
367message ListQuantumProgramsResponse {
368  // -
369  repeated QuantumProgram programs = 1;
370
371  // -
372  string next_page_token = 2;
373}
374
375// -
376message DeleteQuantumProgramRequest {
377  // -
378  string name = 1;
379
380  // -
381  bool delete_jobs = 2;
382}
383
384// -
385message UpdateQuantumProgramRequest {
386  // -
387  string name = 1;
388
389  // -
390  QuantumProgram quantum_program = 2;
391
392  // -
393  .google.protobuf.FieldMask update_mask = 3;
394}
395
396// -
397message ListQuantumProcessorsRequest {
398  // -
399  string parent = 1;
400
401  // -
402  int32 page_size = 2;
403
404  // -
405  string page_token = 3;
406
407  // -
408  string filter = 4;
409}
410
411// -
412message ListQuantumProcessorsResponse {
413  // -
414  repeated QuantumProcessor processors = 1;
415
416  // -
417  string next_page_token = 2;
418}
419
420// -
421message GetQuantumProcessorRequest {
422  // -
423  string name = 1;
424}
425
426// -
427message ListQuantumCalibrationsRequest {
428  // -
429  string parent = 1;
430
431  // -
432  int32 page_size = 2;
433
434  // -
435  string page_token = 3;
436
437  // -
438  string filter = 4;
439}
440
441// -
442message ListQuantumCalibrationsResponse {
443  // -
444  repeated QuantumCalibration calibrations = 1;
445
446  // -
447  string next_page_token = 2;
448}
449
450// -
451message GetQuantumCalibrationRequest {
452  // -
453  string name = 1;
454}
455
456// -
457message CreateQuantumReservationRequest {
458  // -
459  string parent = 1;
460
461  // -
462  QuantumReservation quantum_reservation = 2;
463}
464
465// -
466message CancelQuantumReservationRequest {
467  // -
468  string name = 1;
469}
470
471// -
472message DeleteQuantumReservationRequest {
473  // -
474  string name = 1;
475}
476
477// -
478message GetQuantumReservationRequest {
479  // -
480  string name = 1;
481}
482
483// -
484message ListQuantumReservationsRequest {
485  // -
486  string parent = 1;
487
488  // -
489  int32 page_size = 2;
490
491  // -
492  string page_token = 3;
493
494  // -
495  string filter = 4;
496}
497
498// -
499message ListQuantumReservationsResponse {
500  // -
501  repeated QuantumReservation reservations = 1;
502
503  // -
504  string next_page_token = 2;
505}
506
507// -
508message UpdateQuantumReservationRequest {
509  // -
510  string name = 1;
511
512  // -
513  QuantumReservation quantum_reservation = 2;
514
515  // -
516  .google.protobuf.FieldMask update_mask = 3;
517}
518
519// -
520message QuantumRunStreamRequest {
521  // -
522  string message_id = 1;
523
524  // -
525  string parent = 2;
526
527  // -
528  oneof request {
529    // -
530    CreateQuantumProgramAndJobRequest create_quantum_program_and_job = 3;
531
532    // -
533    CreateQuantumJobRequest create_quantum_job = 4;
534
535    // -
536    GetQuantumResultRequest get_quantum_result = 5;
537  }
538}
539
540// -
541message CreateQuantumProgramAndJobRequest {
542  // -
543  string parent = 1;
544
545  // -
546  QuantumProgram quantum_program = 2;
547
548  // -
549  QuantumJob quantum_job = 3;
550}
551
552// -
553message QuantumRunStreamResponse {
554  // -
555  string message_id = 1;
556
557  // -
558  oneof response {
559    // -
560    StreamError error = 2;
561
562    // -
563    QuantumJob job = 3;
564
565    // -
566    QuantumResult result = 4;
567  }
568}
569
570// -
571message StreamError {
572  // -
573  enum Code {
574    // -
575    CODE_UNSPECIFIED = 0;
576
577    // -
578    INTERNAL = 1;
579
580    // -
581    INVALID_ARGUMENT = 2;
582
583    // -
584    PERMISSION_DENIED = 3;
585
586    // -
587    PROGRAM_ALREADY_EXISTS = 4;
588
589    // -
590    JOB_ALREADY_EXISTS = 5;
591
592    // -
593    PROGRAM_DOES_NOT_EXIST = 6;
594
595    // -
596    JOB_DOES_NOT_EXIST = 7;
597
598    // -
599    PROCESSOR_DOES_NOT_EXIST = 8;
600
601    // -
602    INVALID_PROCESSOR_FOR_JOB = 9;
603
604    // -
605    RESERVATION_REQUIRED = 10;
606  }
607
608  // -
609  Code code = 1;
610
611  // -
612  string message = 2;
613}
614
615// -
616message ListQuantumReservationGrantsRequest {
617  // -
618  string parent = 1;
619
620  // -
621  int32 page_size = 2;
622
623  // -
624  string page_token = 3;
625
626  // -
627  string filter = 4;
628}
629
630// -
631message ListQuantumReservationGrantsResponse {
632  // -
633  repeated QuantumReservationGrant reservation_grants = 1;
634
635  // -
636  string next_page_token = 2;
637}
638
639// -
640message ReallocateQuantumReservationGrantRequest {
641  // -
642  string name = 1;
643
644  // -
645  string source_project_id = 2;
646
647  // -
648  string target_project_id = 3;
649
650  // -
651  .google.protobuf.Duration duration = 4;
652}
653
654// -
655message ListQuantumReservationBudgetsRequest {
656  // -
657  string parent = 1;
658
659  // -
660  int32 page_size = 2;
661
662  // -
663  string page_token = 3;
664
665  // -
666  string filter = 4;
667}
668
669// -
670message ListQuantumReservationBudgetsResponse {
671  // -
672  repeated QuantumReservationBudget reservation_budgets = 1;
673
674  // -
675  string next_page_token = 2;
676}
677
678// -
679message ListQuantumTimeSlotsRequest {
680  // -
681  string parent = 1;
682
683  // -
684  int32 page_size = 2;
685
686  // -
687  string page_token = 3;
688
689  // -
690  string filter = 4;
691}
692
693// -
694message ListQuantumTimeSlotsResponse {
695  // -
696  repeated QuantumTimeSlot time_slots = 1;
697
698  // -
699  string next_page_token = 2;
700}
701