batch_job_service.proto 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269
  1. // Copyright 2022 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. syntax = "proto3";
  15. package google.ads.googleads.v12.services;
  16. import "google/ads/googleads/v12/enums/response_content_type.proto";
  17. import "google/ads/googleads/v12/resources/batch_job.proto";
  18. import "google/ads/googleads/v12/services/google_ads_service.proto";
  19. import "google/api/annotations.proto";
  20. import "google/api/client.proto";
  21. import "google/api/field_behavior.proto";
  22. import "google/api/resource.proto";
  23. import "google/longrunning/operations.proto";
  24. import "google/rpc/status.proto";
  25. option csharp_namespace = "Google.Ads.GoogleAds.V12.Services";
  26. option go_package = "google.golang.org/genproto/googleapis/ads/googleads/v12/services;services";
  27. option java_multiple_files = true;
  28. option java_outer_classname = "BatchJobServiceProto";
  29. option java_package = "com.google.ads.googleads.v12.services";
  30. option objc_class_prefix = "GAA";
  31. option php_namespace = "Google\\Ads\\GoogleAds\\V12\\Services";
  32. option ruby_package = "Google::Ads::GoogleAds::V12::Services";
  33. // Proto file describing the BatchJobService.
  34. // Service to manage batch jobs.
  35. service BatchJobService {
  36. option (google.api.default_host) = "googleads.googleapis.com";
  37. option (google.api.oauth_scopes) = "https://www.googleapis.com/auth/adwords";
  38. // Mutates a batch job.
  39. //
  40. // List of thrown errors:
  41. // [AuthenticationError]()
  42. // [AuthorizationError]()
  43. // [HeaderError]()
  44. // [InternalError]()
  45. // [QuotaError]()
  46. // [RequestError]()
  47. // [ResourceCountLimitExceededError]()
  48. rpc MutateBatchJob(MutateBatchJobRequest) returns (MutateBatchJobResponse) {
  49. option (google.api.http) = {
  50. post: "/v12/customers/{customer_id=*}/batchJobs:mutate"
  51. body: "*"
  52. };
  53. option (google.api.method_signature) = "customer_id,operation";
  54. }
  55. // Returns the results of the batch job. The job must be done.
  56. // Supports standard list paging.
  57. //
  58. // List of thrown errors:
  59. // [AuthenticationError]()
  60. // [AuthorizationError]()
  61. // [BatchJobError]()
  62. // [HeaderError]()
  63. // [InternalError]()
  64. // [QuotaError]()
  65. // [RequestError]()
  66. rpc ListBatchJobResults(ListBatchJobResultsRequest) returns (ListBatchJobResultsResponse) {
  67. option (google.api.http) = {
  68. get: "/v12/{resource_name=customers/*/batchJobs/*}:listResults"
  69. };
  70. option (google.api.method_signature) = "resource_name";
  71. }
  72. // Runs the batch job.
  73. //
  74. // The Operation.metadata field type is BatchJobMetadata. When finished, the
  75. // long running operation will not contain errors or a response. Instead, use
  76. // ListBatchJobResults to get the results of the job.
  77. //
  78. // List of thrown errors:
  79. // [AuthenticationError]()
  80. // [AuthorizationError]()
  81. // [BatchJobError]()
  82. // [HeaderError]()
  83. // [InternalError]()
  84. // [QuotaError]()
  85. // [RequestError]()
  86. rpc RunBatchJob(RunBatchJobRequest) returns (google.longrunning.Operation) {
  87. option (google.api.http) = {
  88. post: "/v12/{resource_name=customers/*/batchJobs/*}:run"
  89. body: "*"
  90. };
  91. option (google.api.method_signature) = "resource_name";
  92. option (google.longrunning.operation_info) = {
  93. response_type: "google.protobuf.Empty"
  94. metadata_type: "google.ads.googleads.v12.resources.BatchJob.BatchJobMetadata"
  95. };
  96. }
  97. // Add operations to the batch job.
  98. //
  99. // List of thrown errors:
  100. // [AuthenticationError]()
  101. // [AuthorizationError]()
  102. // [BatchJobError]()
  103. // [HeaderError]()
  104. // [InternalError]()
  105. // [QuotaError]()
  106. // [RequestError]()
  107. // [ResourceCountLimitExceededError]()
  108. rpc AddBatchJobOperations(AddBatchJobOperationsRequest) returns (AddBatchJobOperationsResponse) {
  109. option (google.api.http) = {
  110. post: "/v12/{resource_name=customers/*/batchJobs/*}:addOperations"
  111. body: "*"
  112. };
  113. option (google.api.method_signature) = "resource_name,sequence_token,mutate_operations";
  114. option (google.api.method_signature) = "resource_name,mutate_operations";
  115. }
  116. }
  117. // Request message for [BatchJobService.MutateBatchJob][google.ads.googleads.v12.services.BatchJobService.MutateBatchJob].
  118. message MutateBatchJobRequest {
  119. // Required. The ID of the customer for which to create a batch job.
  120. string customer_id = 1 [(google.api.field_behavior) = REQUIRED];
  121. // Required. The operation to perform on an individual batch job.
  122. BatchJobOperation operation = 2 [(google.api.field_behavior) = REQUIRED];
  123. }
  124. // A single operation on a batch job.
  125. message BatchJobOperation {
  126. // The mutate operation.
  127. oneof operation {
  128. // Create operation: No resource name is expected for the new batch job.
  129. google.ads.googleads.v12.resources.BatchJob create = 1;
  130. // Remove operation: The batch job must not have been run. A resource name
  131. // for the removed batch job is expected, in this format:
  132. //
  133. // `customers/{customer_id}/batchJobs/{batch_job_id}`
  134. string remove = 4 [(google.api.resource_reference) = {
  135. type: "googleads.googleapis.com/BatchJob"
  136. }];
  137. }
  138. }
  139. // Response message for [BatchJobService.MutateBatchJob][google.ads.googleads.v12.services.BatchJobService.MutateBatchJob].
  140. message MutateBatchJobResponse {
  141. // The result for the mutate.
  142. MutateBatchJobResult result = 1;
  143. }
  144. // The result for the batch job mutate.
  145. message MutateBatchJobResult {
  146. // The resource name of the batch job.
  147. string resource_name = 1 [(google.api.resource_reference) = {
  148. type: "googleads.googleapis.com/BatchJob"
  149. }];
  150. }
  151. // Request message for [BatchJobService.RunBatchJob][google.ads.googleads.v12.services.BatchJobService.RunBatchJob].
  152. message RunBatchJobRequest {
  153. // Required. The resource name of the BatchJob to run.
  154. string resource_name = 1 [
  155. (google.api.field_behavior) = REQUIRED,
  156. (google.api.resource_reference) = {
  157. type: "googleads.googleapis.com/BatchJob"
  158. }
  159. ];
  160. }
  161. // Request message for [BatchJobService.AddBatchJobOperations][google.ads.googleads.v12.services.BatchJobService.AddBatchJobOperations].
  162. message AddBatchJobOperationsRequest {
  163. // Required. The resource name of the batch job.
  164. string resource_name = 1 [
  165. (google.api.field_behavior) = REQUIRED,
  166. (google.api.resource_reference) = {
  167. type: "googleads.googleapis.com/BatchJob"
  168. }
  169. ];
  170. // A token used to enforce sequencing.
  171. //
  172. // The first AddBatchJobOperations request for a batch job should not set
  173. // sequence_token. Subsequent requests must set sequence_token to the value of
  174. // next_sequence_token received in the previous AddBatchJobOperations
  175. // response.
  176. string sequence_token = 2;
  177. // Required. The list of mutates being added.
  178. //
  179. // Operations can use negative integers as temp ids to signify dependencies
  180. // between entities created in this batch job. For example, a customer with
  181. // id = 1234 can create a campaign and an ad group in that same campaign by
  182. // creating a campaign in the first operation with the resource name
  183. // explicitly set to "customers/1234/campaigns/-1", and creating an ad group
  184. // in the second operation with the campaign field also set to
  185. // "customers/1234/campaigns/-1".
  186. repeated MutateOperation mutate_operations = 3 [(google.api.field_behavior) = REQUIRED];
  187. }
  188. // Response message for [BatchJobService.AddBatchJobOperations][google.ads.googleads.v12.services.BatchJobService.AddBatchJobOperations].
  189. message AddBatchJobOperationsResponse {
  190. // The total number of operations added so far for this batch job.
  191. int64 total_operations = 1;
  192. // The sequence token to be used when calling AddBatchJobOperations again if
  193. // more operations need to be added. The next AddBatchJobOperations request
  194. // must set the sequence_token field to the value of this field.
  195. string next_sequence_token = 2;
  196. }
  197. // Request message for [BatchJobService.ListBatchJobResults][google.ads.googleads.v12.services.BatchJobService.ListBatchJobResults].
  198. message ListBatchJobResultsRequest {
  199. // Required. The resource name of the batch job whose results are being listed.
  200. string resource_name = 1 [
  201. (google.api.field_behavior) = REQUIRED,
  202. (google.api.resource_reference) = {
  203. type: "googleads.googleapis.com/BatchJob"
  204. }
  205. ];
  206. // Token of the page to retrieve. If not specified, the first
  207. // page of results will be returned. Use the value obtained from
  208. // `next_page_token` in the previous response in order to request
  209. // the next page of results.
  210. string page_token = 2;
  211. // Number of elements to retrieve in a single page.
  212. // When a page request is too large, the server may decide to
  213. // further limit the number of returned resources.
  214. int32 page_size = 3;
  215. // The response content type setting. Determines whether the mutable resource
  216. // or just the resource name should be returned.
  217. google.ads.googleads.v12.enums.ResponseContentTypeEnum.ResponseContentType response_content_type = 4;
  218. }
  219. // Response message for [BatchJobService.ListBatchJobResults][google.ads.googleads.v12.services.BatchJobService.ListBatchJobResults].
  220. message ListBatchJobResultsResponse {
  221. // The list of rows that matched the query.
  222. repeated BatchJobResult results = 1;
  223. // Pagination token used to retrieve the next page of results.
  224. // Pass the content of this string as the `page_token` attribute of
  225. // the next request. `next_page_token` is not returned for the last
  226. // page.
  227. string next_page_token = 2;
  228. }
  229. // An individual batch job result.
  230. message BatchJobResult {
  231. // Index of the mutate operation.
  232. int64 operation_index = 1;
  233. // Response for the mutate.
  234. // May be empty if errors occurred.
  235. MutateOperationResponse mutate_operation_response = 2;
  236. // Details of the errors when processing the operation.
  237. google.rpc.Status status = 3;
  238. }