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 |
|
---|
18 | namespace Google\Service\Dataproc\Resource;
|
---|
19 |
|
---|
20 | use Google\Service\Dataproc\AnalyzeBatchRequest;
|
---|
21 | use Google\Service\Dataproc\Batch;
|
---|
22 | use Google\Service\Dataproc\DataprocEmpty;
|
---|
23 | use Google\Service\Dataproc\ListBatchesResponse;
|
---|
24 | use Google\Service\Dataproc\Operation;
|
---|
25 |
|
---|
26 | /**
|
---|
27 | * The "batches" collection of methods.
|
---|
28 | * Typical usage is:
|
---|
29 | * <code>
|
---|
30 | * $dataprocService = new Google\Service\Dataproc(...);
|
---|
31 | * $batches = $dataprocService->projects_locations_batches;
|
---|
32 | * </code>
|
---|
33 | */
|
---|
34 | class ProjectsLocationsBatches extends \Google\Service\Resource
|
---|
35 | {
|
---|
36 | /**
|
---|
37 | * Analyze a Batch for possible recommendations and insights. (batches.analyze)
|
---|
38 | *
|
---|
39 | * @param string $name Required. The fully qualified name of the batch to
|
---|
40 | * analyze in the format
|
---|
41 | * "projects/PROJECT_ID/locations/DATAPROC_REGION/batches/BATCH_ID"
|
---|
42 | * @param AnalyzeBatchRequest $postBody
|
---|
43 | * @param array $optParams Optional parameters.
|
---|
44 | * @return Operation
|
---|
45 | * @throws \Google\Service\Exception
|
---|
46 | */
|
---|
47 | public function analyze($name, AnalyzeBatchRequest $postBody, $optParams = [])
|
---|
48 | {
|
---|
49 | $params = ['name' => $name, 'postBody' => $postBody];
|
---|
50 | $params = array_merge($params, $optParams);
|
---|
51 | return $this->call('analyze', [$params], Operation::class);
|
---|
52 | }
|
---|
53 | /**
|
---|
54 | * Creates a batch workload that executes asynchronously. (batches.create)
|
---|
55 | *
|
---|
56 | * @param string $parent Required. The parent resource where this batch will be
|
---|
57 | * created.
|
---|
58 | * @param Batch $postBody
|
---|
59 | * @param array $optParams Optional parameters.
|
---|
60 | *
|
---|
61 | * @opt_param string batchId Optional. The ID to use for the batch, which will
|
---|
62 | * become the final component of the batch's resource name.This value must be
|
---|
63 | * 4-63 characters. Valid characters are /[a-z][0-9]-/.
|
---|
64 | * @opt_param string requestId Optional. A unique ID used to identify the
|
---|
65 | * request. If the service receives two CreateBatchRequest (https://cloud.google
|
---|
66 | * .com/dataproc/docs/reference/rpc/google.cloud.dataproc.v1#google.cloud.datapr
|
---|
67 | * oc.v1.CreateBatchRequest)s with the same request_id, the second request is
|
---|
68 | * ignored and the Operation that corresponds to the first Batch created and
|
---|
69 | * stored in the backend is returned.Recommendation: Set this value to a UUID
|
---|
70 | * (https://en.wikipedia.org/wiki/Universally_unique_identifier).The value must
|
---|
71 | * contain only letters (a-z, A-Z), numbers (0-9), underscores (_), and hyphens
|
---|
72 | * (-). The maximum length is 40 characters.
|
---|
73 | * @return Operation
|
---|
74 | * @throws \Google\Service\Exception
|
---|
75 | */
|
---|
76 | public function create($parent, Batch $postBody, $optParams = [])
|
---|
77 | {
|
---|
78 | $params = ['parent' => $parent, 'postBody' => $postBody];
|
---|
79 | $params = array_merge($params, $optParams);
|
---|
80 | return $this->call('create', [$params], Operation::class);
|
---|
81 | }
|
---|
82 | /**
|
---|
83 | * Deletes the batch workload resource. If the batch is not in a CANCELLED,
|
---|
84 | * SUCCEEDED or FAILED State, the delete operation fails and the response
|
---|
85 | * returns FAILED_PRECONDITION. (batches.delete)
|
---|
86 | *
|
---|
87 | * @param string $name Required. The fully qualified name of the batch to
|
---|
88 | * retrieve in the format
|
---|
89 | * "projects/PROJECT_ID/locations/DATAPROC_REGION/batches/BATCH_ID"
|
---|
90 | * @param array $optParams Optional parameters.
|
---|
91 | * @return DataprocEmpty
|
---|
92 | * @throws \Google\Service\Exception
|
---|
93 | */
|
---|
94 | public function delete($name, $optParams = [])
|
---|
95 | {
|
---|
96 | $params = ['name' => $name];
|
---|
97 | $params = array_merge($params, $optParams);
|
---|
98 | return $this->call('delete', [$params], DataprocEmpty::class);
|
---|
99 | }
|
---|
100 | /**
|
---|
101 | * Gets the batch workload resource representation. (batches.get)
|
---|
102 | *
|
---|
103 | * @param string $name Required. The fully qualified name of the batch to
|
---|
104 | * retrieve in the format
|
---|
105 | * "projects/PROJECT_ID/locations/DATAPROC_REGION/batches/BATCH_ID"
|
---|
106 | * @param array $optParams Optional parameters.
|
---|
107 | * @return Batch
|
---|
108 | * @throws \Google\Service\Exception
|
---|
109 | */
|
---|
110 | public function get($name, $optParams = [])
|
---|
111 | {
|
---|
112 | $params = ['name' => $name];
|
---|
113 | $params = array_merge($params, $optParams);
|
---|
114 | return $this->call('get', [$params], Batch::class);
|
---|
115 | }
|
---|
116 | /**
|
---|
117 | * Lists batch workloads. (batches.listProjectsLocationsBatches)
|
---|
118 | *
|
---|
119 | * @param string $parent Required. The parent, which owns this collection of
|
---|
120 | * batches.
|
---|
121 | * @param array $optParams Optional parameters.
|
---|
122 | *
|
---|
123 | * @opt_param string filter Optional. A filter for the batches to return in the
|
---|
124 | * response.A filter is a logical expression constraining the values of various
|
---|
125 | * fields in each batch resource. Filters are case sensitive, and may contain
|
---|
126 | * multiple clauses combined with logical operators (AND/OR). Supported fields
|
---|
127 | * are batch_id, batch_uuid, state, create_time, and labels.e.g. state = RUNNING
|
---|
128 | * and create_time < "2023-01-01T00:00:00Z" filters for batches in state RUNNING
|
---|
129 | * that were created before 2023-01-01. state = RUNNING and
|
---|
130 | * labels.environment=production filters for batches in state in a RUNNING state
|
---|
131 | * that have a production environment label.See
|
---|
132 | * https://google.aip.dev/assets/misc/ebnf-filtering.txt for a detailed
|
---|
133 | * description of the filter syntax and a list of supported comparisons.
|
---|
134 | * @opt_param string orderBy Optional. Field(s) on which to sort the list of
|
---|
135 | * batches.Currently the only supported sort orders are unspecified (empty) and
|
---|
136 | * create_time desc to sort by most recently created batches first.See
|
---|
137 | * https://google.aip.dev/132#ordering for more details.
|
---|
138 | * @opt_param int pageSize Optional. The maximum number of batches to return in
|
---|
139 | * each response. The service may return fewer than this value. The default page
|
---|
140 | * size is 20; the maximum page size is 1000.
|
---|
141 | * @opt_param string pageToken Optional. A page token received from a previous
|
---|
142 | * ListBatches call. Provide this token to retrieve the subsequent page.
|
---|
143 | * @return ListBatchesResponse
|
---|
144 | * @throws \Google\Service\Exception
|
---|
145 | */
|
---|
146 | public function listProjectsLocationsBatches($parent, $optParams = [])
|
---|
147 | {
|
---|
148 | $params = ['parent' => $parent];
|
---|
149 | $params = array_merge($params, $optParams);
|
---|
150 | return $this->call('list', [$params], ListBatchesResponse::class);
|
---|
151 | }
|
---|
152 | }
|
---|
153 |
|
---|
154 | // Adding a class alias for backwards compatibility with the previous class name.
|
---|
155 | class_alias(ProjectsLocationsBatches::class, 'Google_Service_Dataproc_Resource_ProjectsLocationsBatches');
|
---|