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\FirebaseRules\Resource;
|
---|
19 |
|
---|
20 | use Google\Service\FirebaseRules\FirebaserulesEmpty;
|
---|
21 | use Google\Service\FirebaseRules\ListRulesetsResponse;
|
---|
22 | use Google\Service\FirebaseRules\Ruleset;
|
---|
23 |
|
---|
24 | /**
|
---|
25 | * The "rulesets" collection of methods.
|
---|
26 | * Typical usage is:
|
---|
27 | * <code>
|
---|
28 | * $firebaserulesService = new Google\Service\FirebaseRules(...);
|
---|
29 | * $rulesets = $firebaserulesService->projects_rulesets;
|
---|
30 | * </code>
|
---|
31 | */
|
---|
32 | class ProjectsRulesets extends \Google\Service\Resource
|
---|
33 | {
|
---|
34 | /**
|
---|
35 | * Create a `Ruleset` from `Source`. The `Ruleset` is given a unique generated
|
---|
36 | * name which is returned to the caller. `Source` containing syntactic or
|
---|
37 | * semantics errors will result in an error response indicating the first error
|
---|
38 | * encountered. For a detailed view of `Source` issues, use TestRuleset.
|
---|
39 | * (rulesets.create)
|
---|
40 | *
|
---|
41 | * @param string $name Required. Resource name for Project which owns this
|
---|
42 | * `Ruleset`. Format: `projects/{project_id}`
|
---|
43 | * @param Ruleset $postBody
|
---|
44 | * @param array $optParams Optional parameters.
|
---|
45 | * @return Ruleset
|
---|
46 | * @throws \Google\Service\Exception
|
---|
47 | */
|
---|
48 | public function create($name, Ruleset $postBody, $optParams = [])
|
---|
49 | {
|
---|
50 | $params = ['name' => $name, 'postBody' => $postBody];
|
---|
51 | $params = array_merge($params, $optParams);
|
---|
52 | return $this->call('create', [$params], Ruleset::class);
|
---|
53 | }
|
---|
54 | /**
|
---|
55 | * Delete a `Ruleset` by resource name. If the `Ruleset` is referenced by a
|
---|
56 | * `Release` the operation will fail. (rulesets.delete)
|
---|
57 | *
|
---|
58 | * @param string $name Required. Resource name for the ruleset to delete.
|
---|
59 | * Format: `projects/{project_id}/rulesets/{ruleset_id}`
|
---|
60 | * @param array $optParams Optional parameters.
|
---|
61 | * @return FirebaserulesEmpty
|
---|
62 | * @throws \Google\Service\Exception
|
---|
63 | */
|
---|
64 | public function delete($name, $optParams = [])
|
---|
65 | {
|
---|
66 | $params = ['name' => $name];
|
---|
67 | $params = array_merge($params, $optParams);
|
---|
68 | return $this->call('delete', [$params], FirebaserulesEmpty::class);
|
---|
69 | }
|
---|
70 | /**
|
---|
71 | * Get a `Ruleset` by name including the full `Source` contents. (rulesets.get)
|
---|
72 | *
|
---|
73 | * @param string $name Required. Resource name for the ruleset to get. Format:
|
---|
74 | * `projects/{project_id}/rulesets/{ruleset_id}`
|
---|
75 | * @param array $optParams Optional parameters.
|
---|
76 | * @return Ruleset
|
---|
77 | * @throws \Google\Service\Exception
|
---|
78 | */
|
---|
79 | public function get($name, $optParams = [])
|
---|
80 | {
|
---|
81 | $params = ['name' => $name];
|
---|
82 | $params = array_merge($params, $optParams);
|
---|
83 | return $this->call('get', [$params], Ruleset::class);
|
---|
84 | }
|
---|
85 | /**
|
---|
86 | * List `Ruleset` metadata only and optionally filter the results by `Ruleset`
|
---|
87 | * name. The full `Source` contents of a `Ruleset` may be retrieved with
|
---|
88 | * GetRuleset. (rulesets.listProjectsRulesets)
|
---|
89 | *
|
---|
90 | * @param string $name Required. Resource name for the project. Format:
|
---|
91 | * `projects/{project_id}`
|
---|
92 | * @param array $optParams Optional parameters.
|
---|
93 | *
|
---|
94 | * @opt_param string filter `Ruleset` filter. The list method supports filters
|
---|
95 | * with restrictions on `Ruleset.name`. Filters on `Ruleset.create_time` should
|
---|
96 | * use the `date` function which parses strings that conform to the RFC 3339
|
---|
97 | * date/time specifications. Example: `create_time >
|
---|
98 | * date("2017-01-01T00:00:00Z") AND name=UUID-*`
|
---|
99 | * @opt_param int pageSize Page size to load. Maximum of 100. Defaults to 10.
|
---|
100 | * Note: `page_size` is just a hint and the service may choose to load less than
|
---|
101 | * `page_size` due to the size of the output. To traverse all of the releases,
|
---|
102 | * caller should iterate until the `page_token` is empty.
|
---|
103 | * @opt_param string pageToken Next page token for loading the next batch of
|
---|
104 | * `Ruleset` instances.
|
---|
105 | * @return ListRulesetsResponse
|
---|
106 | * @throws \Google\Service\Exception
|
---|
107 | */
|
---|
108 | public function listProjectsRulesets($name, $optParams = [])
|
---|
109 | {
|
---|
110 | $params = ['name' => $name];
|
---|
111 | $params = array_merge($params, $optParams);
|
---|
112 | return $this->call('list', [$params], ListRulesetsResponse::class);
|
---|
113 | }
|
---|
114 | }
|
---|
115 |
|
---|
116 | // Adding a class alias for backwards compatibility with the previous class name.
|
---|
117 | class_alias(ProjectsRulesets::class, 'Google_Service_FirebaseRules_Resource_ProjectsRulesets');
|
---|