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\TestRulesetRequest; 21use Google\Service\FirebaseRules\TestRulesetResponse; 22 23/** 24 * The "projects" collection of methods. 25 * Typical usage is: 26 * <code> 27 * $firebaserulesService = new Google\Service\FirebaseRules(...); 28 * $projects = $firebaserulesService->projects; 29 * </code> 30 */ 31class Projects extends \Google\Service\Resource 32{ 33 /** 34 * Test `Source` for syntactic and semantic correctness. Issues present, if any, 35 * will be returned to the caller with a description, severity, and source 36 * location. The test method may be executed with `Source` or a `Ruleset` name. 37 * Passing `Source` is useful for unit testing new rules. Passing a `Ruleset` 38 * name is useful for regression testing an existing rule. The following is an 39 * example of `Source` that permits users to upload images to a bucket bearing 40 * their user id and matching the correct metadata: _*Example*_ // Users are 41 * allowed to subscribe and unsubscribe to the blog. service firebase.storage { 42 * match /users/{userId}/images/{imageName} { allow write: if userId == 43 * request.auth.uid && (imageName.matches('*.png$') || 44 * imageName.matches('*.jpg$')) && resource.mimeType.matches('^image/') } } 45 * (projects.test) 46 * 47 * @param string $name Required. Tests may either provide `source` or a 48 * `Ruleset` resource name. For tests against `source`, the resource name must 49 * refer to the project: Format: `projects/{project_id}` For tests against a 50 * `Ruleset`, this must be the `Ruleset` resource name: Format: 51 * `projects/{project_id}/rulesets/{ruleset_id}` 52 * @param TestRulesetRequest $postBody 53 * @param array $optParams Optional parameters. 54 * @return TestRulesetResponse 55 */ 56 public function test($name, TestRulesetRequest $postBody, $optParams = []) 57 { 58 $params = ['name' => $name, 'postBody' => $postBody]; 59 $params = array_merge($params, $optParams); 60 return $this->call('test', [$params], TestRulesetResponse::class); 61 } 62} 63 64// Adding a class alias for backwards compatibility with the previous class name. 65class_alias(Projects::class, 'Google_Service_FirebaseRules_Resource_Projects'); 66