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\Spanner\Resource;
|
---|
19 |
|
---|
20 | use Google\Service\Spanner\BackupSchedule;
|
---|
21 | use Google\Service\Spanner\GetIamPolicyRequest;
|
---|
22 | use Google\Service\Spanner\ListBackupSchedulesResponse;
|
---|
23 | use Google\Service\Spanner\Policy;
|
---|
24 | use Google\Service\Spanner\SetIamPolicyRequest;
|
---|
25 | use Google\Service\Spanner\SpannerEmpty;
|
---|
26 | use Google\Service\Spanner\TestIamPermissionsRequest;
|
---|
27 | use Google\Service\Spanner\TestIamPermissionsResponse;
|
---|
28 |
|
---|
29 | /**
|
---|
30 | * The "backupSchedules" collection of methods.
|
---|
31 | * Typical usage is:
|
---|
32 | * <code>
|
---|
33 | * $spannerService = new Google\Service\Spanner(...);
|
---|
34 | * $backupSchedules = $spannerService->projects_instances_databases_backupSchedules;
|
---|
35 | * </code>
|
---|
36 | */
|
---|
37 | class ProjectsInstancesDatabasesBackupSchedules extends \Google\Service\Resource
|
---|
38 | {
|
---|
39 | /**
|
---|
40 | * Creates a new backup schedule. (backupSchedules.create)
|
---|
41 | *
|
---|
42 | * @param string $parent Required. The name of the database that this backup
|
---|
43 | * schedule applies to.
|
---|
44 | * @param BackupSchedule $postBody
|
---|
45 | * @param array $optParams Optional parameters.
|
---|
46 | *
|
---|
47 | * @opt_param string backupScheduleId Required. The Id to use for the backup
|
---|
48 | * schedule. The `backup_schedule_id` appended to `parent` forms the full backup
|
---|
49 | * schedule name of the form `projects//instances//databases//backupSchedules/`.
|
---|
50 | * @return BackupSchedule
|
---|
51 | * @throws \Google\Service\Exception
|
---|
52 | */
|
---|
53 | public function create($parent, BackupSchedule $postBody, $optParams = [])
|
---|
54 | {
|
---|
55 | $params = ['parent' => $parent, 'postBody' => $postBody];
|
---|
56 | $params = array_merge($params, $optParams);
|
---|
57 | return $this->call('create', [$params], BackupSchedule::class);
|
---|
58 | }
|
---|
59 | /**
|
---|
60 | * Deletes a backup schedule. (backupSchedules.delete)
|
---|
61 | *
|
---|
62 | * @param string $name Required. The name of the schedule to delete. Values are
|
---|
63 | * of the form `projects//instances//databases//backupSchedules/`.
|
---|
64 | * @param array $optParams Optional parameters.
|
---|
65 | * @return SpannerEmpty
|
---|
66 | * @throws \Google\Service\Exception
|
---|
67 | */
|
---|
68 | public function delete($name, $optParams = [])
|
---|
69 | {
|
---|
70 | $params = ['name' => $name];
|
---|
71 | $params = array_merge($params, $optParams);
|
---|
72 | return $this->call('delete', [$params], SpannerEmpty::class);
|
---|
73 | }
|
---|
74 | /**
|
---|
75 | * Gets backup schedule for the input schedule name. (backupSchedules.get)
|
---|
76 | *
|
---|
77 | * @param string $name Required. The name of the schedule to retrieve. Values
|
---|
78 | * are of the form `projects//instances//databases//backupSchedules/`.
|
---|
79 | * @param array $optParams Optional parameters.
|
---|
80 | * @return BackupSchedule
|
---|
81 | * @throws \Google\Service\Exception
|
---|
82 | */
|
---|
83 | public function get($name, $optParams = [])
|
---|
84 | {
|
---|
85 | $params = ['name' => $name];
|
---|
86 | $params = array_merge($params, $optParams);
|
---|
87 | return $this->call('get', [$params], BackupSchedule::class);
|
---|
88 | }
|
---|
89 | /**
|
---|
90 | * Gets the access control policy for a database or backup resource. Returns an
|
---|
91 | * empty policy if a database or backup exists but does not have a policy set.
|
---|
92 | * Authorization requires `spanner.databases.getIamPolicy` permission on
|
---|
93 | * resource. For backups, authorization requires `spanner.backups.getIamPolicy`
|
---|
94 | * permission on resource. For backup schedules, authorization requires
|
---|
95 | * `spanner.backupSchedules.getIamPolicy` permission on resource.
|
---|
96 | * (backupSchedules.getIamPolicy)
|
---|
97 | *
|
---|
98 | * @param string $resource REQUIRED: The Cloud Spanner resource for which the
|
---|
99 | * policy is being retrieved. The format is `projects//instances/` for instance
|
---|
100 | * resources and `projects//instances//databases/` for database resources.
|
---|
101 | * @param GetIamPolicyRequest $postBody
|
---|
102 | * @param array $optParams Optional parameters.
|
---|
103 | * @return Policy
|
---|
104 | * @throws \Google\Service\Exception
|
---|
105 | */
|
---|
106 | public function getIamPolicy($resource, GetIamPolicyRequest $postBody, $optParams = [])
|
---|
107 | {
|
---|
108 | $params = ['resource' => $resource, 'postBody' => $postBody];
|
---|
109 | $params = array_merge($params, $optParams);
|
---|
110 | return $this->call('getIamPolicy', [$params], Policy::class);
|
---|
111 | }
|
---|
112 | /**
|
---|
113 | * Lists all the backup schedules for the database.
|
---|
114 | * (backupSchedules.listProjectsInstancesDatabasesBackupSchedules)
|
---|
115 | *
|
---|
116 | * @param string $parent Required. Database is the parent resource whose backup
|
---|
117 | * schedules should be listed. Values are of the form
|
---|
118 | * projects//instances//databases/
|
---|
119 | * @param array $optParams Optional parameters.
|
---|
120 | *
|
---|
121 | * @opt_param int pageSize Optional. Number of backup schedules to be returned
|
---|
122 | * in the response. If 0 or less, defaults to the server's maximum allowed page
|
---|
123 | * size.
|
---|
124 | * @opt_param string pageToken Optional. If non-empty, `page_token` should
|
---|
125 | * contain a next_page_token from a previous ListBackupSchedulesResponse to the
|
---|
126 | * same `parent`.
|
---|
127 | * @return ListBackupSchedulesResponse
|
---|
128 | * @throws \Google\Service\Exception
|
---|
129 | */
|
---|
130 | public function listProjectsInstancesDatabasesBackupSchedules($parent, $optParams = [])
|
---|
131 | {
|
---|
132 | $params = ['parent' => $parent];
|
---|
133 | $params = array_merge($params, $optParams);
|
---|
134 | return $this->call('list', [$params], ListBackupSchedulesResponse::class);
|
---|
135 | }
|
---|
136 | /**
|
---|
137 | * Updates a backup schedule. (backupSchedules.patch)
|
---|
138 | *
|
---|
139 | * @param string $name Identifier. Output only for the CreateBackupSchedule
|
---|
140 | * operation. Required for the UpdateBackupSchedule operation. A globally unique
|
---|
141 | * identifier for the backup schedule which cannot be changed. Values are of the
|
---|
142 | * form `projects//instances//databases//backupSchedules/a-z*[a-z0-9]` The final
|
---|
143 | * segment of the name must be between 2 and 60 characters in length.
|
---|
144 | * @param BackupSchedule $postBody
|
---|
145 | * @param array $optParams Optional parameters.
|
---|
146 | *
|
---|
147 | * @opt_param string updateMask Required. A mask specifying which fields in the
|
---|
148 | * BackupSchedule resource should be updated. This mask is relative to the
|
---|
149 | * BackupSchedule resource, not to the request message. The field mask must
|
---|
150 | * always be specified; this prevents any future fields from being erased
|
---|
151 | * accidentally.
|
---|
152 | * @return BackupSchedule
|
---|
153 | * @throws \Google\Service\Exception
|
---|
154 | */
|
---|
155 | public function patch($name, BackupSchedule $postBody, $optParams = [])
|
---|
156 | {
|
---|
157 | $params = ['name' => $name, 'postBody' => $postBody];
|
---|
158 | $params = array_merge($params, $optParams);
|
---|
159 | return $this->call('patch', [$params], BackupSchedule::class);
|
---|
160 | }
|
---|
161 | /**
|
---|
162 | * Sets the access control policy on a database or backup resource. Replaces any
|
---|
163 | * existing policy. Authorization requires `spanner.databases.setIamPolicy`
|
---|
164 | * permission on resource. For backups, authorization requires
|
---|
165 | * `spanner.backups.setIamPolicy` permission on resource. For backup schedules,
|
---|
166 | * authorization requires `spanner.backupSchedules.setIamPolicy` permission on
|
---|
167 | * resource. (backupSchedules.setIamPolicy)
|
---|
168 | *
|
---|
169 | * @param string $resource REQUIRED: The Cloud Spanner resource for which the
|
---|
170 | * policy is being set. The format is `projects//instances/` for instance
|
---|
171 | * resources and `projects//instances//databases/` for databases resources.
|
---|
172 | * @param SetIamPolicyRequest $postBody
|
---|
173 | * @param array $optParams Optional parameters.
|
---|
174 | * @return Policy
|
---|
175 | * @throws \Google\Service\Exception
|
---|
176 | */
|
---|
177 | public function setIamPolicy($resource, SetIamPolicyRequest $postBody, $optParams = [])
|
---|
178 | {
|
---|
179 | $params = ['resource' => $resource, 'postBody' => $postBody];
|
---|
180 | $params = array_merge($params, $optParams);
|
---|
181 | return $this->call('setIamPolicy', [$params], Policy::class);
|
---|
182 | }
|
---|
183 | /**
|
---|
184 | * Returns permissions that the caller has on the specified database or backup
|
---|
185 | * resource. Attempting this RPC on a non-existent Cloud Spanner database will
|
---|
186 | * result in a NOT_FOUND error if the user has `spanner.databases.list`
|
---|
187 | * permission on the containing Cloud Spanner instance. Otherwise returns an
|
---|
188 | * empty set of permissions. Calling this method on a backup that does not exist
|
---|
189 | * will result in a NOT_FOUND error if the user has `spanner.backups.list`
|
---|
190 | * permission on the containing instance. Calling this method on a backup
|
---|
191 | * schedule that does not exist will result in a NOT_FOUND error if the user has
|
---|
192 | * `spanner.backupSchedules.list` permission on the containing database.
|
---|
193 | * (backupSchedules.testIamPermissions)
|
---|
194 | *
|
---|
195 | * @param string $resource REQUIRED: The Cloud Spanner resource for which
|
---|
196 | * permissions are being tested. The format is `projects//instances/` for
|
---|
197 | * instance resources and `projects//instances//databases/` for database
|
---|
198 | * resources.
|
---|
199 | * @param TestIamPermissionsRequest $postBody
|
---|
200 | * @param array $optParams Optional parameters.
|
---|
201 | * @return TestIamPermissionsResponse
|
---|
202 | * @throws \Google\Service\Exception
|
---|
203 | */
|
---|
204 | public function testIamPermissions($resource, TestIamPermissionsRequest $postBody, $optParams = [])
|
---|
205 | {
|
---|
206 | $params = ['resource' => $resource, 'postBody' => $postBody];
|
---|
207 | $params = array_merge($params, $optParams);
|
---|
208 | return $this->call('testIamPermissions', [$params], TestIamPermissionsResponse::class);
|
---|
209 | }
|
---|
210 | }
|
---|
211 |
|
---|
212 | // Adding a class alias for backwards compatibility with the previous class name.
|
---|
213 | class_alias(ProjectsInstancesDatabasesBackupSchedules::class, 'Google_Service_Spanner_Resource_ProjectsInstancesDatabasesBackupSchedules');
|
---|