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\ListSessionsResponse;
|
---|
21 | use Google\Service\Dataproc\Operation;
|
---|
22 | use Google\Service\Dataproc\Session;
|
---|
23 | use Google\Service\Dataproc\TerminateSessionRequest;
|
---|
24 |
|
---|
25 | /**
|
---|
26 | * The "sessions" collection of methods.
|
---|
27 | * Typical usage is:
|
---|
28 | * <code>
|
---|
29 | * $dataprocService = new Google\Service\Dataproc(...);
|
---|
30 | * $sessions = $dataprocService->projects_locations_sessions;
|
---|
31 | * </code>
|
---|
32 | */
|
---|
33 | class ProjectsLocationsSessions extends \Google\Service\Resource
|
---|
34 | {
|
---|
35 | /**
|
---|
36 | * Create an interactive session asynchronously. (sessions.create)
|
---|
37 | *
|
---|
38 | * @param string $parent Required. The parent resource where this session will
|
---|
39 | * be created.
|
---|
40 | * @param Session $postBody
|
---|
41 | * @param array $optParams Optional parameters.
|
---|
42 | *
|
---|
43 | * @opt_param string requestId Optional. A unique ID used to identify the
|
---|
44 | * request. If the service receives two CreateSessionRequests (https://cloud.goo
|
---|
45 | * gle.com/dataproc/docs/reference/rpc/google.cloud.dataproc.v1#google.cloud.dat
|
---|
46 | * aproc.v1.CreateSessionRequest)s with the same ID, the second request is
|
---|
47 | * ignored, and the first Session is created and stored in the
|
---|
48 | * backend.Recommendation: Set this value to a UUID
|
---|
49 | * (https://en.wikipedia.org/wiki/Universally_unique_identifier).The value must
|
---|
50 | * contain only letters (a-z, A-Z), numbers (0-9), underscores (_), and hyphens
|
---|
51 | * (-). The maximum length is 40 characters.
|
---|
52 | * @opt_param string sessionId Required. The ID to use for the session, which
|
---|
53 | * becomes the final component of the session's resource name.This value must be
|
---|
54 | * 4-63 characters. Valid characters are /a-z-/.
|
---|
55 | * @return Operation
|
---|
56 | * @throws \Google\Service\Exception
|
---|
57 | */
|
---|
58 | public function create($parent, Session $postBody, $optParams = [])
|
---|
59 | {
|
---|
60 | $params = ['parent' => $parent, 'postBody' => $postBody];
|
---|
61 | $params = array_merge($params, $optParams);
|
---|
62 | return $this->call('create', [$params], Operation::class);
|
---|
63 | }
|
---|
64 | /**
|
---|
65 | * Deletes the interactive session resource. If the session is not in terminal
|
---|
66 | * state, it is terminated, and then deleted. (sessions.delete)
|
---|
67 | *
|
---|
68 | * @param string $name Required. The name of the session resource to delete.
|
---|
69 | * @param array $optParams Optional parameters.
|
---|
70 | *
|
---|
71 | * @opt_param string requestId Optional. A unique ID used to identify the
|
---|
72 | * request. If the service receives two DeleteSessionRequest (https://cloud.goog
|
---|
73 | * le.com/dataproc/docs/reference/rpc/google.cloud.dataproc.v1#google.cloud.data
|
---|
74 | * proc.v1.DeleteSessionRequest)s with the same ID, the second request is
|
---|
75 | * ignored.Recommendation: Set this value to a UUID
|
---|
76 | * (https://en.wikipedia.org/wiki/Universally_unique_identifier).The value must
|
---|
77 | * contain only letters (a-z, A-Z), numbers (0-9), underscores (_), and hyphens
|
---|
78 | * (-). The maximum length is 40 characters.
|
---|
79 | * @return Operation
|
---|
80 | * @throws \Google\Service\Exception
|
---|
81 | */
|
---|
82 | public function delete($name, $optParams = [])
|
---|
83 | {
|
---|
84 | $params = ['name' => $name];
|
---|
85 | $params = array_merge($params, $optParams);
|
---|
86 | return $this->call('delete', [$params], Operation::class);
|
---|
87 | }
|
---|
88 | /**
|
---|
89 | * Gets the resource representation for an interactive session. (sessions.get)
|
---|
90 | *
|
---|
91 | * @param string $name Required. The name of the session to retrieve.
|
---|
92 | * @param array $optParams Optional parameters.
|
---|
93 | * @return Session
|
---|
94 | * @throws \Google\Service\Exception
|
---|
95 | */
|
---|
96 | public function get($name, $optParams = [])
|
---|
97 | {
|
---|
98 | $params = ['name' => $name];
|
---|
99 | $params = array_merge($params, $optParams);
|
---|
100 | return $this->call('get', [$params], Session::class);
|
---|
101 | }
|
---|
102 | /**
|
---|
103 | * Lists interactive sessions. (sessions.listProjectsLocationsSessions)
|
---|
104 | *
|
---|
105 | * @param string $parent Required. The parent, which owns this collection of
|
---|
106 | * sessions.
|
---|
107 | * @param array $optParams Optional parameters.
|
---|
108 | *
|
---|
109 | * @opt_param string filter Optional. A filter for the sessions to return in the
|
---|
110 | * response.A filter is a logical expression constraining the values of various
|
---|
111 | * fields in each session resource. Filters are case sensitive, and may contain
|
---|
112 | * multiple clauses combined with logical operators (AND, OR). Supported fields
|
---|
113 | * are session_id, session_uuid, state, create_time, and labels.Example: state =
|
---|
114 | * ACTIVE and create_time < "2023-01-01T00:00:00Z" is a filter for sessions in
|
---|
115 | * an ACTIVE state that were created before 2023-01-01. state = ACTIVE and
|
---|
116 | * labels.environment=production is a filter for sessions in an ACTIVE state
|
---|
117 | * that have a production environment label.See
|
---|
118 | * https://google.aip.dev/assets/misc/ebnf-filtering.txt for a detailed
|
---|
119 | * description of the filter syntax and a list of supported comparators.
|
---|
120 | * @opt_param int pageSize Optional. The maximum number of sessions to return in
|
---|
121 | * each response. The service may return fewer than this value.
|
---|
122 | * @opt_param string pageToken Optional. A page token received from a previous
|
---|
123 | * ListSessions call. Provide this token to retrieve the subsequent page.
|
---|
124 | * @return ListSessionsResponse
|
---|
125 | * @throws \Google\Service\Exception
|
---|
126 | */
|
---|
127 | public function listProjectsLocationsSessions($parent, $optParams = [])
|
---|
128 | {
|
---|
129 | $params = ['parent' => $parent];
|
---|
130 | $params = array_merge($params, $optParams);
|
---|
131 | return $this->call('list', [$params], ListSessionsResponse::class);
|
---|
132 | }
|
---|
133 | /**
|
---|
134 | * Terminates the interactive session. (sessions.terminate)
|
---|
135 | *
|
---|
136 | * @param string $name Required. The name of the session resource to terminate.
|
---|
137 | * @param TerminateSessionRequest $postBody
|
---|
138 | * @param array $optParams Optional parameters.
|
---|
139 | * @return Operation
|
---|
140 | * @throws \Google\Service\Exception
|
---|
141 | */
|
---|
142 | public function terminate($name, TerminateSessionRequest $postBody, $optParams = [])
|
---|
143 | {
|
---|
144 | $params = ['name' => $name, 'postBody' => $postBody];
|
---|
145 | $params = array_merge($params, $optParams);
|
---|
146 | return $this->call('terminate', [$params], Operation::class);
|
---|
147 | }
|
---|
148 | }
|
---|
149 |
|
---|
150 | // Adding a class alias for backwards compatibility with the previous class name.
|
---|
151 | class_alias(ProjectsLocationsSessions::class, 'Google_Service_Dataproc_Resource_ProjectsLocationsSessions');
|
---|