1<?php 2/* 3 * Copyright 2014 Google Inc. 4 * 5 * Licensed under the Apache License, Version 2.0 (the "License"); you may not 6 * use this file except in compliance with the License. You may obtain a copy of 7 * the License at 8 * 9 * http://www.apache.org/licenses/LICENSE-2.0 10 * 11 * Unless required by applicable law or agreed to in writing, software 12 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 13 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 14 * License for the specific language governing permissions and limitations under 15 * the License. 16 */ 17 18namespace Google\Service\Dataproc\Resource; 19 20use Google\Service\Dataproc\Batch; 21use Google\Service\Dataproc\DataprocEmpty; 22use Google\Service\Dataproc\ListBatchesResponse; 23use Google\Service\Dataproc\Operation; 24 25/** 26 * The "batches" collection of methods. 27 * Typical usage is: 28 * <code> 29 * $dataprocService = new Google\Service\Dataproc(...); 30 * $batches = $dataprocService->batches; 31 * </code> 32 */ 33class ProjectsLocationsBatches extends \Google\Service\Resource 34{ 35 /** 36 * Creates a batch workload that executes asynchronously. (batches.create) 37 * 38 * @param string $parent Required. The parent resource where this batch will be 39 * created. 40 * @param Batch $postBody 41 * @param array $optParams Optional parameters. 42 * 43 * @opt_param string batchId Optional. The ID to use for the batch, which will 44 * become the final component of the batch's resource name.This value must be 45 * 4-63 characters. Valid characters are /[a-z][0-9]-/. 46 * @opt_param string requestId Optional. A unique ID used to identify the 47 * request. If the service receives two CreateBatchRequest (https://cloud.google 48 * .com/dataproc/docs/reference/rpc/google.cloud.dataproc.v1#google.cloud.datapr 49 * oc.v1.CreateBatchRequest)s with the same request_id, the second request is 50 * ignored and the Operation that corresponds to the first Batch created and 51 * stored in the backend is returned.Recommendation: Set this value to a UUID 52 * (https://en.wikipedia.org/wiki/Universally_unique_identifier).The value must 53 * contain only letters (a-z, A-Z), numbers (0-9), underscores (_), and hyphens 54 * (-). The maximum length is 40 characters. 55 * @return Operation 56 */ 57 public function create($parent, Batch $postBody, $optParams = []) 58 { 59 $params = ['parent' => $parent, 'postBody' => $postBody]; 60 $params = array_merge($params, $optParams); 61 return $this->call('create', [$params], Operation::class); 62 } 63 /** 64 * Deletes the batch workload resource. If the batch is not in terminal state, 65 * the delete fails and the response returns FAILED_PRECONDITION. 66 * (batches.delete) 67 * 68 * @param string $name Required. The name of the batch resource to delete. 69 * @param array $optParams Optional parameters. 70 * @return DataprocEmpty 71 */ 72 public function delete($name, $optParams = []) 73 { 74 $params = ['name' => $name]; 75 $params = array_merge($params, $optParams); 76 return $this->call('delete', [$params], DataprocEmpty::class); 77 } 78 /** 79 * Gets the batch workload resource representation. (batches.get) 80 * 81 * @param string $name Required. The name of the batch to retrieve. 82 * @param array $optParams Optional parameters. 83 * @return Batch 84 */ 85 public function get($name, $optParams = []) 86 { 87 $params = ['name' => $name]; 88 $params = array_merge($params, $optParams); 89 return $this->call('get', [$params], Batch::class); 90 } 91 /** 92 * Lists batch workloads. (batches.listProjectsLocationsBatches) 93 * 94 * @param string $parent Required. The parent, which owns this collection of 95 * batches. 96 * @param array $optParams Optional parameters. 97 * 98 * @opt_param int pageSize Optional. The maximum number of batches to return in 99 * each response. The service may return fewer than this value. The default page 100 * size is 20; the maximum page size is 1000. 101 * @opt_param string pageToken Optional. A page token received from a previous 102 * ListBatches call. Provide this token to retrieve the subsequent page. 103 * @return ListBatchesResponse 104 */ 105 public function listProjectsLocationsBatches($parent, $optParams = []) 106 { 107 $params = ['parent' => $parent]; 108 $params = array_merge($params, $optParams); 109 return $this->call('list', [$params], ListBatchesResponse::class); 110 } 111} 112 113// Adding a class alias for backwards compatibility with the previous class name. 114class_alias(ProjectsLocationsBatches::class, 'Google_Service_Dataproc_Resource_ProjectsLocationsBatches'); 115