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\Pubsub\Resource; 19 20use Google\Service\Pubsub\ListSchemasResponse; 21use Google\Service\Pubsub\Policy; 22use Google\Service\Pubsub\PubsubEmpty; 23use Google\Service\Pubsub\Schema; 24use Google\Service\Pubsub\SetIamPolicyRequest; 25use Google\Service\Pubsub\TestIamPermissionsRequest; 26use Google\Service\Pubsub\TestIamPermissionsResponse; 27use Google\Service\Pubsub\ValidateMessageRequest; 28use Google\Service\Pubsub\ValidateMessageResponse; 29use Google\Service\Pubsub\ValidateSchemaRequest; 30use Google\Service\Pubsub\ValidateSchemaResponse; 31 32/** 33 * The "schemas" collection of methods. 34 * Typical usage is: 35 * <code> 36 * $pubsubService = new Google\Service\Pubsub(...); 37 * $schemas = $pubsubService->schemas; 38 * </code> 39 */ 40class ProjectsSchemas extends \Google\Service\Resource 41{ 42 /** 43 * Creates a schema. (schemas.create) 44 * 45 * @param string $parent Required. The name of the project in which to create 46 * the schema. Format is `projects/{project-id}`. 47 * @param Schema $postBody 48 * @param array $optParams Optional parameters. 49 * 50 * @opt_param string schemaId The ID to use for the schema, which will become 51 * the final component of the schema's resource name. See 52 * https://cloud.google.com/pubsub/docs/admin#resource_names for resource name 53 * constraints. 54 * @return Schema 55 */ 56 public function create($parent, Schema $postBody, $optParams = []) 57 { 58 $params = ['parent' => $parent, 'postBody' => $postBody]; 59 $params = array_merge($params, $optParams); 60 return $this->call('create', [$params], Schema::class); 61 } 62 /** 63 * Deletes a schema. (schemas.delete) 64 * 65 * @param string $name Required. Name of the schema to delete. Format is 66 * `projects/{project}/schemas/{schema}`. 67 * @param array $optParams Optional parameters. 68 * @return PubsubEmpty 69 */ 70 public function delete($name, $optParams = []) 71 { 72 $params = ['name' => $name]; 73 $params = array_merge($params, $optParams); 74 return $this->call('delete', [$params], PubsubEmpty::class); 75 } 76 /** 77 * Gets a schema. (schemas.get) 78 * 79 * @param string $name Required. The name of the schema to get. Format is 80 * `projects/{project}/schemas/{schema}`. 81 * @param array $optParams Optional parameters. 82 * 83 * @opt_param string view The set of fields to return in the response. If not 84 * set, returns a Schema with all fields filled out. Set to `BASIC` to omit the 85 * `definition`. 86 * @return Schema 87 */ 88 public function get($name, $optParams = []) 89 { 90 $params = ['name' => $name]; 91 $params = array_merge($params, $optParams); 92 return $this->call('get', [$params], Schema::class); 93 } 94 /** 95 * Gets the access control policy for a resource. Returns an empty policy if the 96 * resource exists and does not have a policy set. (schemas.getIamPolicy) 97 * 98 * @param string $resource REQUIRED: The resource for which the policy is being 99 * requested. See the operation documentation for the appropriate value for this 100 * field. 101 * @param array $optParams Optional parameters. 102 * 103 * @opt_param int options.requestedPolicyVersion Optional. The maximum policy 104 * version that will be used to format the policy. Valid values are 0, 1, and 3. 105 * Requests specifying an invalid value will be rejected. Requests for policies 106 * with any conditional role bindings must specify version 3. Policies with no 107 * conditional role bindings may specify any valid value or leave the field 108 * unset. The policy in the response might use the policy version that you 109 * specified, or it might use a lower policy version. For example, if you 110 * specify version 3, but the policy has no conditional role bindings, the 111 * response uses version 1. To learn which resources support conditions in their 112 * IAM policies, see the [IAM 113 * documentation](https://cloud.google.com/iam/help/conditions/resource- 114 * policies). 115 * @return Policy 116 */ 117 public function getIamPolicy($resource, $optParams = []) 118 { 119 $params = ['resource' => $resource]; 120 $params = array_merge($params, $optParams); 121 return $this->call('getIamPolicy', [$params], Policy::class); 122 } 123 /** 124 * Lists schemas in a project. (schemas.listProjectsSchemas) 125 * 126 * @param string $parent Required. The name of the project in which to list 127 * schemas. Format is `projects/{project-id}`. 128 * @param array $optParams Optional parameters. 129 * 130 * @opt_param int pageSize Maximum number of schemas to return. 131 * @opt_param string pageToken The value returned by the last 132 * `ListSchemasResponse`; indicates that this is a continuation of a prior 133 * `ListSchemas` call, and that the system should return the next page of data. 134 * @opt_param string view The set of Schema fields to return in the response. If 135 * not set, returns Schemas with `name` and `type`, but not `definition`. Set to 136 * `FULL` to retrieve all fields. 137 * @return ListSchemasResponse 138 */ 139 public function listProjectsSchemas($parent, $optParams = []) 140 { 141 $params = ['parent' => $parent]; 142 $params = array_merge($params, $optParams); 143 return $this->call('list', [$params], ListSchemasResponse::class); 144 } 145 /** 146 * Sets the access control policy on the specified resource. Replaces any 147 * existing policy. Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and 148 * `PERMISSION_DENIED` errors. (schemas.setIamPolicy) 149 * 150 * @param string $resource REQUIRED: The resource for which the policy is being 151 * specified. See the operation documentation for the appropriate value for this 152 * field. 153 * @param SetIamPolicyRequest $postBody 154 * @param array $optParams Optional parameters. 155 * @return Policy 156 */ 157 public function setIamPolicy($resource, SetIamPolicyRequest $postBody, $optParams = []) 158 { 159 $params = ['resource' => $resource, 'postBody' => $postBody]; 160 $params = array_merge($params, $optParams); 161 return $this->call('setIamPolicy', [$params], Policy::class); 162 } 163 /** 164 * Returns permissions that a caller has on the specified resource. If the 165 * resource does not exist, this will return an empty set of permissions, not a 166 * `NOT_FOUND` error. Note: This operation is designed to be used for building 167 * permission-aware UIs and command-line tools, not for authorization checking. 168 * This operation may "fail open" without warning. (schemas.testIamPermissions) 169 * 170 * @param string $resource REQUIRED: The resource for which the policy detail is 171 * being requested. See the operation documentation for the appropriate value 172 * for this field. 173 * @param TestIamPermissionsRequest $postBody 174 * @param array $optParams Optional parameters. 175 * @return TestIamPermissionsResponse 176 */ 177 public function testIamPermissions($resource, TestIamPermissionsRequest $postBody, $optParams = []) 178 { 179 $params = ['resource' => $resource, 'postBody' => $postBody]; 180 $params = array_merge($params, $optParams); 181 return $this->call('testIamPermissions', [$params], TestIamPermissionsResponse::class); 182 } 183 /** 184 * Validates a schema. (schemas.validate) 185 * 186 * @param string $parent Required. The name of the project in which to validate 187 * schemas. Format is `projects/{project-id}`. 188 * @param ValidateSchemaRequest $postBody 189 * @param array $optParams Optional parameters. 190 * @return ValidateSchemaResponse 191 */ 192 public function validate($parent, ValidateSchemaRequest $postBody, $optParams = []) 193 { 194 $params = ['parent' => $parent, 'postBody' => $postBody]; 195 $params = array_merge($params, $optParams); 196 return $this->call('validate', [$params], ValidateSchemaResponse::class); 197 } 198 /** 199 * Validates a message against a schema. (schemas.validateMessage) 200 * 201 * @param string $parent Required. The name of the project in which to validate 202 * schemas. Format is `projects/{project-id}`. 203 * @param ValidateMessageRequest $postBody 204 * @param array $optParams Optional parameters. 205 * @return ValidateMessageResponse 206 */ 207 public function validateMessage($parent, ValidateMessageRequest $postBody, $optParams = []) 208 { 209 $params = ['parent' => $parent, 'postBody' => $postBody]; 210 $params = array_merge($params, $optParams); 211 return $this->call('validateMessage', [$params], ValidateMessageResponse::class); 212 } 213} 214 215// Adding a class alias for backwards compatibility with the previous class name. 216class_alias(ProjectsSchemas::class, 'Google_Service_Pubsub_Resource_ProjectsSchemas'); 217