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\FirebaseManagement\Resource;
|
---|
19 |
|
---|
20 | use Google\Service\FirebaseManagement\AddFirebaseRequest;
|
---|
21 | use Google\Service\FirebaseManagement\AddGoogleAnalyticsRequest;
|
---|
22 | use Google\Service\FirebaseManagement\AdminSdkConfig;
|
---|
23 | use Google\Service\FirebaseManagement\AnalyticsDetails;
|
---|
24 | use Google\Service\FirebaseManagement\FirebaseEmpty;
|
---|
25 | use Google\Service\FirebaseManagement\FirebaseProject;
|
---|
26 | use Google\Service\FirebaseManagement\ListFirebaseProjectsResponse;
|
---|
27 | use Google\Service\FirebaseManagement\Operation;
|
---|
28 | use Google\Service\FirebaseManagement\RemoveAnalyticsRequest;
|
---|
29 | use Google\Service\FirebaseManagement\SearchFirebaseAppsResponse;
|
---|
30 |
|
---|
31 | /**
|
---|
32 | * The "projects" collection of methods.
|
---|
33 | * Typical usage is:
|
---|
34 | * <code>
|
---|
35 | * $firebaseService = new Google\Service\FirebaseManagement(...);
|
---|
36 | * $projects = $firebaseService->projects;
|
---|
37 | * </code>
|
---|
38 | */
|
---|
39 | class Projects extends \Google\Service\Resource
|
---|
40 | {
|
---|
41 | /**
|
---|
42 | * Adds Firebase resources and enables Firebase services in the specified
|
---|
43 | * existing [Google Cloud `Project`](https://cloud.google.com/resource-
|
---|
44 | * manager/reference/rest/v1/projects). Since a FirebaseProject is actually also
|
---|
45 | * a Google Cloud `Project`, a `FirebaseProject` has the same underlying Google
|
---|
46 | * Cloud identifiers (`projectNumber` and `projectId`). This allows for easy
|
---|
47 | * interop with Google APIs. The result of this call is an
|
---|
48 | * [`Operation`](../../v1beta1/operations). Poll the `Operation` to track the
|
---|
49 | * provisioning process by calling GetOperation until
|
---|
50 | * [`done`](../../v1beta1/operations#Operation.FIELDS.done) is `true`. When
|
---|
51 | * `done` is `true`, the `Operation` has either succeeded or failed. If the
|
---|
52 | * `Operation` succeeded, its
|
---|
53 | * [`response`](../../v1beta1/operations#Operation.FIELDS.response) is set to a
|
---|
54 | * FirebaseProject; if the `Operation` failed, its
|
---|
55 | * [`error`](../../v1beta1/operations#Operation.FIELDS.error) is set to a
|
---|
56 | * google.rpc.Status. The `Operation` is automatically deleted after completion,
|
---|
57 | * so there is no need to call DeleteOperation. This method does not modify any
|
---|
58 | * billing account information on the underlying Google Cloud `Project`. To call
|
---|
59 | * `AddFirebase`, a project member or service account must have the following
|
---|
60 | * permissions (the IAM roles of Editor and Owner contain these permissions):
|
---|
61 | * `firebase.projects.update`, `resourcemanager.projects.get`,
|
---|
62 | * `serviceusage.services.enable`, and `serviceusage.services.get`.
|
---|
63 | * (projects.addFirebase)
|
---|
64 | *
|
---|
65 | * @param string $project The resource name of the Google Cloud `Project` in
|
---|
66 | * which Firebase resources will be added and Firebase services enabled, in the
|
---|
67 | * format: projects/ PROJECT_IDENTIFIER Refer to the `FirebaseProject`
|
---|
68 | * [`name`](../projects#FirebaseProject.FIELDS.name) field for details about
|
---|
69 | * PROJECT_IDENTIFIER values. After calling `AddFirebase`, the unique Project
|
---|
70 | * identifiers ( [`projectNumber`](https://cloud.google.com/resource-
|
---|
71 | * manager/reference/rest/v1/projects#Project.FIELDS.project_number) and
|
---|
72 | * [`projectId`](https://cloud.google.com/resource-
|
---|
73 | * manager/reference/rest/v1/projects#Project.FIELDS.project_id)) of the
|
---|
74 | * underlying Google Cloud `Project` are also the identifiers of the
|
---|
75 | * FirebaseProject.
|
---|
76 | * @param AddFirebaseRequest $postBody
|
---|
77 | * @param array $optParams Optional parameters.
|
---|
78 | * @return Operation
|
---|
79 | * @throws \Google\Service\Exception
|
---|
80 | */
|
---|
81 | public function addFirebase($project, AddFirebaseRequest $postBody, $optParams = [])
|
---|
82 | {
|
---|
83 | $params = ['project' => $project, 'postBody' => $postBody];
|
---|
84 | $params = array_merge($params, $optParams);
|
---|
85 | return $this->call('addFirebase', [$params], Operation::class);
|
---|
86 | }
|
---|
87 | /**
|
---|
88 | * Links the specified FirebaseProject with an existing [Google Analytics
|
---|
89 | * account](http://www.google.com/analytics/). Using this call, you can either:
|
---|
90 | * - Specify an `analyticsAccountId` to provision a new Google Analytics
|
---|
91 | * property within the specified account and associate the new property with the
|
---|
92 | * `FirebaseProject`. - Specify an existing `analyticsPropertyId` to associate
|
---|
93 | * the property with the `FirebaseProject`. Note that when you call
|
---|
94 | * `AddGoogleAnalytics`: 1. The first check determines if any existing data
|
---|
95 | * streams in the Google Analytics property correspond to any existing Firebase
|
---|
96 | * Apps in the `FirebaseProject` (based on the `packageName` or `bundleId`
|
---|
97 | * associated with the data stream). Then, as applicable, the data streams and
|
---|
98 | * apps are linked. Note that this auto-linking only applies to `AndroidApps`
|
---|
99 | * and `IosApps`. 2. If no corresponding data streams are found for the Firebase
|
---|
100 | * Apps, new data streams are provisioned in the Google Analytics property for
|
---|
101 | * each of the Firebase Apps. Note that a new data stream is always provisioned
|
---|
102 | * for a Web App even if it was previously associated with a data stream in the
|
---|
103 | * Analytics property. Learn more about the hierarchy and structure of Google
|
---|
104 | * Analytics accounts in the [Analytics
|
---|
105 | * documentation](https://support.google.com/analytics/answer/9303323). The
|
---|
106 | * result of this call is an [`Operation`](../../v1beta1/operations). Poll the
|
---|
107 | * `Operation` to track the provisioning process by calling GetOperation until
|
---|
108 | * [`done`](../../v1beta1/operations#Operation.FIELDS.done) is `true`. When
|
---|
109 | * `done` is `true`, the `Operation` has either succeeded or failed. If the
|
---|
110 | * `Operation` succeeded, its
|
---|
111 | * [`response`](../../v1beta1/operations#Operation.FIELDS.response) is set to an
|
---|
112 | * AnalyticsDetails; if the `Operation` failed, its
|
---|
113 | * [`error`](../../v1beta1/operations#Operation.FIELDS.error) is set to a
|
---|
114 | * google.rpc.Status. To call `AddGoogleAnalytics`, a project member must be an
|
---|
115 | * Owner for the existing `FirebaseProject` and have the [`Edit`
|
---|
116 | * permission](https://support.google.com/analytics/answer/2884495) for the
|
---|
117 | * Google Analytics account. If the `FirebaseProject` already has Google
|
---|
118 | * Analytics enabled, and you call `AddGoogleAnalytics` using an
|
---|
119 | * `analyticsPropertyId` that's different from the currently associated
|
---|
120 | * property, then the call will fail. Analytics may have already been enabled in
|
---|
121 | * the Firebase console or by specifying `timeZone` and `regionCode` in the call
|
---|
122 | * to [`AddFirebase`](../../v1beta1/projects/addFirebase).
|
---|
123 | * (projects.addGoogleAnalytics)
|
---|
124 | *
|
---|
125 | * @param string $parent The resource name of the FirebaseProject to link to an
|
---|
126 | * existing Google Analytics account, in the format: projects/PROJECT_IDENTIFIER
|
---|
127 | * Refer to the `FirebaseProject`
|
---|
128 | * [`name`](../projects#FirebaseProject.FIELDS.name) field for details about
|
---|
129 | * PROJECT_IDENTIFIER values.
|
---|
130 | * @param AddGoogleAnalyticsRequest $postBody
|
---|
131 | * @param array $optParams Optional parameters.
|
---|
132 | * @return Operation
|
---|
133 | * @throws \Google\Service\Exception
|
---|
134 | */
|
---|
135 | public function addGoogleAnalytics($parent, AddGoogleAnalyticsRequest $postBody, $optParams = [])
|
---|
136 | {
|
---|
137 | $params = ['parent' => $parent, 'postBody' => $postBody];
|
---|
138 | $params = array_merge($params, $optParams);
|
---|
139 | return $this->call('addGoogleAnalytics', [$params], Operation::class);
|
---|
140 | }
|
---|
141 | /**
|
---|
142 | * Gets the specified FirebaseProject. (projects.get)
|
---|
143 | *
|
---|
144 | * @param string $name The resource name of the FirebaseProject, in the format:
|
---|
145 | * projects/ PROJECT_IDENTIFIER Refer to the `FirebaseProject`
|
---|
146 | * [`name`](../projects#FirebaseProject.FIELDS.name) field for details about
|
---|
147 | * PROJECT_IDENTIFIER values.
|
---|
148 | * @param array $optParams Optional parameters.
|
---|
149 | * @return FirebaseProject
|
---|
150 | * @throws \Google\Service\Exception
|
---|
151 | */
|
---|
152 | public function get($name, $optParams = [])
|
---|
153 | {
|
---|
154 | $params = ['name' => $name];
|
---|
155 | $params = array_merge($params, $optParams);
|
---|
156 | return $this->call('get', [$params], FirebaseProject::class);
|
---|
157 | }
|
---|
158 | /**
|
---|
159 | * Gets the configuration artifact associated with the specified
|
---|
160 | * FirebaseProject, which can be used by servers to simplify initialization.
|
---|
161 | * Typically, this configuration is used with the Firebase Admin SDK [initialize
|
---|
162 | * App](https://firebase.google.com/docs/admin/setup#initialize_the_sdk)
|
---|
163 | * command. (projects.getAdminSdkConfig)
|
---|
164 | *
|
---|
165 | * @param string $name The resource name of the FirebaseProject, in the format:
|
---|
166 | * projects/ PROJECT_IDENTIFIER/adminSdkConfig Refer to the `FirebaseProject`
|
---|
167 | * [`name`](../projects#FirebaseProject.FIELDS.name) field for details about
|
---|
168 | * PROJECT_IDENTIFIER values.
|
---|
169 | * @param array $optParams Optional parameters.
|
---|
170 | * @return AdminSdkConfig
|
---|
171 | * @throws \Google\Service\Exception
|
---|
172 | */
|
---|
173 | public function getAdminSdkConfig($name, $optParams = [])
|
---|
174 | {
|
---|
175 | $params = ['name' => $name];
|
---|
176 | $params = array_merge($params, $optParams);
|
---|
177 | return $this->call('getAdminSdkConfig', [$params], AdminSdkConfig::class);
|
---|
178 | }
|
---|
179 | /**
|
---|
180 | * Gets the Google Analytics details currently associated with the specified
|
---|
181 | * FirebaseProject. If the `FirebaseProject` is not yet linked to Google
|
---|
182 | * Analytics, then the response to `GetAnalyticsDetails` is `NOT_FOUND`.
|
---|
183 | * (projects.getAnalyticsDetails)
|
---|
184 | *
|
---|
185 | * @param string $name The resource name of the FirebaseProject, in the format:
|
---|
186 | * projects/ PROJECT_IDENTIFIER/analyticsDetails Refer to the `FirebaseProject`
|
---|
187 | * [`name`](../projects#FirebaseProject.FIELDS.name) field for details about
|
---|
188 | * PROJECT_IDENTIFIER values.
|
---|
189 | * @param array $optParams Optional parameters.
|
---|
190 | * @return AnalyticsDetails
|
---|
191 | * @throws \Google\Service\Exception
|
---|
192 | */
|
---|
193 | public function getAnalyticsDetails($name, $optParams = [])
|
---|
194 | {
|
---|
195 | $params = ['name' => $name];
|
---|
196 | $params = array_merge($params, $optParams);
|
---|
197 | return $this->call('getAnalyticsDetails', [$params], AnalyticsDetails::class);
|
---|
198 | }
|
---|
199 | /**
|
---|
200 | * Lists each FirebaseProject accessible to the caller. The elements are
|
---|
201 | * returned in no particular order, but they will be a consistent view of the
|
---|
202 | * Projects when additional requests are made with a `pageToken`. This method is
|
---|
203 | * eventually consistent with Project mutations, which means newly provisioned
|
---|
204 | * Projects and recent modifications to existing Projects might not be reflected
|
---|
205 | * in the set of Projects. The list will include only ACTIVE Projects. Use
|
---|
206 | * GetFirebaseProject for consistent reads as well as for additional Project
|
---|
207 | * details. (projects.listProjects)
|
---|
208 | *
|
---|
209 | * @param array $optParams Optional parameters.
|
---|
210 | *
|
---|
211 | * @opt_param int pageSize The maximum number of Projects to return in the
|
---|
212 | * response. The server may return fewer than this at its discretion. If no
|
---|
213 | * value is specified (or too large a value is specified), the server will
|
---|
214 | * impose its own limit. This value cannot be negative.
|
---|
215 | * @opt_param string pageToken Token returned from a previous call to
|
---|
216 | * `ListFirebaseProjects` indicating where in the set of Projects to resume
|
---|
217 | * listing.
|
---|
218 | * @opt_param bool showDeleted Optional. Controls whether Projects in the
|
---|
219 | * DELETED state should be returned in the response. If not specified, only
|
---|
220 | * `ACTIVE` Projects will be returned.
|
---|
221 | * @return ListFirebaseProjectsResponse
|
---|
222 | * @throws \Google\Service\Exception
|
---|
223 | */
|
---|
224 | public function listProjects($optParams = [])
|
---|
225 | {
|
---|
226 | $params = [];
|
---|
227 | $params = array_merge($params, $optParams);
|
---|
228 | return $this->call('list', [$params], ListFirebaseProjectsResponse::class);
|
---|
229 | }
|
---|
230 | /**
|
---|
231 | * Updates the attributes of the specified FirebaseProject. All [query
|
---|
232 | * parameters](#query-parameters) are required. (projects.patch)
|
---|
233 | *
|
---|
234 | * @param string $name The resource name of the Project, in the format:
|
---|
235 | * projects/PROJECT_IDENTIFIER PROJECT_IDENTIFIER: the Project's
|
---|
236 | * [`ProjectNumber`](../projects#FirebaseProject.FIELDS.project_number)
|
---|
237 | * ***(recommended)*** or its
|
---|
238 | * [`ProjectId`](../projects#FirebaseProject.FIELDS.project_id). Learn more
|
---|
239 | * about using project identifiers in Google's [AIP 2510
|
---|
240 | * standard](https://google.aip.dev/cloud/2510). Note that the value for
|
---|
241 | * PROJECT_IDENTIFIER in any response body will be the `ProjectId`.
|
---|
242 | * @param FirebaseProject $postBody
|
---|
243 | * @param array $optParams Optional parameters.
|
---|
244 | *
|
---|
245 | * @opt_param string updateMask Specifies which fields of the FirebaseProject to
|
---|
246 | * update. Note that the following fields are immutable: `name`, `project_id`,
|
---|
247 | * and `project_number`. To update `state`, use any of the following Google
|
---|
248 | * Cloud endpoints: [`projects.delete`](https://cloud.google.com/resource-
|
---|
249 | * manager/reference/rest/v1/projects/delete) or
|
---|
250 | * [`projects.undelete`](https://cloud.google.com/resource-
|
---|
251 | * manager/reference/rest/v1/projects/undelete)
|
---|
252 | * @return FirebaseProject
|
---|
253 | * @throws \Google\Service\Exception
|
---|
254 | */
|
---|
255 | public function patch($name, FirebaseProject $postBody, $optParams = [])
|
---|
256 | {
|
---|
257 | $params = ['name' => $name, 'postBody' => $postBody];
|
---|
258 | $params = array_merge($params, $optParams);
|
---|
259 | return $this->call('patch', [$params], FirebaseProject::class);
|
---|
260 | }
|
---|
261 | /**
|
---|
262 | * Unlinks the specified FirebaseProject from its Google Analytics account. This
|
---|
263 | * call removes the association of the specified `FirebaseProject` with its
|
---|
264 | * current Google Analytics property. However, this call does not delete the
|
---|
265 | * Google Analytics resources, such as the Google Analytics property or any data
|
---|
266 | * streams. These resources may be re-associated later to the `FirebaseProject`
|
---|
267 | * by calling [`AddGoogleAnalytics`](../../v1beta1/projects/addGoogleAnalytics)
|
---|
268 | * and specifying the same `analyticsPropertyId`. For Android Apps and iOS Apps,
|
---|
269 | * this call re-links data streams with their corresponding apps. However, for
|
---|
270 | * Web Apps, this call provisions a *new* data stream for each Web App. To call
|
---|
271 | * `RemoveAnalytics`, a project member must be an Owner for the
|
---|
272 | * `FirebaseProject`. (projects.removeAnalytics)
|
---|
273 | *
|
---|
274 | * @param string $parent The resource name of the FirebaseProject to unlink from
|
---|
275 | * its Google Analytics account, in the format: projects/PROJECT_IDENTIFIER
|
---|
276 | * Refer to the `FirebaseProject`
|
---|
277 | * [`name`](../projects#FirebaseProject.FIELDS.name) field for details about
|
---|
278 | * PROJECT_IDENTIFIER values.
|
---|
279 | * @param RemoveAnalyticsRequest $postBody
|
---|
280 | * @param array $optParams Optional parameters.
|
---|
281 | * @return FirebaseEmpty
|
---|
282 | * @throws \Google\Service\Exception
|
---|
283 | */
|
---|
284 | public function removeAnalytics($parent, RemoveAnalyticsRequest $postBody, $optParams = [])
|
---|
285 | {
|
---|
286 | $params = ['parent' => $parent, 'postBody' => $postBody];
|
---|
287 | $params = array_merge($params, $optParams);
|
---|
288 | return $this->call('removeAnalytics', [$params], FirebaseEmpty::class);
|
---|
289 | }
|
---|
290 | /**
|
---|
291 | * Lists all available Apps for the specified FirebaseProject. This is a
|
---|
292 | * convenience method. Typically, interaction with an App should be done using
|
---|
293 | * the platform-specific service, but some tool use-cases require a summary of
|
---|
294 | * all known Apps (such as for App selector interfaces). (projects.searchApps)
|
---|
295 | *
|
---|
296 | * @param string $parent The parent FirebaseProject for which to list Apps, in
|
---|
297 | * the format: projects/ PROJECT_IDENTIFIER Refer to the `FirebaseProject`
|
---|
298 | * [`name`](../projects#FirebaseProject.FIELDS.name) field for details about
|
---|
299 | * PROJECT_IDENTIFIER values.
|
---|
300 | * @param array $optParams Optional parameters.
|
---|
301 | *
|
---|
302 | * @opt_param string filter A query string compatible with Google's [AIP-160
|
---|
303 | * standard](https://google.aip.dev/160). Use any of the following fields in a
|
---|
304 | * query: * [`app_id`](../projects/searchApps#FirebaseAppInfo.FIELDS.app_id) *
|
---|
305 | * [`namespace`](../projects/searchApps#FirebaseAppInfo.FIELDS.namespace) *
|
---|
306 | * [`platform`](../projects/searchApps#FirebaseAppInfo.FIELDS.platform) This
|
---|
307 | * query also supports the following "virtual" fields. These are fields which
|
---|
308 | * are not actually part of the returned resource object, but they can be
|
---|
309 | * queried as if they are pre-populated with specific values. * `sha1_hash` or
|
---|
310 | * `sha1_hashes`: This field is considered to be a _repeated_ `string` field,
|
---|
311 | * populated with the list of all SHA-1 certificate fingerprints registered with
|
---|
312 | * the AndroidApp. This list is empty if the App is not an `AndroidApp`. *
|
---|
313 | * `sha256_hash` or `sha256_hashes`: This field is considered to be a _repeated_
|
---|
314 | * `string` field, populated with the list of all SHA-256 certificate
|
---|
315 | * fingerprints registered with the AndroidApp. This list is empty if the App is
|
---|
316 | * not an `AndroidApp`. * `app_store_id`: This field is considered to be a
|
---|
317 | * _singular_ `string` field, populated with the Apple App Store ID registered
|
---|
318 | * with the IosApp. This field is empty if the App is not an `IosApp`. *
|
---|
319 | * `team_id`: This field is considered to be a _singular_ `string` field,
|
---|
320 | * populated with the Apple team ID registered with the IosApp. This field is
|
---|
321 | * empty if the App is not an `IosApp`.
|
---|
322 | * @opt_param int pageSize The maximum number of Apps to return in the response.
|
---|
323 | * The server may return fewer than this value at its discretion. If no value is
|
---|
324 | * specified (or too large a value is specified), then the server will impose
|
---|
325 | * its own limit. This value cannot be negative.
|
---|
326 | * @opt_param string pageToken Token returned from a previous call to
|
---|
327 | * `SearchFirebaseApps` indicating where in the set of Apps to resume listing.
|
---|
328 | * @opt_param bool showDeleted Controls whether Apps in the DELETED state should
|
---|
329 | * be returned. If not specified, only `ACTIVE` Apps will be returned.
|
---|
330 | * @return SearchFirebaseAppsResponse
|
---|
331 | * @throws \Google\Service\Exception
|
---|
332 | */
|
---|
333 | public function searchApps($parent, $optParams = [])
|
---|
334 | {
|
---|
335 | $params = ['parent' => $parent];
|
---|
336 | $params = array_merge($params, $optParams);
|
---|
337 | return $this->call('searchApps', [$params], SearchFirebaseAppsResponse::class);
|
---|
338 | }
|
---|
339 | }
|
---|
340 |
|
---|
341 | // Adding a class alias for backwards compatibility with the previous class name.
|
---|
342 | class_alias(Projects::class, 'Google_Service_FirebaseManagement_Resource_Projects');
|
---|