[e3d4e0a] | 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\Pubsub\Resource;
|
---|
| 19 |
|
---|
| 20 | use Google\Service\Pubsub\CommitSchemaRequest;
|
---|
| 21 | use Google\Service\Pubsub\ListSchemaRevisionsResponse;
|
---|
| 22 | use Google\Service\Pubsub\ListSchemasResponse;
|
---|
| 23 | use Google\Service\Pubsub\Policy;
|
---|
| 24 | use Google\Service\Pubsub\PubsubEmpty;
|
---|
| 25 | use Google\Service\Pubsub\RollbackSchemaRequest;
|
---|
| 26 | use Google\Service\Pubsub\Schema;
|
---|
| 27 | use Google\Service\Pubsub\SetIamPolicyRequest;
|
---|
| 28 | use Google\Service\Pubsub\TestIamPermissionsRequest;
|
---|
| 29 | use Google\Service\Pubsub\TestIamPermissionsResponse;
|
---|
| 30 | use Google\Service\Pubsub\ValidateMessageRequest;
|
---|
| 31 | use Google\Service\Pubsub\ValidateMessageResponse;
|
---|
| 32 | use Google\Service\Pubsub\ValidateSchemaRequest;
|
---|
| 33 | use Google\Service\Pubsub\ValidateSchemaResponse;
|
---|
| 34 |
|
---|
| 35 | /**
|
---|
| 36 | * The "schemas" collection of methods.
|
---|
| 37 | * Typical usage is:
|
---|
| 38 | * <code>
|
---|
| 39 | * $pubsubService = new Google\Service\Pubsub(...);
|
---|
| 40 | * $schemas = $pubsubService->projects_schemas;
|
---|
| 41 | * </code>
|
---|
| 42 | */
|
---|
| 43 | class ProjectsSchemas extends \Google\Service\Resource
|
---|
| 44 | {
|
---|
| 45 | /**
|
---|
| 46 | * Commits a new schema revision to an existing schema. (schemas.commit)
|
---|
| 47 | *
|
---|
| 48 | * @param string $name Required. The name of the schema we are revising. Format
|
---|
| 49 | * is `projects/{project}/schemas/{schema}`.
|
---|
| 50 | * @param CommitSchemaRequest $postBody
|
---|
| 51 | * @param array $optParams Optional parameters.
|
---|
| 52 | * @return Schema
|
---|
| 53 | * @throws \Google\Service\Exception
|
---|
| 54 | */
|
---|
| 55 | public function commit($name, CommitSchemaRequest $postBody, $optParams = [])
|
---|
| 56 | {
|
---|
| 57 | $params = ['name' => $name, 'postBody' => $postBody];
|
---|
| 58 | $params = array_merge($params, $optParams);
|
---|
| 59 | return $this->call('commit', [$params], Schema::class);
|
---|
| 60 | }
|
---|
| 61 | /**
|
---|
| 62 | * Creates a schema. (schemas.create)
|
---|
| 63 | *
|
---|
| 64 | * @param string $parent Required. The name of the project in which to create
|
---|
| 65 | * the schema. Format is `projects/{project-id}`.
|
---|
| 66 | * @param Schema $postBody
|
---|
| 67 | * @param array $optParams Optional parameters.
|
---|
| 68 | *
|
---|
| 69 | * @opt_param string schemaId The ID to use for the schema, which will become
|
---|
| 70 | * the final component of the schema's resource name. See
|
---|
| 71 | * https://cloud.google.com/pubsub/docs/pubsub-basics#resource_names for
|
---|
| 72 | * resource name constraints.
|
---|
| 73 | * @return Schema
|
---|
| 74 | * @throws \Google\Service\Exception
|
---|
| 75 | */
|
---|
| 76 | public function create($parent, Schema $postBody, $optParams = [])
|
---|
| 77 | {
|
---|
| 78 | $params = ['parent' => $parent, 'postBody' => $postBody];
|
---|
| 79 | $params = array_merge($params, $optParams);
|
---|
| 80 | return $this->call('create', [$params], Schema::class);
|
---|
| 81 | }
|
---|
| 82 | /**
|
---|
| 83 | * Deletes a schema. (schemas.delete)
|
---|
| 84 | *
|
---|
| 85 | * @param string $name Required. Name of the schema to delete. Format is
|
---|
| 86 | * `projects/{project}/schemas/{schema}`.
|
---|
| 87 | * @param array $optParams Optional parameters.
|
---|
| 88 | * @return PubsubEmpty
|
---|
| 89 | * @throws \Google\Service\Exception
|
---|
| 90 | */
|
---|
| 91 | public function delete($name, $optParams = [])
|
---|
| 92 | {
|
---|
| 93 | $params = ['name' => $name];
|
---|
| 94 | $params = array_merge($params, $optParams);
|
---|
| 95 | return $this->call('delete', [$params], PubsubEmpty::class);
|
---|
| 96 | }
|
---|
| 97 | /**
|
---|
| 98 | * Deletes a specific schema revision. (schemas.deleteRevision)
|
---|
| 99 | *
|
---|
| 100 | * @param string $name Required. The name of the schema revision to be deleted,
|
---|
| 101 | * with a revision ID explicitly included. Example: `projects/123/schemas/my-
|
---|
| 102 | * schema@c7cfa2a8`
|
---|
| 103 | * @param array $optParams Optional parameters.
|
---|
| 104 | *
|
---|
| 105 | * @opt_param string revisionId Optional. This field is deprecated and should
|
---|
| 106 | * not be used for specifying the revision ID. The revision ID should be
|
---|
| 107 | * specified via the `name` parameter.
|
---|
| 108 | * @return Schema
|
---|
| 109 | * @throws \Google\Service\Exception
|
---|
| 110 | */
|
---|
| 111 | public function deleteRevision($name, $optParams = [])
|
---|
| 112 | {
|
---|
| 113 | $params = ['name' => $name];
|
---|
| 114 | $params = array_merge($params, $optParams);
|
---|
| 115 | return $this->call('deleteRevision', [$params], Schema::class);
|
---|
| 116 | }
|
---|
| 117 | /**
|
---|
| 118 | * Gets a schema. (schemas.get)
|
---|
| 119 | *
|
---|
| 120 | * @param string $name Required. The name of the schema to get. Format is
|
---|
| 121 | * `projects/{project}/schemas/{schema}`.
|
---|
| 122 | * @param array $optParams Optional parameters.
|
---|
| 123 | *
|
---|
| 124 | * @opt_param string view The set of fields to return in the response. If not
|
---|
| 125 | * set, returns a Schema with all fields filled out. Set to `BASIC` to omit the
|
---|
| 126 | * `definition`.
|
---|
| 127 | * @return Schema
|
---|
| 128 | * @throws \Google\Service\Exception
|
---|
| 129 | */
|
---|
| 130 | public function get($name, $optParams = [])
|
---|
| 131 | {
|
---|
| 132 | $params = ['name' => $name];
|
---|
| 133 | $params = array_merge($params, $optParams);
|
---|
| 134 | return $this->call('get', [$params], Schema::class);
|
---|
| 135 | }
|
---|
| 136 | /**
|
---|
| 137 | * Gets the access control policy for a resource. Returns an empty policy if the
|
---|
| 138 | * resource exists and does not have a policy set. (schemas.getIamPolicy)
|
---|
| 139 | *
|
---|
| 140 | * @param string $resource REQUIRED: The resource for which the policy is being
|
---|
| 141 | * requested. See [Resource
|
---|
| 142 | * names](https://cloud.google.com/apis/design/resource_names) for the
|
---|
| 143 | * appropriate value for this field.
|
---|
| 144 | * @param array $optParams Optional parameters.
|
---|
| 145 | *
|
---|
| 146 | * @opt_param int options.requestedPolicyVersion Optional. The maximum policy
|
---|
| 147 | * version that will be used to format the policy. Valid values are 0, 1, and 3.
|
---|
| 148 | * Requests specifying an invalid value will be rejected. Requests for policies
|
---|
| 149 | * with any conditional role bindings must specify version 3. Policies with no
|
---|
| 150 | * conditional role bindings may specify any valid value or leave the field
|
---|
| 151 | * unset. The policy in the response might use the policy version that you
|
---|
| 152 | * specified, or it might use a lower policy version. For example, if you
|
---|
| 153 | * specify version 3, but the policy has no conditional role bindings, the
|
---|
| 154 | * response uses version 1. To learn which resources support conditions in their
|
---|
| 155 | * IAM policies, see the [IAM
|
---|
| 156 | * documentation](https://cloud.google.com/iam/help/conditions/resource-
|
---|
| 157 | * policies).
|
---|
| 158 | * @return Policy
|
---|
| 159 | * @throws \Google\Service\Exception
|
---|
| 160 | */
|
---|
| 161 | public function getIamPolicy($resource, $optParams = [])
|
---|
| 162 | {
|
---|
| 163 | $params = ['resource' => $resource];
|
---|
| 164 | $params = array_merge($params, $optParams);
|
---|
| 165 | return $this->call('getIamPolicy', [$params], Policy::class);
|
---|
| 166 | }
|
---|
| 167 | /**
|
---|
| 168 | * Lists schemas in a project. (schemas.listProjectsSchemas)
|
---|
| 169 | *
|
---|
| 170 | * @param string $parent Required. The name of the project in which to list
|
---|
| 171 | * schemas. Format is `projects/{project-id}`.
|
---|
| 172 | * @param array $optParams Optional parameters.
|
---|
| 173 | *
|
---|
| 174 | * @opt_param int pageSize Maximum number of schemas to return.
|
---|
| 175 | * @opt_param string pageToken The value returned by the last
|
---|
| 176 | * `ListSchemasResponse`; indicates that this is a continuation of a prior
|
---|
| 177 | * `ListSchemas` call, and that the system should return the next page of data.
|
---|
| 178 | * @opt_param string view The set of Schema fields to return in the response. If
|
---|
| 179 | * not set, returns Schemas with `name` and `type`, but not `definition`. Set to
|
---|
| 180 | * `FULL` to retrieve all fields.
|
---|
| 181 | * @return ListSchemasResponse
|
---|
| 182 | * @throws \Google\Service\Exception
|
---|
| 183 | */
|
---|
| 184 | public function listProjectsSchemas($parent, $optParams = [])
|
---|
| 185 | {
|
---|
| 186 | $params = ['parent' => $parent];
|
---|
| 187 | $params = array_merge($params, $optParams);
|
---|
| 188 | return $this->call('list', [$params], ListSchemasResponse::class);
|
---|
| 189 | }
|
---|
| 190 | /**
|
---|
| 191 | * Lists all schema revisions for the named schema. (schemas.listRevisions)
|
---|
| 192 | *
|
---|
| 193 | * @param string $name Required. The name of the schema to list revisions for.
|
---|
| 194 | * @param array $optParams Optional parameters.
|
---|
| 195 | *
|
---|
| 196 | * @opt_param int pageSize The maximum number of revisions to return per page.
|
---|
| 197 | * @opt_param string pageToken The page token, received from a previous
|
---|
| 198 | * ListSchemaRevisions call. Provide this to retrieve the subsequent page.
|
---|
| 199 | * @opt_param string view The set of Schema fields to return in the response. If
|
---|
| 200 | * not set, returns Schemas with `name` and `type`, but not `definition`. Set to
|
---|
| 201 | * `FULL` to retrieve all fields.
|
---|
| 202 | * @return ListSchemaRevisionsResponse
|
---|
| 203 | * @throws \Google\Service\Exception
|
---|
| 204 | */
|
---|
| 205 | public function listRevisions($name, $optParams = [])
|
---|
| 206 | {
|
---|
| 207 | $params = ['name' => $name];
|
---|
| 208 | $params = array_merge($params, $optParams);
|
---|
| 209 | return $this->call('listRevisions', [$params], ListSchemaRevisionsResponse::class);
|
---|
| 210 | }
|
---|
| 211 | /**
|
---|
| 212 | * Creates a new schema revision that is a copy of the provided revision_id.
|
---|
| 213 | * (schemas.rollback)
|
---|
| 214 | *
|
---|
| 215 | * @param string $name Required. The schema being rolled back with revision id.
|
---|
| 216 | * @param RollbackSchemaRequest $postBody
|
---|
| 217 | * @param array $optParams Optional parameters.
|
---|
| 218 | * @return Schema
|
---|
| 219 | * @throws \Google\Service\Exception
|
---|
| 220 | */
|
---|
| 221 | public function rollback($name, RollbackSchemaRequest $postBody, $optParams = [])
|
---|
| 222 | {
|
---|
| 223 | $params = ['name' => $name, 'postBody' => $postBody];
|
---|
| 224 | $params = array_merge($params, $optParams);
|
---|
| 225 | return $this->call('rollback', [$params], Schema::class);
|
---|
| 226 | }
|
---|
| 227 | /**
|
---|
| 228 | * Sets the access control policy on the specified resource. Replaces any
|
---|
| 229 | * existing policy. Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and
|
---|
| 230 | * `PERMISSION_DENIED` errors. (schemas.setIamPolicy)
|
---|
| 231 | *
|
---|
| 232 | * @param string $resource REQUIRED: The resource for which the policy is being
|
---|
| 233 | * specified. See [Resource
|
---|
| 234 | * names](https://cloud.google.com/apis/design/resource_names) for the
|
---|
| 235 | * appropriate value for this field.
|
---|
| 236 | * @param SetIamPolicyRequest $postBody
|
---|
| 237 | * @param array $optParams Optional parameters.
|
---|
| 238 | * @return Policy
|
---|
| 239 | * @throws \Google\Service\Exception
|
---|
| 240 | */
|
---|
| 241 | public function setIamPolicy($resource, SetIamPolicyRequest $postBody, $optParams = [])
|
---|
| 242 | {
|
---|
| 243 | $params = ['resource' => $resource, 'postBody' => $postBody];
|
---|
| 244 | $params = array_merge($params, $optParams);
|
---|
| 245 | return $this->call('setIamPolicy', [$params], Policy::class);
|
---|
| 246 | }
|
---|
| 247 | /**
|
---|
| 248 | * Returns permissions that a caller has on the specified resource. If the
|
---|
| 249 | * resource does not exist, this will return an empty set of permissions, not a
|
---|
| 250 | * `NOT_FOUND` error. Note: This operation is designed to be used for building
|
---|
| 251 | * permission-aware UIs and command-line tools, not for authorization checking.
|
---|
| 252 | * This operation may "fail open" without warning. (schemas.testIamPermissions)
|
---|
| 253 | *
|
---|
| 254 | * @param string $resource REQUIRED: The resource for which the policy detail is
|
---|
| 255 | * being requested. See [Resource
|
---|
| 256 | * names](https://cloud.google.com/apis/design/resource_names) for the
|
---|
| 257 | * appropriate value for this field.
|
---|
| 258 | * @param TestIamPermissionsRequest $postBody
|
---|
| 259 | * @param array $optParams Optional parameters.
|
---|
| 260 | * @return TestIamPermissionsResponse
|
---|
| 261 | * @throws \Google\Service\Exception
|
---|
| 262 | */
|
---|
| 263 | public function testIamPermissions($resource, TestIamPermissionsRequest $postBody, $optParams = [])
|
---|
| 264 | {
|
---|
| 265 | $params = ['resource' => $resource, 'postBody' => $postBody];
|
---|
| 266 | $params = array_merge($params, $optParams);
|
---|
| 267 | return $this->call('testIamPermissions', [$params], TestIamPermissionsResponse::class);
|
---|
| 268 | }
|
---|
| 269 | /**
|
---|
| 270 | * Validates a schema. (schemas.validate)
|
---|
| 271 | *
|
---|
| 272 | * @param string $parent Required. The name of the project in which to validate
|
---|
| 273 | * schemas. Format is `projects/{project-id}`.
|
---|
| 274 | * @param ValidateSchemaRequest $postBody
|
---|
| 275 | * @param array $optParams Optional parameters.
|
---|
| 276 | * @return ValidateSchemaResponse
|
---|
| 277 | * @throws \Google\Service\Exception
|
---|
| 278 | */
|
---|
| 279 | public function validate($parent, ValidateSchemaRequest $postBody, $optParams = [])
|
---|
| 280 | {
|
---|
| 281 | $params = ['parent' => $parent, 'postBody' => $postBody];
|
---|
| 282 | $params = array_merge($params, $optParams);
|
---|
| 283 | return $this->call('validate', [$params], ValidateSchemaResponse::class);
|
---|
| 284 | }
|
---|
| 285 | /**
|
---|
| 286 | * Validates a message against a schema. (schemas.validateMessage)
|
---|
| 287 | *
|
---|
| 288 | * @param string $parent Required. The name of the project in which to validate
|
---|
| 289 | * schemas. Format is `projects/{project-id}`.
|
---|
| 290 | * @param ValidateMessageRequest $postBody
|
---|
| 291 | * @param array $optParams Optional parameters.
|
---|
| 292 | * @return ValidateMessageResponse
|
---|
| 293 | * @throws \Google\Service\Exception
|
---|
| 294 | */
|
---|
| 295 | public function validateMessage($parent, ValidateMessageRequest $postBody, $optParams = [])
|
---|
| 296 | {
|
---|
| 297 | $params = ['parent' => $parent, 'postBody' => $postBody];
|
---|
| 298 | $params = array_merge($params, $optParams);
|
---|
| 299 | return $this->call('validateMessage', [$params], ValidateMessageResponse::class);
|
---|
| 300 | }
|
---|
| 301 | }
|
---|
| 302 |
|
---|
| 303 | // Adding a class alias for backwards compatibility with the previous class name.
|
---|
| 304 | class_alias(ProjectsSchemas::class, 'Google_Service_Pubsub_Resource_ProjectsSchemas');
|
---|