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\GetReleaseExecutableResponse;
|
---|
22 | use Google\Service\FirebaseRules\ListReleasesResponse;
|
---|
23 | use Google\Service\FirebaseRules\Release;
|
---|
24 | use Google\Service\FirebaseRules\UpdateReleaseRequest;
|
---|
25 |
|
---|
26 | /**
|
---|
27 | * The "releases" collection of methods.
|
---|
28 | * Typical usage is:
|
---|
29 | * <code>
|
---|
30 | * $firebaserulesService = new Google\Service\FirebaseRules(...);
|
---|
31 | * $releases = $firebaserulesService->projects_releases;
|
---|
32 | * </code>
|
---|
33 | */
|
---|
34 | class ProjectsReleases extends \Google\Service\Resource
|
---|
35 | {
|
---|
36 | /**
|
---|
37 | * Create a `Release`. Release names should reflect the developer's deployment
|
---|
38 | * practices. For example, the release name may include the environment name,
|
---|
39 | * application name, application version, or any other name meaningful to the
|
---|
40 | * developer. Once a `Release` refers to a `Ruleset`, the rules can be enforced
|
---|
41 | * by Firebase Rules-enabled services. More than one `Release` may be 'live'
|
---|
42 | * concurrently. Consider the following three `Release` names for `projects/foo`
|
---|
43 | * and the `Ruleset` to which they refer. Release Name -> Ruleset Name *
|
---|
44 | * projects/foo/releases/prod -> projects/foo/rulesets/uuid123 *
|
---|
45 | * projects/foo/releases/prod/beta -> projects/foo/rulesets/uuid123 *
|
---|
46 | * projects/foo/releases/prod/v23 -> projects/foo/rulesets/uuid456 The
|
---|
47 | * relationships reflect a `Ruleset` rollout in progress. The `prod` and
|
---|
48 | * `prod/beta` releases refer to the same `Ruleset`. However, `prod/v23` refers
|
---|
49 | * to a new `Ruleset`. The `Ruleset` reference for a `Release` may be updated
|
---|
50 | * using the UpdateRelease method. (releases.create)
|
---|
51 | *
|
---|
52 | * @param string $name Required. Resource name for the project which owns this
|
---|
53 | * `Release`. Format: `projects/{project_id}`
|
---|
54 | * @param Release $postBody
|
---|
55 | * @param array $optParams Optional parameters.
|
---|
56 | * @return Release
|
---|
57 | * @throws \Google\Service\Exception
|
---|
58 | */
|
---|
59 | public function create($name, Release $postBody, $optParams = [])
|
---|
60 | {
|
---|
61 | $params = ['name' => $name, 'postBody' => $postBody];
|
---|
62 | $params = array_merge($params, $optParams);
|
---|
63 | return $this->call('create', [$params], Release::class);
|
---|
64 | }
|
---|
65 | /**
|
---|
66 | * Delete a `Release` by resource name. (releases.delete)
|
---|
67 | *
|
---|
68 | * @param string $name Required. Resource name for the `Release` to delete.
|
---|
69 | * Format: `projects/{project_id}/releases/{release_id}`
|
---|
70 | * @param array $optParams Optional parameters.
|
---|
71 | * @return FirebaserulesEmpty
|
---|
72 | * @throws \Google\Service\Exception
|
---|
73 | */
|
---|
74 | public function delete($name, $optParams = [])
|
---|
75 | {
|
---|
76 | $params = ['name' => $name];
|
---|
77 | $params = array_merge($params, $optParams);
|
---|
78 | return $this->call('delete', [$params], FirebaserulesEmpty::class);
|
---|
79 | }
|
---|
80 | /**
|
---|
81 | * Get a `Release` by name. (releases.get)
|
---|
82 | *
|
---|
83 | * @param string $name Required. Resource name of the `Release`. Format:
|
---|
84 | * `projects/{project_id}/releases/{release_id}`
|
---|
85 | * @param array $optParams Optional parameters.
|
---|
86 | * @return Release
|
---|
87 | * @throws \Google\Service\Exception
|
---|
88 | */
|
---|
89 | public function get($name, $optParams = [])
|
---|
90 | {
|
---|
91 | $params = ['name' => $name];
|
---|
92 | $params = array_merge($params, $optParams);
|
---|
93 | return $this->call('get', [$params], Release::class);
|
---|
94 | }
|
---|
95 | /**
|
---|
96 | * Get the `Release` executable to use when enforcing rules.
|
---|
97 | * (releases.getExecutable)
|
---|
98 | *
|
---|
99 | * @param string $name Required. Resource name of the `Release`. Format:
|
---|
100 | * `projects/{project_id}/releases/{release_id}`
|
---|
101 | * @param array $optParams Optional parameters.
|
---|
102 | *
|
---|
103 | * @opt_param string executableVersion The requested runtime executable version.
|
---|
104 | * Defaults to FIREBASE_RULES_EXECUTABLE_V1.
|
---|
105 | * @return GetReleaseExecutableResponse
|
---|
106 | * @throws \Google\Service\Exception
|
---|
107 | */
|
---|
108 | public function getExecutable($name, $optParams = [])
|
---|
109 | {
|
---|
110 | $params = ['name' => $name];
|
---|
111 | $params = array_merge($params, $optParams);
|
---|
112 | return $this->call('getExecutable', [$params], GetReleaseExecutableResponse::class);
|
---|
113 | }
|
---|
114 | /**
|
---|
115 | * List the `Release` values for a project. This list may optionally be filtered
|
---|
116 | * by `Release` name, `Ruleset` name, `TestSuite` name, or any combination
|
---|
117 | * thereof. (releases.listProjectsReleases)
|
---|
118 | *
|
---|
119 | * @param string $name Required. Resource name for the project. Format:
|
---|
120 | * `projects/{project_id}`
|
---|
121 | * @param array $optParams Optional parameters.
|
---|
122 | *
|
---|
123 | * @opt_param string filter `Release` filter. The list method supports filters
|
---|
124 | * with restrictions on the `Release.name`, and `Release.ruleset_name`. Example
|
---|
125 | * 1: A filter of 'name=prod*' might return `Release`s with names within
|
---|
126 | * 'projects/foo' prefixed with 'prod': Name -> Ruleset Name: *
|
---|
127 | * projects/foo/releases/prod -> projects/foo/rulesets/uuid1234 *
|
---|
128 | * projects/foo/releases/prod/v1 -> projects/foo/rulesets/uuid1234 *
|
---|
129 | * projects/foo/releases/prod/v2 -> projects/foo/rulesets/uuid8888 Example 2: A
|
---|
130 | * filter of `name=prod* ruleset_name=uuid1234` would return only `Release`
|
---|
131 | * instances for 'projects/foo' with names prefixed with 'prod' referring to the
|
---|
132 | * same `Ruleset` name of 'uuid1234': Name -> Ruleset Name: *
|
---|
133 | * projects/foo/releases/prod -> projects/foo/rulesets/1234 *
|
---|
134 | * projects/foo/releases/prod/v1 -> projects/foo/rulesets/1234 In the examples,
|
---|
135 | * the filter parameters refer to the search filters are relative to the
|
---|
136 | * project. Fully qualified prefixed may also be used.
|
---|
137 | * @opt_param int pageSize Page size to load. Maximum of 100. Defaults to 10.
|
---|
138 | * Note: `page_size` is just a hint and the service may choose to load fewer
|
---|
139 | * than `page_size` results due to the size of the output. To traverse all of
|
---|
140 | * the releases, the caller should iterate until the `page_token` on the
|
---|
141 | * response is empty.
|
---|
142 | * @opt_param string pageToken Next page token for the next batch of `Release`
|
---|
143 | * instances.
|
---|
144 | * @return ListReleasesResponse
|
---|
145 | * @throws \Google\Service\Exception
|
---|
146 | */
|
---|
147 | public function listProjectsReleases($name, $optParams = [])
|
---|
148 | {
|
---|
149 | $params = ['name' => $name];
|
---|
150 | $params = array_merge($params, $optParams);
|
---|
151 | return $this->call('list', [$params], ListReleasesResponse::class);
|
---|
152 | }
|
---|
153 | /**
|
---|
154 | * Update a `Release` via PATCH. Only updates to `ruleset_name` will be honored.
|
---|
155 | * `Release` rename is not supported. To create a `Release` use the
|
---|
156 | * CreateRelease method. (releases.patch)
|
---|
157 | *
|
---|
158 | * @param string $name Required. Resource name for the project which owns this
|
---|
159 | * `Release`. Format: `projects/{project_id}`
|
---|
160 | * @param UpdateReleaseRequest $postBody
|
---|
161 | * @param array $optParams Optional parameters.
|
---|
162 | * @return Release
|
---|
163 | * @throws \Google\Service\Exception
|
---|
164 | */
|
---|
165 | public function patch($name, UpdateReleaseRequest $postBody, $optParams = [])
|
---|
166 | {
|
---|
167 | $params = ['name' => $name, 'postBody' => $postBody];
|
---|
168 | $params = array_merge($params, $optParams);
|
---|
169 | return $this->call('patch', [$params], Release::class);
|
---|
170 | }
|
---|
171 | }
|
---|
172 |
|
---|
173 | // Adding a class alias for backwards compatibility with the previous class name.
|
---|
174 | class_alias(ProjectsReleases::class, 'Google_Service_FirebaseRules_Resource_ProjectsReleases');
|
---|