source: vendor/google/apiclient-services/src/Compute/Resource/Snapshots.php@ f9c482b

Last change on this file since f9c482b was f9c482b, checked in by Vlado 222039 <vlado.popovski@…>, 10 days ago

Upload new project files

  • Property mode set to 100644
File size: 12.3 KB
Line 
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\Compute\Resource;
19
20use Google\Service\Compute\GlobalSetLabelsRequest;
21use Google\Service\Compute\GlobalSetPolicyRequest;
22use Google\Service\Compute\Operation;
23use Google\Service\Compute\Policy;
24use Google\Service\Compute\Snapshot;
25use Google\Service\Compute\SnapshotList;
26use Google\Service\Compute\TestPermissionsRequest;
27use Google\Service\Compute\TestPermissionsResponse;
28
29/**
30 * The "snapshots" collection of methods.
31 * Typical usage is:
32 * <code>
33 * $computeService = new Google\Service\Compute(...);
34 * $snapshots = $computeService->snapshots;
35 * </code>
36 */
37class Snapshots extends \Google\Service\Resource
38{
39 /**
40 * Deletes the specified Snapshot resource. Keep in mind that deleting a single
41 * snapshot might not necessarily delete all the data on that snapshot. If any
42 * data on the snapshot that is marked for deletion is needed for subsequent
43 * snapshots, the data will be moved to the next corresponding snapshot. For
44 * more information, see Deleting snapshots. (snapshots.delete)
45 *
46 * @param string $project Project ID for this request.
47 * @param string $snapshot Name of the Snapshot resource to delete.
48 * @param array $optParams Optional parameters.
49 *
50 * @opt_param string requestId An optional request ID to identify requests.
51 * Specify a unique request ID so that if you must retry your request, the
52 * server will know to ignore the request if it has already been completed. For
53 * example, consider a situation where you make an initial request and the
54 * request times out. If you make the request again with the same request ID,
55 * the server can check if original operation with the same request ID was
56 * received, and if so, will ignore the second request. This prevents clients
57 * from accidentally creating duplicate commitments. The request ID must be a
58 * valid UUID with the exception that zero UUID is not supported (
59 * 00000000-0000-0000-0000-000000000000).
60 * @return Operation
61 * @throws \Google\Service\Exception
62 */
63 public function delete($project, $snapshot, $optParams = [])
64 {
65 $params = ['project' => $project, 'snapshot' => $snapshot];
66 $params = array_merge($params, $optParams);
67 return $this->call('delete', [$params], Operation::class);
68 }
69 /**
70 * Returns the specified Snapshot resource. (snapshots.get)
71 *
72 * @param string $project Project ID for this request.
73 * @param string $snapshot Name of the Snapshot resource to return.
74 * @param array $optParams Optional parameters.
75 * @return Snapshot
76 * @throws \Google\Service\Exception
77 */
78 public function get($project, $snapshot, $optParams = [])
79 {
80 $params = ['project' => $project, 'snapshot' => $snapshot];
81 $params = array_merge($params, $optParams);
82 return $this->call('get', [$params], Snapshot::class);
83 }
84 /**
85 * Gets the access control policy for a resource. May be empty if no such policy
86 * or resource exists. (snapshots.getIamPolicy)
87 *
88 * @param string $project Project ID for this request.
89 * @param string $resource Name or id of the resource for this request.
90 * @param array $optParams Optional parameters.
91 *
92 * @opt_param int optionsRequestedPolicyVersion Requested IAM Policy version.
93 * @return Policy
94 * @throws \Google\Service\Exception
95 */
96 public function getIamPolicy($project, $resource, $optParams = [])
97 {
98 $params = ['project' => $project, 'resource' => $resource];
99 $params = array_merge($params, $optParams);
100 return $this->call('getIamPolicy', [$params], Policy::class);
101 }
102 /**
103 * Creates a snapshot in the specified project using the data included in the
104 * request. For regular snapshot creation, consider using this method instead of
105 * disks.createSnapshot, as this method supports more features, such as creating
106 * snapshots in a project different from the source disk project.
107 * (snapshots.insert)
108 *
109 * @param string $project Project ID for this request.
110 * @param Snapshot $postBody
111 * @param array $optParams Optional parameters.
112 *
113 * @opt_param string requestId An optional request ID to identify requests.
114 * Specify a unique request ID so that if you must retry your request, the
115 * server will know to ignore the request if it has already been completed. For
116 * example, consider a situation where you make an initial request and the
117 * request times out. If you make the request again with the same request ID,
118 * the server can check if original operation with the same request ID was
119 * received, and if so, will ignore the second request. This prevents clients
120 * from accidentally creating duplicate commitments. The request ID must be a
121 * valid UUID with the exception that zero UUID is not supported (
122 * 00000000-0000-0000-0000-000000000000).
123 * @return Operation
124 * @throws \Google\Service\Exception
125 */
126 public function insert($project, Snapshot $postBody, $optParams = [])
127 {
128 $params = ['project' => $project, 'postBody' => $postBody];
129 $params = array_merge($params, $optParams);
130 return $this->call('insert', [$params], Operation::class);
131 }
132 /**
133 * Retrieves the list of Snapshot resources contained within the specified
134 * project. (snapshots.listSnapshots)
135 *
136 * @param string $project Project ID for this request.
137 * @param array $optParams Optional parameters.
138 *
139 * @opt_param string filter A filter expression that filters resources listed in
140 * the response. Most Compute resources support two types of filter expressions:
141 * expressions that support regular expressions and expressions that follow API
142 * improvement proposal AIP-160. These two types of filter expressions cannot be
143 * mixed in one request. If you want to use AIP-160, your expression must
144 * specify the field name, an operator, and the value that you want to use for
145 * filtering. The value must be a string, a number, or a boolean. The operator
146 * must be either `=`, `!=`, `>`, `<`, `<=`, `>=` or `:`. For example, if you
147 * are filtering Compute Engine instances, you can exclude instances named
148 * `example-instance` by specifying `name != example-instance`. The `:*`
149 * comparison can be used to test whether a key has been defined. For example,
150 * to find all objects with `owner` label use: ``` labels.owner:* ``` You can
151 * also filter nested fields. For example, you could specify
152 * `scheduling.automaticRestart = false` to include instances only if they are
153 * not scheduled for automatic restarts. You can use filtering on nested fields
154 * to filter based on resource labels. To filter on multiple expressions,
155 * provide each separate expression within parentheses. For example: ```
156 * (scheduling.automaticRestart = true) (cpuPlatform = "Intel Skylake") ``` By
157 * default, each expression is an `AND` expression. However, you can include
158 * `AND` and `OR` expressions explicitly. For example: ``` (cpuPlatform = "Intel
159 * Skylake") OR (cpuPlatform = "Intel Broadwell") AND
160 * (scheduling.automaticRestart = true) ``` If you want to use a regular
161 * expression, use the `eq` (equal) or `ne` (not equal) operator against a
162 * single un-parenthesized expression with or without quotes or against multiple
163 * parenthesized expressions. Examples: `fieldname eq unquoted literal`
164 * `fieldname eq 'single quoted literal'` `fieldname eq "double quoted literal"`
165 * `(fieldname1 eq literal) (fieldname2 ne "literal")` The literal value is
166 * interpreted as a regular expression using Google RE2 library syntax. The
167 * literal value must match the entire field. For example, to filter for
168 * instances that do not end with name "instance", you would use `name ne
169 * .*instance`. You cannot combine constraints on multiple fields using regular
170 * expressions.
171 * @opt_param string maxResults The maximum number of results per page that
172 * should be returned. If the number of available results is larger than
173 * `maxResults`, Compute Engine returns a `nextPageToken` that can be used to
174 * get the next page of results in subsequent list requests. Acceptable values
175 * are `0` to `500`, inclusive. (Default: `500`)
176 * @opt_param string orderBy Sorts list results by a certain order. By default,
177 * results are returned in alphanumerical order based on the resource name. You
178 * can also sort results in descending order based on the creation timestamp
179 * using `orderBy="creationTimestamp desc"`. This sorts results based on the
180 * `creationTimestamp` field in reverse chronological order (newest result
181 * first). Use this to sort resources like operations so that the newest
182 * operation is returned first. Currently, only sorting by `name` or
183 * `creationTimestamp desc` is supported.
184 * @opt_param string pageToken Specifies a page token to use. Set `pageToken` to
185 * the `nextPageToken` returned by a previous list request to get the next page
186 * of results.
187 * @opt_param bool returnPartialSuccess Opt-in for partial success behavior
188 * which provides partial results in case of failure. The default value is
189 * false. For example, when partial success behavior is enabled, aggregatedList
190 * for a single zone scope either returns all resources in the zone or no
191 * resources, with an error code.
192 * @return SnapshotList
193 * @throws \Google\Service\Exception
194 */
195 public function listSnapshots($project, $optParams = [])
196 {
197 $params = ['project' => $project];
198 $params = array_merge($params, $optParams);
199 return $this->call('list', [$params], SnapshotList::class);
200 }
201 /**
202 * Sets the access control policy on the specified resource. Replaces any
203 * existing policy. (snapshots.setIamPolicy)
204 *
205 * @param string $project Project ID for this request.
206 * @param string $resource Name or id of the resource for this request.
207 * @param GlobalSetPolicyRequest $postBody
208 * @param array $optParams Optional parameters.
209 * @return Policy
210 * @throws \Google\Service\Exception
211 */
212 public function setIamPolicy($project, $resource, GlobalSetPolicyRequest $postBody, $optParams = [])
213 {
214 $params = ['project' => $project, 'resource' => $resource, 'postBody' => $postBody];
215 $params = array_merge($params, $optParams);
216 return $this->call('setIamPolicy', [$params], Policy::class);
217 }
218 /**
219 * Sets the labels on a snapshot. To learn more about labels, read the Labeling
220 * Resources documentation. (snapshots.setLabels)
221 *
222 * @param string $project Project ID for this request.
223 * @param string $resource Name or id of the resource for this request.
224 * @param GlobalSetLabelsRequest $postBody
225 * @param array $optParams Optional parameters.
226 * @return Operation
227 * @throws \Google\Service\Exception
228 */
229 public function setLabels($project, $resource, GlobalSetLabelsRequest $postBody, $optParams = [])
230 {
231 $params = ['project' => $project, 'resource' => $resource, 'postBody' => $postBody];
232 $params = array_merge($params, $optParams);
233 return $this->call('setLabels', [$params], Operation::class);
234 }
235 /**
236 * Returns permissions that a caller has on the specified resource.
237 * (snapshots.testIamPermissions)
238 *
239 * @param string $project Project ID for this request.
240 * @param string $resource Name or id of the resource for this request.
241 * @param TestPermissionsRequest $postBody
242 * @param array $optParams Optional parameters.
243 * @return TestPermissionsResponse
244 * @throws \Google\Service\Exception
245 */
246 public function testIamPermissions($project, $resource, TestPermissionsRequest $postBody, $optParams = [])
247 {
248 $params = ['project' => $project, 'resource' => $resource, 'postBody' => $postBody];
249 $params = array_merge($params, $optParams);
250 return $this->call('testIamPermissions', [$params], TestPermissionsResponse::class);
251 }
252}
253
254// Adding a class alias for backwards compatibility with the previous class name.
255class_alias(Snapshots::class, 'Google_Service_Compute_Resource_Snapshots');
Note: See TracBrowser for help on using the repository browser.