Coverage for /pythoncovmergedfiles/medio/medio/usr/local/lib/python3.8/site-packages/google/pubsub_v1/types/schema.py: 97%
74 statements
« prev ^ index » next coverage.py v7.2.2, created at 2023-03-26 06:25 +0000
« prev ^ index » next coverage.py v7.2.2, created at 2023-03-26 06:25 +0000
1# -*- coding: utf-8 -*-
2# Copyright 2022 Google LLC
3#
4# Licensed under the Apache License, Version 2.0 (the "License");
5# you may not use this file except in compliance with the License.
6# You may obtain a copy of the License at
7#
8# http://www.apache.org/licenses/LICENSE-2.0
9#
10# Unless required by applicable law or agreed to in writing, software
11# distributed under the License is distributed on an "AS IS" BASIS,
12# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13# See the License for the specific language governing permissions and
14# limitations under the License.
15#
16from typing import MutableMapping, MutableSequence
18import proto # type: ignore
20from google.protobuf import timestamp_pb2 # type: ignore
23__protobuf__ = proto.module(
24 package="google.pubsub.v1",
25 manifest={
26 "SchemaView",
27 "Encoding",
28 "Schema",
29 "CreateSchemaRequest",
30 "GetSchemaRequest",
31 "ListSchemasRequest",
32 "ListSchemasResponse",
33 "ListSchemaRevisionsRequest",
34 "ListSchemaRevisionsResponse",
35 "CommitSchemaRequest",
36 "RollbackSchemaRequest",
37 "DeleteSchemaRevisionRequest",
38 "DeleteSchemaRequest",
39 "ValidateSchemaRequest",
40 "ValidateSchemaResponse",
41 "ValidateMessageRequest",
42 "ValidateMessageResponse",
43 },
44)
47class SchemaView(proto.Enum):
48 r"""View of Schema object fields to be returned by GetSchema and
49 ListSchemas.
51 Values:
52 SCHEMA_VIEW_UNSPECIFIED (0):
53 The default / unset value.
54 The API will default to the BASIC view.
55 BASIC (1):
56 Include the name and type of the schema, but
57 not the definition.
58 FULL (2):
59 Include all Schema object fields.
60 """
61 SCHEMA_VIEW_UNSPECIFIED = 0
62 BASIC = 1
63 FULL = 2
66class Encoding(proto.Enum):
67 r"""Possible encoding types for messages.
69 Values:
70 ENCODING_UNSPECIFIED (0):
71 Unspecified
72 JSON (1):
73 JSON encoding
74 BINARY (2):
75 Binary encoding, as defined by the schema
76 type. For some schema types, binary encoding may
77 not be available.
78 """
79 ENCODING_UNSPECIFIED = 0
80 JSON = 1
81 BINARY = 2
84class Schema(proto.Message):
85 r"""A schema resource.
87 Attributes:
88 name (str):
89 Required. Name of the schema. Format is
90 ``projects/{project}/schemas/{schema}``.
91 type_ (google.pubsub_v1.types.Schema.Type):
92 The type of the schema definition.
93 definition (str):
94 The definition of the schema. This should contain a string
95 representing the full definition of the schema that is a
96 valid schema definition of the type specified in ``type``.
97 revision_id (str):
98 Output only. Immutable. The revision ID of
99 the schema.
100 revision_create_time (google.protobuf.timestamp_pb2.Timestamp):
101 Output only. The timestamp that the revision
102 was created.
103 """
105 class Type(proto.Enum):
106 r"""Possible schema definition types.
108 Values:
109 TYPE_UNSPECIFIED (0):
110 Default value. This value is unused.
111 PROTOCOL_BUFFER (1):
112 A Protocol Buffer schema definition.
113 AVRO (2):
114 An Avro schema definition.
115 """
116 TYPE_UNSPECIFIED = 0
117 PROTOCOL_BUFFER = 1
118 AVRO = 2
120 name: str = proto.Field(
121 proto.STRING,
122 number=1,
123 )
124 type_: Type = proto.Field(
125 proto.ENUM,
126 number=2,
127 enum=Type,
128 )
129 definition: str = proto.Field(
130 proto.STRING,
131 number=3,
132 )
133 revision_id: str = proto.Field(
134 proto.STRING,
135 number=4,
136 )
137 revision_create_time: timestamp_pb2.Timestamp = proto.Field(
138 proto.MESSAGE,
139 number=6,
140 message=timestamp_pb2.Timestamp,
141 )
144class CreateSchemaRequest(proto.Message):
145 r"""Request for the CreateSchema method.
147 Attributes:
148 parent (str):
149 Required. The name of the project in which to create the
150 schema. Format is ``projects/{project-id}``.
151 schema (google.pubsub_v1.types.Schema):
152 Required. The schema object to create.
154 This schema's ``name`` parameter is ignored. The schema
155 object returned by CreateSchema will have a ``name`` made
156 using the given ``parent`` and ``schema_id``.
157 schema_id (str):
158 The ID to use for the schema, which will become the final
159 component of the schema's resource name.
161 See
162 https://cloud.google.com/pubsub/docs/admin#resource_names
163 for resource name constraints.
164 """
166 parent: str = proto.Field(
167 proto.STRING,
168 number=1,
169 )
170 schema: "Schema" = proto.Field(
171 proto.MESSAGE,
172 number=2,
173 message="Schema",
174 )
175 schema_id: str = proto.Field(
176 proto.STRING,
177 number=3,
178 )
181class GetSchemaRequest(proto.Message):
182 r"""Request for the GetSchema method.
184 Attributes:
185 name (str):
186 Required. The name of the schema to get. Format is
187 ``projects/{project}/schemas/{schema}``.
188 view (google.pubsub_v1.types.SchemaView):
189 The set of fields to return in the response. If not set,
190 returns a Schema with all fields filled out. Set to
191 ``BASIC`` to omit the ``definition``.
192 """
194 name: str = proto.Field(
195 proto.STRING,
196 number=1,
197 )
198 view: "SchemaView" = proto.Field(
199 proto.ENUM,
200 number=2,
201 enum="SchemaView",
202 )
205class ListSchemasRequest(proto.Message):
206 r"""Request for the ``ListSchemas`` method.
208 Attributes:
209 parent (str):
210 Required. The name of the project in which to list schemas.
211 Format is ``projects/{project-id}``.
212 view (google.pubsub_v1.types.SchemaView):
213 The set of Schema fields to return in the response. If not
214 set, returns Schemas with ``name`` and ``type``, but not
215 ``definition``. Set to ``FULL`` to retrieve all fields.
216 page_size (int):
217 Maximum number of schemas to return.
218 page_token (str):
219 The value returned by the last ``ListSchemasResponse``;
220 indicates that this is a continuation of a prior
221 ``ListSchemas`` call, and that the system should return the
222 next page of data.
223 """
225 parent: str = proto.Field(
226 proto.STRING,
227 number=1,
228 )
229 view: "SchemaView" = proto.Field(
230 proto.ENUM,
231 number=2,
232 enum="SchemaView",
233 )
234 page_size: int = proto.Field(
235 proto.INT32,
236 number=3,
237 )
238 page_token: str = proto.Field(
239 proto.STRING,
240 number=4,
241 )
244class ListSchemasResponse(proto.Message):
245 r"""Response for the ``ListSchemas`` method.
247 Attributes:
248 schemas (MutableSequence[google.pubsub_v1.types.Schema]):
249 The resulting schemas.
250 next_page_token (str):
251 If not empty, indicates that there may be more schemas that
252 match the request; this value should be passed in a new
253 ``ListSchemasRequest``.
254 """
256 @property
257 def raw_page(self):
258 return self
260 schemas: MutableSequence["Schema"] = proto.RepeatedField(
261 proto.MESSAGE,
262 number=1,
263 message="Schema",
264 )
265 next_page_token: str = proto.Field(
266 proto.STRING,
267 number=2,
268 )
271class ListSchemaRevisionsRequest(proto.Message):
272 r"""Request for the ``ListSchemaRevisions`` method.
274 Attributes:
275 name (str):
276 Required. The name of the schema to list
277 revisions for.
278 view (google.pubsub_v1.types.SchemaView):
279 The set of Schema fields to return in the response. If not
280 set, returns Schemas with ``name`` and ``type``, but not
281 ``definition``. Set to ``FULL`` to retrieve all fields.
282 page_size (int):
283 The maximum number of revisions to return per
284 page.
285 page_token (str):
286 The page token, received from a previous
287 ListSchemaRevisions call. Provide this to
288 retrieve the subsequent page.
289 """
291 name: str = proto.Field(
292 proto.STRING,
293 number=1,
294 )
295 view: "SchemaView" = proto.Field(
296 proto.ENUM,
297 number=2,
298 enum="SchemaView",
299 )
300 page_size: int = proto.Field(
301 proto.INT32,
302 number=3,
303 )
304 page_token: str = proto.Field(
305 proto.STRING,
306 number=4,
307 )
310class ListSchemaRevisionsResponse(proto.Message):
311 r"""Response for the ``ListSchemaRevisions`` method.
313 Attributes:
314 schemas (MutableSequence[google.pubsub_v1.types.Schema]):
315 The revisions of the schema.
316 next_page_token (str):
317 A token that can be sent as ``page_token`` to retrieve the
318 next page. If this field is empty, there are no subsequent
319 pages.
320 """
322 @property
323 def raw_page(self):
324 return self
326 schemas: MutableSequence["Schema"] = proto.RepeatedField(
327 proto.MESSAGE,
328 number=1,
329 message="Schema",
330 )
331 next_page_token: str = proto.Field(
332 proto.STRING,
333 number=2,
334 )
337class CommitSchemaRequest(proto.Message):
338 r"""Request for CommitSchema method.
340 Attributes:
341 name (str):
342 Required. The name of the schema we are revising. Format is
343 ``projects/{project}/schemas/{schema}``.
344 schema (google.pubsub_v1.types.Schema):
345 Required. The schema revision to commit.
346 """
348 name: str = proto.Field(
349 proto.STRING,
350 number=1,
351 )
352 schema: "Schema" = proto.Field(
353 proto.MESSAGE,
354 number=2,
355 message="Schema",
356 )
359class RollbackSchemaRequest(proto.Message):
360 r"""Request for the ``RollbackSchema`` method.
362 Attributes:
363 name (str):
364 Required. The schema being rolled back with
365 revision id.
366 revision_id (str):
367 Required. The revision ID to roll back to.
368 It must be a revision of the same schema.
370 Example: c7cfa2a8
371 """
373 name: str = proto.Field(
374 proto.STRING,
375 number=1,
376 )
377 revision_id: str = proto.Field(
378 proto.STRING,
379 number=2,
380 )
383class DeleteSchemaRevisionRequest(proto.Message):
384 r"""Request for the ``DeleteSchemaRevision`` method.
386 Attributes:
387 name (str):
388 Required. The name of the schema revision to be deleted,
389 with a revision ID explicitly included.
391 Example: ``projects/123/schemas/my-schema@c7cfa2a8``
392 revision_id (str):
393 Optional. This field is deprecated and should not be used
394 for specifying the revision ID. The revision ID should be
395 specified via the ``name`` parameter.
396 """
398 name: str = proto.Field(
399 proto.STRING,
400 number=1,
401 )
402 revision_id: str = proto.Field(
403 proto.STRING,
404 number=2,
405 )
408class DeleteSchemaRequest(proto.Message):
409 r"""Request for the ``DeleteSchema`` method.
411 Attributes:
412 name (str):
413 Required. Name of the schema to delete. Format is
414 ``projects/{project}/schemas/{schema}``.
415 """
417 name: str = proto.Field(
418 proto.STRING,
419 number=1,
420 )
423class ValidateSchemaRequest(proto.Message):
424 r"""Request for the ``ValidateSchema`` method.
426 Attributes:
427 parent (str):
428 Required. The name of the project in which to validate
429 schemas. Format is ``projects/{project-id}``.
430 schema (google.pubsub_v1.types.Schema):
431 Required. The schema object to validate.
432 """
434 parent: str = proto.Field(
435 proto.STRING,
436 number=1,
437 )
438 schema: "Schema" = proto.Field(
439 proto.MESSAGE,
440 number=2,
441 message="Schema",
442 )
445class ValidateSchemaResponse(proto.Message):
446 r"""Response for the ``ValidateSchema`` method. Empty for now."""
449class ValidateMessageRequest(proto.Message):
450 r"""Request for the ``ValidateMessage`` method.
452 This message has `oneof`_ fields (mutually exclusive fields).
453 For each oneof, at most one member field can be set at the same time.
454 Setting any member of the oneof automatically clears all other
455 members.
457 .. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields
459 Attributes:
460 parent (str):
461 Required. The name of the project in which to validate
462 schemas. Format is ``projects/{project-id}``.
463 name (str):
464 Name of the schema against which to validate.
466 Format is ``projects/{project}/schemas/{schema}``.
468 This field is a member of `oneof`_ ``schema_spec``.
469 schema (google.pubsub_v1.types.Schema):
470 Ad-hoc schema against which to validate
472 This field is a member of `oneof`_ ``schema_spec``.
473 message (bytes):
474 Message to validate against the provided ``schema_spec``.
475 encoding (google.pubsub_v1.types.Encoding):
476 The encoding expected for messages
477 """
479 parent: str = proto.Field(
480 proto.STRING,
481 number=1,
482 )
483 name: str = proto.Field(
484 proto.STRING,
485 number=2,
486 oneof="schema_spec",
487 )
488 schema: "Schema" = proto.Field(
489 proto.MESSAGE,
490 number=3,
491 oneof="schema_spec",
492 message="Schema",
493 )
494 message: bytes = proto.Field(
495 proto.BYTES,
496 number=4,
497 )
498 encoding: "Encoding" = proto.Field(
499 proto.ENUM,
500 number=5,
501 enum="Encoding",
502 )
505class ValidateMessageResponse(proto.Message):
506 r"""Response for the ``ValidateMessage`` method. Empty for now."""
509__all__ = tuple(sorted(__protobuf__.manifest))