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\SQLAdmin\Resource;
19
20use Google\Service\SQLAdmin\BackupRun;
21use Google\Service\SQLAdmin\BackupRunsListResponse;
22use Google\Service\SQLAdmin\Operation;
23
24/**
25 * The "backupRuns" collection of methods.
26 * Typical usage is:
27 *  <code>
28 *   $sqladminService = new Google\Service\SQLAdmin(...);
29 *   $backupRuns = $sqladminService->backupRuns;
30 *  </code>
31 */
32class BackupRuns extends \Google\Service\Resource
33{
34  /**
35   * Deletes the backup taken by a backup run. (backupRuns.delete)
36   *
37   * @param string $project Project ID of the project that contains the instance.
38   * @param string $instance Cloud SQL instance ID. This does not include the
39   * project ID.
40   * @param string $id The ID of the backup run to delete. To find a backup run
41   * ID, use the [list](https://cloud.google.com/sql/docs/mysql/admin-
42   * api/rest/v1/backupRuns/list) method.
43   * @param array $optParams Optional parameters.
44   * @return Operation
45   */
46  public function delete($project, $instance, $id, $optParams = [])
47  {
48    $params = ['project' => $project, 'instance' => $instance, 'id' => $id];
49    $params = array_merge($params, $optParams);
50    return $this->call('delete', [$params], Operation::class);
51  }
52  /**
53   * Retrieves a resource containing information about a backup run.
54   * (backupRuns.get)
55   *
56   * @param string $project Project ID of the project that contains the instance.
57   * @param string $instance Cloud SQL instance ID. This does not include the
58   * project ID.
59   * @param string $id The ID of this backup run.
60   * @param array $optParams Optional parameters.
61   * @return BackupRun
62   */
63  public function get($project, $instance, $id, $optParams = [])
64  {
65    $params = ['project' => $project, 'instance' => $instance, 'id' => $id];
66    $params = array_merge($params, $optParams);
67    return $this->call('get', [$params], BackupRun::class);
68  }
69  /**
70   * Creates a new backup run on demand. (backupRuns.insert)
71   *
72   * @param string $project Project ID of the project that contains the instance.
73   * @param string $instance Cloud SQL instance ID. This does not include the
74   * project ID.
75   * @param BackupRun $postBody
76   * @param array $optParams Optional parameters.
77   * @return Operation
78   */
79  public function insert($project, $instance, BackupRun $postBody, $optParams = [])
80  {
81    $params = ['project' => $project, 'instance' => $instance, 'postBody' => $postBody];
82    $params = array_merge($params, $optParams);
83    return $this->call('insert', [$params], Operation::class);
84  }
85  /**
86   * Lists all backup runs associated with the project or a given instance and
87   * configuration in the reverse chronological order of the backup initiation
88   * time. (backupRuns.listBackupRuns)
89   *
90   * @param string $project Project ID of the project that contains the instance.
91   * @param string $instance Cloud SQL instance ID, or "-" for all instances. This
92   * does not include the project ID.
93   * @param array $optParams Optional parameters.
94   *
95   * @opt_param int maxResults Maximum number of backup runs per response.
96   * @opt_param string pageToken A previously-returned page token representing
97   * part of the larger set of results to view.
98   * @return BackupRunsListResponse
99   */
100  public function listBackupRuns($project, $instance, $optParams = [])
101  {
102    $params = ['project' => $project, 'instance' => $instance];
103    $params = array_merge($params, $optParams);
104    return $this->call('list', [$params], BackupRunsListResponse::class);
105  }
106}
107
108// Adding a class alias for backwards compatibility with the previous class name.
109class_alias(BackupRuns::class, 'Google_Service_SQLAdmin_Resource_BackupRuns');
110