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\Backup;
21use Google\Service\CloudFilestore\ListBackupsResponse;
22use Google\Service\CloudFilestore\Operation;
23
24/**
25 * The "backups" collection of methods.
26 * Typical usage is:
27 *  <code>
28 *   $fileService = new Google\Service\CloudFilestore(...);
29 *   $backups = $fileService->backups;
30 *  </code>
31 */
32class ProjectsLocationsBackups extends \Google\Service\Resource
33{
34  /**
35   * Creates a backup. (backups.create)
36   *
37   * @param string $parent Required. The backup's project and location, in the
38   * format `projects/{project_number}/locations/{location}`. In Cloud Filestore,
39   * backup locations map to GCP regions, for example **us-west1**.
40   * @param Backup $postBody
41   * @param array $optParams Optional parameters.
42   *
43   * @opt_param string backupId Required. The ID to use for the backup. The ID
44   * must be unique within the specified project and location. This value must
45   * start with a lowercase letter followed by up to 62 lowercase letters,
46   * numbers, or hyphens, and cannot end with a hyphen. Values that do not match
47   * this pattern will trigger an INVALID_ARGUMENT error.
48   * @return Operation
49   */
50  public function create($parent, Backup $postBody, $optParams = [])
51  {
52    $params = ['parent' => $parent, 'postBody' => $postBody];
53    $params = array_merge($params, $optParams);
54    return $this->call('create', [$params], Operation::class);
55  }
56  /**
57   * Deletes a backup. (backups.delete)
58   *
59   * @param string $name Required. The backup resource name, in the format
60   * `projects/{project_number}/locations/{location}/backups/{backup_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 backup. (backups.get)
72   *
73   * @param string $name Required. The backup resource name, in the format
74   * `projects/{project_number}/locations/{location}/backups/{backup_id}`.
75   * @param array $optParams Optional parameters.
76   * @return Backup
77   */
78  public function get($name, $optParams = [])
79  {
80    $params = ['name' => $name];
81    $params = array_merge($params, $optParams);
82    return $this->call('get', [$params], Backup::class);
83  }
84  /**
85   * Lists all backups in a project for either a specified location or for all
86   * locations. (backups.listProjectsLocationsBackups)
87   *
88   * @param string $parent Required. The project and location for which to
89   * retrieve backup information, in the format
90   * `projects/{project_number}/locations/{location}`. In Cloud Filestore, backup
91   * locations map to GCP regions, for example **us-west1**. To retrieve backup
92   * information for all locations, use "-" for the `{location}` value.
93   * @param array $optParams Optional parameters.
94   *
95   * @opt_param string filter List filter.
96   * @opt_param string orderBy Sort results. Supported values are "name", "name
97   * desc" or "" (unsorted).
98   * @opt_param int pageSize The maximum number of items to return.
99   * @opt_param string pageToken The next_page_token value to use if there are
100   * additional results to retrieve for this list request.
101   * @return ListBackupsResponse
102   */
103  public function listProjectsLocationsBackups($parent, $optParams = [])
104  {
105    $params = ['parent' => $parent];
106    $params = array_merge($params, $optParams);
107    return $this->call('list', [$params], ListBackupsResponse::class);
108  }
109  /**
110   * Updates the settings of a specific backup. (backups.patch)
111   *
112   * @param string $name Output only. The resource name of the backup, in the
113   * format
114   * `projects/{project_number}/locations/{location_id}/backups/{backup_id}`.
115   * @param Backup $postBody
116   * @param array $optParams Optional parameters.
117   *
118   * @opt_param string updateMask Required. Mask of fields to update. At least one
119   * path must be supplied in this field.
120   * @return Operation
121   */
122  public function patch($name, Backup $postBody, $optParams = [])
123  {
124    $params = ['name' => $name, 'postBody' => $postBody];
125    $params = array_merge($params, $optParams);
126    return $this->call('patch', [$params], Operation::class);
127  }
128}
129
130// Adding a class alias for backwards compatibility with the previous class name.
131class_alias(ProjectsLocationsBackups::class, 'Google_Service_CloudFilestore_Resource_ProjectsLocationsBackups');
132