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\Baremetalsolution\Resource;
|
---|
19 |
|
---|
20 | use Google\Service\Baremetalsolution\BaremetalsolutionEmpty;
|
---|
21 | use Google\Service\Baremetalsolution\ListVolumeSnapshotsResponse;
|
---|
22 | use Google\Service\Baremetalsolution\Operation;
|
---|
23 | use Google\Service\Baremetalsolution\RestoreVolumeSnapshotRequest;
|
---|
24 | use Google\Service\Baremetalsolution\VolumeSnapshot;
|
---|
25 |
|
---|
26 | /**
|
---|
27 | * The "snapshots" collection of methods.
|
---|
28 | * Typical usage is:
|
---|
29 | * <code>
|
---|
30 | * $baremetalsolutionService = new Google\Service\Baremetalsolution(...);
|
---|
31 | * $snapshots = $baremetalsolutionService->projects_locations_volumes_snapshots;
|
---|
32 | * </code>
|
---|
33 | */
|
---|
34 | class ProjectsLocationsVolumesSnapshots extends \Google\Service\Resource
|
---|
35 | {
|
---|
36 | /**
|
---|
37 | * Takes a snapshot of a boot volume. Returns INVALID_ARGUMENT if called for a
|
---|
38 | * non-boot volume. (snapshots.create)
|
---|
39 | *
|
---|
40 | * @param string $parent Required. The volume to snapshot.
|
---|
41 | * @param VolumeSnapshot $postBody
|
---|
42 | * @param array $optParams Optional parameters.
|
---|
43 | * @return VolumeSnapshot
|
---|
44 | * @throws \Google\Service\Exception
|
---|
45 | */
|
---|
46 | public function create($parent, VolumeSnapshot $postBody, $optParams = [])
|
---|
47 | {
|
---|
48 | $params = ['parent' => $parent, 'postBody' => $postBody];
|
---|
49 | $params = array_merge($params, $optParams);
|
---|
50 | return $this->call('create', [$params], VolumeSnapshot::class);
|
---|
51 | }
|
---|
52 | /**
|
---|
53 | * Deletes a volume snapshot. Returns INVALID_ARGUMENT if called for a non-boot
|
---|
54 | * volume. (snapshots.delete)
|
---|
55 | *
|
---|
56 | * @param string $name Required. The name of the snapshot to delete.
|
---|
57 | * @param array $optParams Optional parameters.
|
---|
58 | * @return BaremetalsolutionEmpty
|
---|
59 | * @throws \Google\Service\Exception
|
---|
60 | */
|
---|
61 | public function delete($name, $optParams = [])
|
---|
62 | {
|
---|
63 | $params = ['name' => $name];
|
---|
64 | $params = array_merge($params, $optParams);
|
---|
65 | return $this->call('delete', [$params], BaremetalsolutionEmpty::class);
|
---|
66 | }
|
---|
67 | /**
|
---|
68 | * Returns the specified snapshot resource. Returns INVALID_ARGUMENT if called
|
---|
69 | * for a non-boot volume. (snapshots.get)
|
---|
70 | *
|
---|
71 | * @param string $name Required. The name of the snapshot.
|
---|
72 | * @param array $optParams Optional parameters.
|
---|
73 | * @return VolumeSnapshot
|
---|
74 | * @throws \Google\Service\Exception
|
---|
75 | */
|
---|
76 | public function get($name, $optParams = [])
|
---|
77 | {
|
---|
78 | $params = ['name' => $name];
|
---|
79 | $params = array_merge($params, $optParams);
|
---|
80 | return $this->call('get', [$params], VolumeSnapshot::class);
|
---|
81 | }
|
---|
82 | /**
|
---|
83 | * Retrieves the list of snapshots for the specified volume. Returns a response
|
---|
84 | * with an empty list of snapshots if called for a non-boot volume.
|
---|
85 | * (snapshots.listProjectsLocationsVolumesSnapshots)
|
---|
86 | *
|
---|
87 | * @param string $parent Required. Parent value for ListVolumesRequest.
|
---|
88 | * @param array $optParams Optional parameters.
|
---|
89 | *
|
---|
90 | * @opt_param int pageSize Requested page size. The server might return fewer
|
---|
91 | * items than requested. If unspecified, server will pick an appropriate
|
---|
92 | * default.
|
---|
93 | * @opt_param string pageToken A token identifying a page of results from the
|
---|
94 | * server.
|
---|
95 | * @return ListVolumeSnapshotsResponse
|
---|
96 | * @throws \Google\Service\Exception
|
---|
97 | */
|
---|
98 | public function listProjectsLocationsVolumesSnapshots($parent, $optParams = [])
|
---|
99 | {
|
---|
100 | $params = ['parent' => $parent];
|
---|
101 | $params = array_merge($params, $optParams);
|
---|
102 | return $this->call('list', [$params], ListVolumeSnapshotsResponse::class);
|
---|
103 | }
|
---|
104 | /**
|
---|
105 | * Uses the specified snapshot to restore its parent volume. Returns
|
---|
106 | * INVALID_ARGUMENT if called for a non-boot volume.
|
---|
107 | * (snapshots.restoreVolumeSnapshot)
|
---|
108 | *
|
---|
109 | * @param string $volumeSnapshot Required. Name of the snapshot which will be
|
---|
110 | * used to restore its parent volume.
|
---|
111 | * @param RestoreVolumeSnapshotRequest $postBody
|
---|
112 | * @param array $optParams Optional parameters.
|
---|
113 | * @return Operation
|
---|
114 | * @throws \Google\Service\Exception
|
---|
115 | */
|
---|
116 | public function restoreVolumeSnapshot($volumeSnapshot, RestoreVolumeSnapshotRequest $postBody, $optParams = [])
|
---|
117 | {
|
---|
118 | $params = ['volumeSnapshot' => $volumeSnapshot, 'postBody' => $postBody];
|
---|
119 | $params = array_merge($params, $optParams);
|
---|
120 | return $this->call('restoreVolumeSnapshot', [$params], Operation::class);
|
---|
121 | }
|
---|
122 | }
|
---|
123 |
|
---|
124 | // Adding a class alias for backwards compatibility with the previous class name.
|
---|
125 | class_alias(ProjectsLocationsVolumesSnapshots::class, 'Google_Service_Baremetalsolution_Resource_ProjectsLocationsVolumesSnapshots');
|
---|