[e3d4e0a] | 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\AIPlatformNotebooks\Resource;
|
---|
| 19 |
|
---|
| 20 | use Google\Service\AIPlatformNotebooks\DiagnoseRuntimeRequest;
|
---|
| 21 | use Google\Service\AIPlatformNotebooks\ListRuntimesResponse;
|
---|
| 22 | use Google\Service\AIPlatformNotebooks\Operation;
|
---|
| 23 | use Google\Service\AIPlatformNotebooks\Policy;
|
---|
| 24 | use Google\Service\AIPlatformNotebooks\RefreshRuntimeTokenInternalRequest;
|
---|
| 25 | use Google\Service\AIPlatformNotebooks\RefreshRuntimeTokenInternalResponse;
|
---|
| 26 | use Google\Service\AIPlatformNotebooks\ReportRuntimeEventRequest;
|
---|
| 27 | use Google\Service\AIPlatformNotebooks\ResetRuntimeRequest;
|
---|
| 28 | use Google\Service\AIPlatformNotebooks\Runtime;
|
---|
| 29 | use Google\Service\AIPlatformNotebooks\SetIamPolicyRequest;
|
---|
| 30 | use Google\Service\AIPlatformNotebooks\StartRuntimeRequest;
|
---|
| 31 | use Google\Service\AIPlatformNotebooks\StopRuntimeRequest;
|
---|
| 32 | use Google\Service\AIPlatformNotebooks\SwitchRuntimeRequest;
|
---|
| 33 | use Google\Service\AIPlatformNotebooks\TestIamPermissionsRequest;
|
---|
| 34 | use Google\Service\AIPlatformNotebooks\TestIamPermissionsResponse;
|
---|
| 35 | use Google\Service\AIPlatformNotebooks\UpgradeRuntimeRequest;
|
---|
| 36 |
|
---|
| 37 | /**
|
---|
| 38 | * The "runtimes" collection of methods.
|
---|
| 39 | * Typical usage is:
|
---|
| 40 | * <code>
|
---|
| 41 | * $notebooksService = new Google\Service\AIPlatformNotebooks(...);
|
---|
| 42 | * $runtimes = $notebooksService->projects_locations_runtimes;
|
---|
| 43 | * </code>
|
---|
| 44 | */
|
---|
| 45 | class ProjectsLocationsRuntimes extends \Google\Service\Resource
|
---|
| 46 | {
|
---|
| 47 | /**
|
---|
| 48 | * Creates a new Runtime in a given project and location. (runtimes.create)
|
---|
| 49 | *
|
---|
| 50 | * @param string $parent Required. Format:
|
---|
| 51 | * `parent=projects/{project_id}/locations/{location}`
|
---|
| 52 | * @param Runtime $postBody
|
---|
| 53 | * @param array $optParams Optional parameters.
|
---|
| 54 | *
|
---|
| 55 | * @opt_param string requestId Idempotent request UUID.
|
---|
| 56 | * @opt_param string runtimeId Required. User-defined unique ID of this Runtime.
|
---|
| 57 | * @return Operation
|
---|
| 58 | */
|
---|
| 59 | public function create($parent, Runtime $postBody, $optParams = [])
|
---|
| 60 | {
|
---|
| 61 | $params = ['parent' => $parent, 'postBody' => $postBody];
|
---|
| 62 | $params = array_merge($params, $optParams);
|
---|
| 63 | return $this->call('create', [$params], Operation::class);
|
---|
| 64 | }
|
---|
| 65 | /**
|
---|
| 66 | * Deletes a single Runtime. (runtimes.delete)
|
---|
| 67 | *
|
---|
| 68 | * @param string $name Required. Format:
|
---|
| 69 | * `projects/{project_id}/locations/{location}/runtimes/{runtime_id}`
|
---|
| 70 | * @param array $optParams Optional parameters.
|
---|
| 71 | *
|
---|
| 72 | * @opt_param string requestId Idempotent request UUID.
|
---|
| 73 | * @return Operation
|
---|
| 74 | */
|
---|
| 75 | public function delete($name, $optParams = [])
|
---|
| 76 | {
|
---|
| 77 | $params = ['name' => $name];
|
---|
| 78 | $params = array_merge($params, $optParams);
|
---|
| 79 | return $this->call('delete', [$params], Operation::class);
|
---|
| 80 | }
|
---|
| 81 | /**
|
---|
| 82 | * Creates a Diagnostic File and runs Diagnostic Tool given a Runtime.
|
---|
| 83 | * (runtimes.diagnose)
|
---|
| 84 | *
|
---|
| 85 | * @param string $name Required. Format:
|
---|
| 86 | * `projects/{project_id}/locations/{location}/runtimes/{runtimes_id}`
|
---|
| 87 | * @param DiagnoseRuntimeRequest $postBody
|
---|
| 88 | * @param array $optParams Optional parameters.
|
---|
| 89 | * @return Operation
|
---|
| 90 | */
|
---|
| 91 | public function diagnose($name, DiagnoseRuntimeRequest $postBody, $optParams = [])
|
---|
| 92 | {
|
---|
| 93 | $params = ['name' => $name, 'postBody' => $postBody];
|
---|
| 94 | $params = array_merge($params, $optParams);
|
---|
| 95 | return $this->call('diagnose', [$params], Operation::class);
|
---|
| 96 | }
|
---|
| 97 | /**
|
---|
| 98 | * Gets details of a single Runtime. The location must be a regional endpoint
|
---|
| 99 | * rather than zonal. (runtimes.get)
|
---|
| 100 | *
|
---|
| 101 | * @param string $name Required. Format:
|
---|
| 102 | * `projects/{project_id}/locations/{location}/runtimes/{runtime_id}`
|
---|
| 103 | * @param array $optParams Optional parameters.
|
---|
| 104 | * @return Runtime
|
---|
| 105 | */
|
---|
| 106 | public function get($name, $optParams = [])
|
---|
| 107 | {
|
---|
| 108 | $params = ['name' => $name];
|
---|
| 109 | $params = array_merge($params, $optParams);
|
---|
| 110 | return $this->call('get', [$params], Runtime::class);
|
---|
| 111 | }
|
---|
| 112 | /**
|
---|
| 113 | * Gets the access control policy for a resource. Returns an empty policy if the
|
---|
| 114 | * resource exists and does not have a policy set. (runtimes.getIamPolicy)
|
---|
| 115 | *
|
---|
| 116 | * @param string $resource REQUIRED: The resource for which the policy is being
|
---|
| 117 | * requested. See [Resource
|
---|
| 118 | * names](https://cloud.google.com/apis/design/resource_names) for the
|
---|
| 119 | * appropriate value for this field.
|
---|
| 120 | * @param array $optParams Optional parameters.
|
---|
| 121 | *
|
---|
| 122 | * @opt_param int options.requestedPolicyVersion Optional. The maximum policy
|
---|
| 123 | * version that will be used to format the policy. Valid values are 0, 1, and 3.
|
---|
| 124 | * Requests specifying an invalid value will be rejected. Requests for policies
|
---|
| 125 | * with any conditional role bindings must specify version 3. Policies with no
|
---|
| 126 | * conditional role bindings may specify any valid value or leave the field
|
---|
| 127 | * unset. The policy in the response might use the policy version that you
|
---|
| 128 | * specified, or it might use a lower policy version. For example, if you
|
---|
| 129 | * specify version 3, but the policy has no conditional role bindings, the
|
---|
| 130 | * response uses version 1. To learn which resources support conditions in their
|
---|
| 131 | * IAM policies, see the [IAM
|
---|
| 132 | * documentation](https://cloud.google.com/iam/help/conditions/resource-
|
---|
| 133 | * policies).
|
---|
| 134 | * @return Policy
|
---|
| 135 | */
|
---|
| 136 | public function getIamPolicy($resource, $optParams = [])
|
---|
| 137 | {
|
---|
| 138 | $params = ['resource' => $resource];
|
---|
| 139 | $params = array_merge($params, $optParams);
|
---|
| 140 | return $this->call('getIamPolicy', [$params], Policy::class);
|
---|
| 141 | }
|
---|
| 142 | /**
|
---|
| 143 | * Lists Runtimes in a given project and location.
|
---|
| 144 | * (runtimes.listProjectsLocationsRuntimes)
|
---|
| 145 | *
|
---|
| 146 | * @param string $parent Required. Format:
|
---|
| 147 | * `parent=projects/{project_id}/locations/{location}`
|
---|
| 148 | * @param array $optParams Optional parameters.
|
---|
| 149 | *
|
---|
| 150 | * @opt_param int pageSize Maximum return size of the list call.
|
---|
| 151 | * @opt_param string pageToken A previous returned page token that can be used
|
---|
| 152 | * to continue listing from the last result.
|
---|
| 153 | * @return ListRuntimesResponse
|
---|
| 154 | */
|
---|
| 155 | public function listProjectsLocationsRuntimes($parent, $optParams = [])
|
---|
| 156 | {
|
---|
| 157 | $params = ['parent' => $parent];
|
---|
| 158 | $params = array_merge($params, $optParams);
|
---|
| 159 | return $this->call('list', [$params], ListRuntimesResponse::class);
|
---|
| 160 | }
|
---|
| 161 | /**
|
---|
| 162 | * Update Notebook Runtime configuration. (runtimes.patch)
|
---|
| 163 | *
|
---|
| 164 | * @param string $name Output only. The resource name of the runtime. Format:
|
---|
| 165 | * `projects/{project}/locations/{location}/runtimes/{runtimeId}`
|
---|
| 166 | * @param Runtime $postBody
|
---|
| 167 | * @param array $optParams Optional parameters.
|
---|
| 168 | *
|
---|
| 169 | * @opt_param string requestId Idempotent request UUID.
|
---|
| 170 | * @opt_param string updateMask Required. Specifies the path, relative to
|
---|
| 171 | * `Runtime`, of the field to update. For example, to change the software
|
---|
| 172 | * configuration kernels, the `update_mask` parameter would be specified as
|
---|
| 173 | * `software_config.kernels`, and the `PATCH` request body would specify the new
|
---|
| 174 | * value, as follows: { "software_config":{ "kernels": [{ 'repository': 'gcr.io
|
---|
| 175 | * /deeplearning-platform-release/pytorch-gpu', 'tag': 'latest' }], } }
|
---|
| 176 | * Currently, only the following fields can be updated: -
|
---|
| 177 | * `software_config.kernels` - `software_config.post_startup_script` -
|
---|
| 178 | * `software_config.custom_gpu_driver_path` - `software_config.idle_shutdown` -
|
---|
| 179 | * `software_config.idle_shutdown_timeout` - `software_config.disable_terminal`
|
---|
| 180 | * - `labels`
|
---|
| 181 | * @return Operation
|
---|
| 182 | */
|
---|
| 183 | public function patch($name, Runtime $postBody, $optParams = [])
|
---|
| 184 | {
|
---|
| 185 | $params = ['name' => $name, 'postBody' => $postBody];
|
---|
| 186 | $params = array_merge($params, $optParams);
|
---|
| 187 | return $this->call('patch', [$params], Operation::class);
|
---|
| 188 | }
|
---|
| 189 | /**
|
---|
| 190 | * Gets an access token for the consumer service account that the customer
|
---|
| 191 | * attached to the runtime. Only accessible from the tenant instance.
|
---|
| 192 | * (runtimes.refreshRuntimeTokenInternal)
|
---|
| 193 | *
|
---|
| 194 | * @param string $name Required. Format:
|
---|
| 195 | * `projects/{project_id}/locations/{location}/runtimes/{runtime_id}`
|
---|
| 196 | * @param RefreshRuntimeTokenInternalRequest $postBody
|
---|
| 197 | * @param array $optParams Optional parameters.
|
---|
| 198 | * @return RefreshRuntimeTokenInternalResponse
|
---|
| 199 | */
|
---|
| 200 | public function refreshRuntimeTokenInternal($name, RefreshRuntimeTokenInternalRequest $postBody, $optParams = [])
|
---|
| 201 | {
|
---|
| 202 | $params = ['name' => $name, 'postBody' => $postBody];
|
---|
| 203 | $params = array_merge($params, $optParams);
|
---|
| 204 | return $this->call('refreshRuntimeTokenInternal', [$params], RefreshRuntimeTokenInternalResponse::class);
|
---|
| 205 | }
|
---|
| 206 | /**
|
---|
| 207 | * Report and process a runtime event. (runtimes.reportEvent)
|
---|
| 208 | *
|
---|
| 209 | * @param string $name Required. Format:
|
---|
| 210 | * `projects/{project_id}/locations/{location}/runtimes/{runtime_id}`
|
---|
| 211 | * @param ReportRuntimeEventRequest $postBody
|
---|
| 212 | * @param array $optParams Optional parameters.
|
---|
| 213 | * @return Operation
|
---|
| 214 | */
|
---|
| 215 | public function reportEvent($name, ReportRuntimeEventRequest $postBody, $optParams = [])
|
---|
| 216 | {
|
---|
| 217 | $params = ['name' => $name, 'postBody' => $postBody];
|
---|
| 218 | $params = array_merge($params, $optParams);
|
---|
| 219 | return $this->call('reportEvent', [$params], Operation::class);
|
---|
| 220 | }
|
---|
| 221 | /**
|
---|
| 222 | * Resets a Managed Notebook Runtime. (runtimes.reset)
|
---|
| 223 | *
|
---|
| 224 | * @param string $name Required. Format:
|
---|
| 225 | * `projects/{project_id}/locations/{location}/runtimes/{runtime_id}`
|
---|
| 226 | * @param ResetRuntimeRequest $postBody
|
---|
| 227 | * @param array $optParams Optional parameters.
|
---|
| 228 | * @return Operation
|
---|
| 229 | */
|
---|
| 230 | public function reset($name, ResetRuntimeRequest $postBody, $optParams = [])
|
---|
| 231 | {
|
---|
| 232 | $params = ['name' => $name, 'postBody' => $postBody];
|
---|
| 233 | $params = array_merge($params, $optParams);
|
---|
| 234 | return $this->call('reset', [$params], Operation::class);
|
---|
| 235 | }
|
---|
| 236 | /**
|
---|
| 237 | * Sets the access control policy on the specified resource. Replaces any
|
---|
| 238 | * existing policy. Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and
|
---|
| 239 | * `PERMISSION_DENIED` errors. (runtimes.setIamPolicy)
|
---|
| 240 | *
|
---|
| 241 | * @param string $resource REQUIRED: The resource for which the policy is being
|
---|
| 242 | * specified. See [Resource
|
---|
| 243 | * names](https://cloud.google.com/apis/design/resource_names) for the
|
---|
| 244 | * appropriate value for this field.
|
---|
| 245 | * @param SetIamPolicyRequest $postBody
|
---|
| 246 | * @param array $optParams Optional parameters.
|
---|
| 247 | * @return Policy
|
---|
| 248 | */
|
---|
| 249 | public function setIamPolicy($resource, SetIamPolicyRequest $postBody, $optParams = [])
|
---|
| 250 | {
|
---|
| 251 | $params = ['resource' => $resource, 'postBody' => $postBody];
|
---|
| 252 | $params = array_merge($params, $optParams);
|
---|
| 253 | return $this->call('setIamPolicy', [$params], Policy::class);
|
---|
| 254 | }
|
---|
| 255 | /**
|
---|
| 256 | * Starts a Managed Notebook Runtime. Perform "Start" on GPU instances; "Resume"
|
---|
| 257 | * on CPU instances See: https://cloud.google.com/compute/docs/instances/stop-
|
---|
| 258 | * start-instance https://cloud.google.com/compute/docs/instances/suspend-
|
---|
| 259 | * resume-instance (runtimes.start)
|
---|
| 260 | *
|
---|
| 261 | * @param string $name Required. Format:
|
---|
| 262 | * `projects/{project_id}/locations/{location}/runtimes/{runtime_id}`
|
---|
| 263 | * @param StartRuntimeRequest $postBody
|
---|
| 264 | * @param array $optParams Optional parameters.
|
---|
| 265 | * @return Operation
|
---|
| 266 | */
|
---|
| 267 | public function start($name, StartRuntimeRequest $postBody, $optParams = [])
|
---|
| 268 | {
|
---|
| 269 | $params = ['name' => $name, 'postBody' => $postBody];
|
---|
| 270 | $params = array_merge($params, $optParams);
|
---|
| 271 | return $this->call('start', [$params], Operation::class);
|
---|
| 272 | }
|
---|
| 273 | /**
|
---|
| 274 | * Stops a Managed Notebook Runtime. Perform "Stop" on GPU instances; "Suspend"
|
---|
| 275 | * on CPU instances See: https://cloud.google.com/compute/docs/instances/stop-
|
---|
| 276 | * start-instance https://cloud.google.com/compute/docs/instances/suspend-
|
---|
| 277 | * resume-instance (runtimes.stop)
|
---|
| 278 | *
|
---|
| 279 | * @param string $name Required. Format:
|
---|
| 280 | * `projects/{project_id}/locations/{location}/runtimes/{runtime_id}`
|
---|
| 281 | * @param StopRuntimeRequest $postBody
|
---|
| 282 | * @param array $optParams Optional parameters.
|
---|
| 283 | * @return Operation
|
---|
| 284 | */
|
---|
| 285 | public function stop($name, StopRuntimeRequest $postBody, $optParams = [])
|
---|
| 286 | {
|
---|
| 287 | $params = ['name' => $name, 'postBody' => $postBody];
|
---|
| 288 | $params = array_merge($params, $optParams);
|
---|
| 289 | return $this->call('stop', [$params], Operation::class);
|
---|
| 290 | }
|
---|
| 291 | /**
|
---|
| 292 | * Switch a Managed Notebook Runtime. (runtimes.switchProjectsLocationsRuntimes)
|
---|
| 293 | *
|
---|
| 294 | * @param string $name Required. Format:
|
---|
| 295 | * `projects/{project_id}/locations/{location}/runtimes/{runtime_id}`
|
---|
| 296 | * @param SwitchRuntimeRequest $postBody
|
---|
| 297 | * @param array $optParams Optional parameters.
|
---|
| 298 | * @return Operation
|
---|
| 299 | */
|
---|
| 300 | public function switchProjectsLocationsRuntimes($name, SwitchRuntimeRequest $postBody, $optParams = [])
|
---|
| 301 | {
|
---|
| 302 | $params = ['name' => $name, 'postBody' => $postBody];
|
---|
| 303 | $params = array_merge($params, $optParams);
|
---|
| 304 | return $this->call('switch', [$params], Operation::class);
|
---|
| 305 | }
|
---|
| 306 | /**
|
---|
| 307 | * Returns permissions that a caller has on the specified resource. If the
|
---|
| 308 | * resource does not exist, this will return an empty set of permissions, not a
|
---|
| 309 | * `NOT_FOUND` error. Note: This operation is designed to be used for building
|
---|
| 310 | * permission-aware UIs and command-line tools, not for authorization checking.
|
---|
| 311 | * This operation may "fail open" without warning. (runtimes.testIamPermissions)
|
---|
| 312 | *
|
---|
| 313 | * @param string $resource REQUIRED: The resource for which the policy detail is
|
---|
| 314 | * being requested. See [Resource
|
---|
| 315 | * names](https://cloud.google.com/apis/design/resource_names) for the
|
---|
| 316 | * appropriate value for this field.
|
---|
| 317 | * @param TestIamPermissionsRequest $postBody
|
---|
| 318 | * @param array $optParams Optional parameters.
|
---|
| 319 | * @return TestIamPermissionsResponse
|
---|
| 320 | */
|
---|
| 321 | public function testIamPermissions($resource, TestIamPermissionsRequest $postBody, $optParams = [])
|
---|
| 322 | {
|
---|
| 323 | $params = ['resource' => $resource, 'postBody' => $postBody];
|
---|
| 324 | $params = array_merge($params, $optParams);
|
---|
| 325 | return $this->call('testIamPermissions', [$params], TestIamPermissionsResponse::class);
|
---|
| 326 | }
|
---|
| 327 | /**
|
---|
| 328 | * Upgrades a Managed Notebook Runtime to the latest version. (runtimes.upgrade)
|
---|
| 329 | *
|
---|
| 330 | * @param string $name Required. Format:
|
---|
| 331 | * `projects/{project_id}/locations/{location}/runtimes/{runtime_id}`
|
---|
| 332 | * @param UpgradeRuntimeRequest $postBody
|
---|
| 333 | * @param array $optParams Optional parameters.
|
---|
| 334 | * @return Operation
|
---|
| 335 | */
|
---|
| 336 | public function upgrade($name, UpgradeRuntimeRequest $postBody, $optParams = [])
|
---|
| 337 | {
|
---|
| 338 | $params = ['name' => $name, 'postBody' => $postBody];
|
---|
| 339 | $params = array_merge($params, $optParams);
|
---|
| 340 | return $this->call('upgrade', [$params], Operation::class);
|
---|
| 341 | }
|
---|
| 342 | }
|
---|
| 343 |
|
---|
| 344 | // Adding a class alias for backwards compatibility with the previous class name.
|
---|
| 345 | class_alias(ProjectsLocationsRuntimes::class, 'Google_Service_AIPlatformNotebooks_Resource_ProjectsLocationsRuntimes');
|
---|