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\FirebaseRules\Resource; 19 20use Google\Service\FirebaseRules\FirebaserulesEmpty; 21use Google\Service\FirebaseRules\GetReleaseExecutableResponse; 22use Google\Service\FirebaseRules\ListReleasesResponse; 23use Google\Service\FirebaseRules\Release; 24use 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->releases; 32 * </code> 33 */ 34class 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 */ 58 public function create($name, Release $postBody, $optParams = []) 59 { 60 $params = ['name' => $name, 'postBody' => $postBody]; 61 $params = array_merge($params, $optParams); 62 return $this->call('create', [$params], Release::class); 63 } 64 /** 65 * Delete a `Release` by resource name. (releases.delete) 66 * 67 * @param string $name Required. Resource name for the `Release` to delete. 68 * Format: `projects/{project_id}/releases/{release_id}` 69 * @param array $optParams Optional parameters. 70 * @return FirebaserulesEmpty 71 */ 72 public function delete($name, $optParams = []) 73 { 74 $params = ['name' => $name]; 75 $params = array_merge($params, $optParams); 76 return $this->call('delete', [$params], FirebaserulesEmpty::class); 77 } 78 /** 79 * Get a `Release` by name. (releases.get) 80 * 81 * @param string $name Required. Resource name of the `Release`. Format: 82 * `projects/{project_id}/releases/{release_id}` 83 * @param array $optParams Optional parameters. 84 * @return Release 85 */ 86 public function get($name, $optParams = []) 87 { 88 $params = ['name' => $name]; 89 $params = array_merge($params, $optParams); 90 return $this->call('get', [$params], Release::class); 91 } 92 /** 93 * Get the `Release` executable to use when enforcing rules. 94 * (releases.getExecutable) 95 * 96 * @param string $name Required. Resource name of the `Release`. Format: 97 * `projects/{project_id}/releases/{release_id}` 98 * @param array $optParams Optional parameters. 99 * 100 * @opt_param string executableVersion The requested runtime executable version. 101 * Defaults to FIREBASE_RULES_EXECUTABLE_V1. 102 * @return GetReleaseExecutableResponse 103 */ 104 public function getExecutable($name, $optParams = []) 105 { 106 $params = ['name' => $name]; 107 $params = array_merge($params, $optParams); 108 return $this->call('getExecutable', [$params], GetReleaseExecutableResponse::class); 109 } 110 /** 111 * List the `Release` values for a project. This list may optionally be filtered 112 * by `Release` name, `Ruleset` name, `TestSuite` name, or any combination 113 * thereof. (releases.listProjectsReleases) 114 * 115 * @param string $name Required. Resource name for the project. Format: 116 * `projects/{project_id}` 117 * @param array $optParams Optional parameters. 118 * 119 * @opt_param string filter `Release` filter. The list method supports filters 120 * with restrictions on the `Release.name`, and `Release.ruleset_name`. Example 121 * 1: A filter of 'name=prod*' might return `Release`s with names within 122 * 'projects/foo' prefixed with 'prod': Name -> Ruleset Name: * 123 * projects/foo/releases/prod -> projects/foo/rulesets/uuid1234 * 124 * projects/foo/releases/prod/v1 -> projects/foo/rulesets/uuid1234 * 125 * projects/foo/releases/prod/v2 -> projects/foo/rulesets/uuid8888 Example 2: A 126 * filter of `name=prod* ruleset_name=uuid1234` would return only `Release` 127 * instances for 'projects/foo' with names prefixed with 'prod' referring to the 128 * same `Ruleset` name of 'uuid1234': Name -> Ruleset Name: * 129 * projects/foo/releases/prod -> projects/foo/rulesets/1234 * 130 * projects/foo/releases/prod/v1 -> projects/foo/rulesets/1234 In the examples, 131 * the filter parameters refer to the search filters are relative to the 132 * project. Fully qualified prefixed may also be used. 133 * @opt_param int pageSize Page size to load. Maximum of 100. Defaults to 10. 134 * Note: `page_size` is just a hint and the service may choose to load fewer 135 * than `page_size` results due to the size of the output. To traverse all of 136 * the releases, the caller should iterate until the `page_token` on the 137 * response is empty. 138 * @opt_param string pageToken Next page token for the next batch of `Release` 139 * instances. 140 * @return ListReleasesResponse 141 */ 142 public function listProjectsReleases($name, $optParams = []) 143 { 144 $params = ['name' => $name]; 145 $params = array_merge($params, $optParams); 146 return $this->call('list', [$params], ListReleasesResponse::class); 147 } 148 /** 149 * Update a `Release` via PATCH. Only updates to `ruleset_name` will be honored. 150 * `Release` rename is not supported. To create a `Release` use the 151 * CreateRelease method. (releases.patch) 152 * 153 * @param string $name Required. Resource name for the project which owns this 154 * `Release`. Format: `projects/{project_id}` 155 * @param UpdateReleaseRequest $postBody 156 * @param array $optParams Optional parameters. 157 * @return Release 158 */ 159 public function patch($name, UpdateReleaseRequest $postBody, $optParams = []) 160 { 161 $params = ['name' => $name, 'postBody' => $postBody]; 162 $params = array_merge($params, $optParams); 163 return $this->call('patch', [$params], Release::class); 164 } 165} 166 167// Adding a class alias for backwards compatibility with the previous class name. 168class_alias(ProjectsReleases::class, 'Google_Service_FirebaseRules_Resource_ProjectsReleases'); 169