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\CloudFilestore\Resource;
19
20use Google\Service\CloudFilestore\ListSnapshotsResponse;
21use Google\Service\CloudFilestore\Operation;
22use Google\Service\CloudFilestore\Snapshot;
23
24/**
25 * The "snapshots" collection of methods.
26 * Typical usage is:
27 *  <code>
28 *   $fileService = new Google\Service\CloudFilestore(...);
29 *   $snapshots = $fileService->snapshots;
30 *  </code>
31 */
32class ProjectsLocationsInstancesSnapshots extends \Google\Service\Resource
33{
34  /**
35   * Creates a snapshot. (snapshots.create)
36   *
37   * @param string $parent Required. The Filestore Instance to create the
38   * snapshots of, in the format
39   * `projects/{project_id}/locations/{location}/instances/{instance_id}`
40   * @param Snapshot $postBody
41   * @param array $optParams Optional parameters.
42   *
43   * @opt_param string snapshotId Required. The ID to use for the snapshot. The ID
44   * must be unique within the specified instance. This value must start with a
45   * lowercase letter followed by up to 62 lowercase letters, numbers, or hyphens,
46   * and cannot end with a hyphen.
47   * @return Operation
48   */
49  public function create($parent, Snapshot $postBody, $optParams = [])
50  {
51    $params = ['parent' => $parent, 'postBody' => $postBody];
52    $params = array_merge($params, $optParams);
53    return $this->call('create', [$params], Operation::class);
54  }
55  /**
56   * Deletes a snapshot. (snapshots.delete)
57   *
58   * @param string $name Required. The snapshot resource name, in the format `proj
59   * ects/{project_id}/locations/{location}/instances/{instance_id}/snapshots/{sna
60   * pshot_id}`
61   * @param array $optParams Optional parameters.
62   * @return Operation
63   */
64  public function delete($name, $optParams = [])
65  {
66    $params = ['name' => $name];
67    $params = array_merge($params, $optParams);
68    return $this->call('delete', [$params], Operation::class);
69  }
70  /**
71   * Gets the details of a specific snapshot. (snapshots.get)
72   *
73   * @param string $name Required. The snapshot resource name, in the format `proj
74   * ects/{project_id}/locations/{location}/instances/{instance_id}/snapshots/{sna
75   * pshot_id}`
76   * @param array $optParams Optional parameters.
77   * @return Snapshot
78   */
79  public function get($name, $optParams = [])
80  {
81    $params = ['name' => $name];
82    $params = array_merge($params, $optParams);
83    return $this->call('get', [$params], Snapshot::class);
84  }
85  /**
86   * Lists all snapshots in a project for either a specified location or for all
87   * locations. (snapshots.listProjectsLocationsInstancesSnapshots)
88   *
89   * @param string $parent Required. The instance for which to retrieve snapshot
90   * information, in the format
91   * `projects/{project_id}/locations/{location}/instances/{instance_id}`.
92   * @param array $optParams Optional parameters.
93   *
94   * @opt_param string filter List filter.
95   * @opt_param string orderBy Sort results. Supported values are "name", "name
96   * desc" or "" (unsorted).
97   * @opt_param int pageSize The maximum number of items to return.
98   * @opt_param string pageToken The next_page_token value to use if there are
99   * additional results to retrieve for this list request.
100   * @return ListSnapshotsResponse
101   */
102  public function listProjectsLocationsInstancesSnapshots($parent, $optParams = [])
103  {
104    $params = ['parent' => $parent];
105    $params = array_merge($params, $optParams);
106    return $this->call('list', [$params], ListSnapshotsResponse::class);
107  }
108  /**
109   * Updates the settings of a specific snapshot. (snapshots.patch)
110   *
111   * @param string $name Output only. The resource name of the snapshot, in the
112   * format `projects/{project_id}/locations/{location_id}/instances/{instance_id}
113   * /snapshots/{snapshot_id}`.
114   * @param Snapshot $postBody
115   * @param array $optParams Optional parameters.
116   *
117   * @opt_param string updateMask Required. Mask of fields to update. At least one
118   * path must be supplied in this field.
119   * @return Operation
120   */
121  public function patch($name, Snapshot $postBody, $optParams = [])
122  {
123    $params = ['name' => $name, 'postBody' => $postBody];
124    $params = array_merge($params, $optParams);
125    return $this->call('patch', [$params], Operation::class);
126  }
127}
128
129// Adding a class alias for backwards compatibility with the previous class name.
130class_alias(ProjectsLocationsInstancesSnapshots::class, 'Google_Service_CloudFilestore_Resource_ProjectsLocationsInstancesSnapshots');
131