Content-Length: 1136731 | pFad | http://github.com/googleapis/google-cloud-python/commit/1372d93a629360829a4d0e5fbb903364ee0a2d4e

79 Pick up changes to GAPIC generator, drop 'Code' enum. (#6509) · googleapis/google-cloud-python@1372d93 · GitHub
Skip to content

Commit 1372d93

Browse files
yoshi-automationtseaver
authored andcommitted
Pick up changes to GAPIC generator, drop 'Code' enum. (#6509)
1 parent ba620f7 commit 1372d93

File tree

8 files changed

+336
-370
lines changed

8 files changed

+336
-370
lines changed

packages/google-cloud-tasks/google/cloud/tasks_v2beta2/gapic/cloud_tasks_client.py

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ def __init__(self,
123123
transport=None,
124124
channel=None,
125125
credentials=None,
126-
client_config=cloud_tasks_client_config.config,
126+
client_config=None,
127127
client_info=None):
128128
"""Constructor.
129129
@@ -156,13 +156,20 @@ def __init__(self,
156156
your own client library.
157157
"""
158158
# Raise deprecation warnings for things we want to go away.
159-
if client_config:
160-
warnings.warn('The `client_config` argument is deprecated.',
161-
PendingDeprecationWarning)
159+
if client_config is not None:
160+
warnings.warn(
161+
'The `client_config` argument is deprecated.',
162+
PendingDeprecationWarning,
163+
stacklevel=2)
164+
else:
165+
client_config = cloud_tasks_client_config.config
166+
162167
if channel:
163168
warnings.warn(
164169
'The `channel` argument is deprecated; use '
165-
'`transport` instead.', PendingDeprecationWarning)
170+
'`transport` instead.',
171+
PendingDeprecationWarning,
172+
stacklevel=2)
166173

167174
# Instantiate the transport.
168175
# The transport is responsible for handling serialization and

packages/google-cloud-tasks/google/cloud/tasks_v2beta2/gapic/enums.py

Lines changed: 0 additions & 144 deletions
Original file line numberDiff line numberDiff line change
@@ -38,150 +38,6 @@ class HttpMethod(enum.IntEnum):
3838
DELETE = 5
3939

4040

41-
class Code(enum.IntEnum):
42-
"""
43-
The canonical error codes for Google APIs.
44-
45-
Sometimes multiple error codes may apply. Services should return the
46-
most specific error code that applies. For example, prefer
47-
``OUT_OF_RANGE`` over ``FAILED_PRECONDITION`` if both codes apply.
48-
Similarly prefer ``NOT_FOUND`` or ``ALREADY_EXISTS`` over
49-
``FAILED_PRECONDITION``.
50-
51-
Attributes:
52-
OK (int): Not an error; returned on success
53-
54-
HTTP Mapping: 200 OK
55-
CANCELLED (int): The operation was cancelled, typically by the caller.
56-
57-
HTTP Mapping: 499 Client Closed Request
58-
UNKNOWN (int): Unknown error. For example, this error may be returned when a ``Status``
59-
value received from another address space belongs to an error space that
60-
is not known in this address space. Also errors raised by APIs that do
61-
not return enough error information may be converted to this error.
62-
63-
HTTP Mapping: 500 Internal Server Error
64-
INVALID_ARGUMENT (int): The client specified an invalid argument. Note that this differs from
65-
``FAILED_PRECONDITION``. ``INVALID_ARGUMENT`` indicates arguments that
66-
are problematic regardless of the state of the system (e.g., a malformed
67-
file name).
68-
69-
HTTP Mapping: 400 Bad Request
70-
DEADLINE_EXCEEDED (int): The deadline expired before the operation could complete. For operations
71-
that change the state of the system, this error may be returned
72-
even if the operation has completed successfully. For example, a
73-
successful response from a server could have been delayed long
74-
enough for the deadline to expire.
75-
76-
HTTP Mapping: 504 Gateway Timeout
77-
NOT_FOUND (int): Some requested entity (e.g., file or directory) was not found.
78-
79-
Note to server developers: if a request is denied for an entire class of
80-
users, such as gradual feature rollout or undocumented whitelist,
81-
``NOT_FOUND`` may be used. If a request is denied for some users within
82-
a class of users, such as user-based access control,
83-
``PERMISSION_DENIED`` must be used.
84-
85-
HTTP Mapping: 404 Not Found
86-
ALREADY_EXISTS (int): The entity that a client attempted to create (e.g., file or directory)
87-
already exists.
88-
89-
HTTP Mapping: 409 Conflict
90-
PERMISSION_DENIED (int): The caller does not have permission to execute the specified operation.
91-
``PERMISSION_DENIED`` must not be used for rejections caused by
92-
exhausting some resource (use ``RESOURCE_EXHAUSTED`` instead for those
93-
errors). ``PERMISSION_DENIED`` must not be used if the caller can not be
94-
identified (use ``UNAUTHENTICATED`` instead for those errors). This
95-
error code does not imply the request is valid or the requested entity
96-
exists or satisfies other pre-conditions.
97-
98-
HTTP Mapping: 403 Forbidden
99-
UNAUTHENTICATED (int): The request does not have valid authentication credentials for the
100-
operation.
101-
102-
HTTP Mapping: 401 Unauthorized
103-
RESOURCE_EXHAUSTED (int): Some resource has been exhausted, perhaps a per-user quota, or
104-
perhaps the entire file system is out of space.
105-
106-
HTTP Mapping: 429 Too Many Requests
107-
FAILED_PRECONDITION (int): The operation was rejected because the system is not in a state required
108-
for the operation's execution. For example, the directory to be deleted
109-
is non-empty, an rmdir operation is applied to a non-directory, etc.
110-
111-
Service implementors can use the following guidelines to decide between
112-
``FAILED_PRECONDITION``, ``ABORTED``, and ``UNAVAILABLE``: (a) Use
113-
``UNAVAILABLE`` if the client can retry just the failing call. (b) Use
114-
``ABORTED`` if the client should retry at a higher level (e.g., when a
115-
client-specified test-and-set fails, indicating the client should
116-
restart a read-modify-write sequence). (c) Use ``FAILED_PRECONDITION``
117-
if the client should not retry until the system state has been
118-
explicitly fixed. E.g., if an "rmdir" fails because the directory is
119-
non-empty, ``FAILED_PRECONDITION`` should be returned since the client
120-
should not retry unless the files are deleted from the directory.
121-
122-
HTTP Mapping: 400 Bad Request
123-
ABORTED (int): The operation was aborted, typically due to a concurrency issue such as
124-
a sequencer check failure or transaction abort.
125-
126-
See the guidelines above for deciding between ``FAILED_PRECONDITION``,
127-
``ABORTED``, and ``UNAVAILABLE``.
128-
129-
HTTP Mapping: 409 Conflict
130-
OUT_OF_RANGE (int): The operation was attempted past the valid range. E.g., seeking or
131-
reading past end-of-file.
132-
133-
Unlike ``INVALID_ARGUMENT``, this error indicates a problem that may be
134-
fixed if the system state changes. For example, a 32-bit file system
135-
will generate ``INVALID_ARGUMENT`` if asked to read at an offset that is
136-
not in the range [0,2^32-1], but it will generate ``OUT_OF_RANGE`` if
137-
asked to read from an offset past the current file size.
138-
139-
There is a fair bit of overlap between ``FAILED_PRECONDITION`` and
140-
``OUT_OF_RANGE``. We recommend using ``OUT_OF_RANGE`` (the more specific
141-
error) when it applies so that callers who are iterating through a space
142-
can easily look for an ``OUT_OF_RANGE`` error to detect when they are
143-
done.
144-
145-
HTTP Mapping: 400 Bad Request
146-
UNIMPLEMENTED (int): The operation is not implemented or is not supported/enabled in this
147-
service.
148-
149-
HTTP Mapping: 501 Not Implemented
150-
INTERNAL (int): Internal errors. This means that some invariants expected by the
151-
underlying system have been broken. This error code is reserved
152-
for serious errors.
153-
154-
HTTP Mapping: 500 Internal Server Error
155-
UNAVAILABLE (int): The service is currently unavailable. This is most likely a transient
156-
condition, which can be corrected by retrying with a backoff.
157-
158-
See the guidelines above for deciding between ``FAILED_PRECONDITION``,
159-
``ABORTED``, and ``UNAVAILABLE``.
160-
161-
HTTP Mapping: 503 Service Unavailable
162-
DATA_LOSS (int): Unrecoverable data loss or corruption.
163-
164-
HTTP Mapping: 500 Internal Server Error
165-
"""
166-
OK = 0
167-
CANCELLED = 1
168-
UNKNOWN = 2
169-
INVALID_ARGUMENT = 3
170-
DEADLINE_EXCEEDED = 4
171-
NOT_FOUND = 5
172-
ALREADY_EXISTS = 6
173-
PERMISSION_DENIED = 7
174-
UNAUTHENTICATED = 16
175-
RESOURCE_EXHAUSTED = 8
176-
FAILED_PRECONDITION = 9
177-
ABORTED = 10
178-
OUT_OF_RANGE = 11
179-
UNIMPLEMENTED = 12
180-
INTERNAL = 13
181-
UNAVAILABLE = 14
182-
DATA_LOSS = 15
183-
184-
18541
class Queue(object):
18642
class State(enum.IntEnum):
18743
"""

packages/google-cloud-tasks/google/cloud/tasks_v2beta2/gapic/transports/cloud_tasks_grpc_transport.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,8 @@ def __init__(self,
6262
credentials=credentials,
6363
)
6464

65+
self._channel = channel
66+
6567
# gRPC uses objects called "stubs" that are bound to the
6668
# channel and provide a basic method for each RPC.
6769
self._stubs = {
@@ -91,6 +93,15 @@ def create_channel(cls,
9193
scopes=cls._OAUTH_SCOPES,
9294
)
9395

96+
@property
97+
def channel(self):
98+
"""The gRPC channel used by the transport.
99+
100+
Returns:
101+
grpc.Channel: A gRPC channel object.
102+
"""
103+
return self._channel
104+
94105
@property
95106
def list_queues(self):
96107
"""Return the gRPC stub for {$apiMethod.name}.

packages/google-cloud-tasks/google/cloud/tasks_v2beta3/gapic/cloud_tasks_client.py

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ def __init__(self,
121121
transport=None,
122122
channel=None,
123123
credentials=None,
124-
client_config=cloud_tasks_client_config.config,
124+
client_config=None,
125125
client_info=None):
126126
"""Constructor.
127127
@@ -154,13 +154,20 @@ def __init__(self,
154154
your own client library.
155155
"""
156156
# Raise deprecation warnings for things we want to go away.
157-
if client_config:
158-
warnings.warn('The `client_config` argument is deprecated.',
159-
PendingDeprecationWarning)
157+
if client_config is not None:
158+
warnings.warn(
159+
'The `client_config` argument is deprecated.',
160+
PendingDeprecationWarning,
161+
stacklevel=2)
162+
else:
163+
client_config = cloud_tasks_client_config.config
164+
160165
if channel:
161166
warnings.warn(
162167
'The `channel` argument is deprecated; use '
163-
'`transport` instead.', PendingDeprecationWarning)
168+
'`transport` instead.',
169+
PendingDeprecationWarning,
170+
stacklevel=2)
164171

165172
# Instantiate the transport.
166173
# The transport is responsible for handling serialization and

packages/google-cloud-tasks/google/cloud/tasks_v2beta3/gapic/enums.py

Lines changed: 0 additions & 144 deletions
Original file line numberDiff line numberDiff line change
@@ -38,150 +38,6 @@ class HttpMethod(enum.IntEnum):
3838
DELETE = 5
3939

4040

41-
class Code(enum.IntEnum):
42-
"""
43-
The canonical error codes for Google APIs.
44-
45-
Sometimes multiple error codes may apply. Services should return the
46-
most specific error code that applies. For example, prefer
47-
``OUT_OF_RANGE`` over ``FAILED_PRECONDITION`` if both codes apply.
48-
Similarly prefer ``NOT_FOUND`` or ``ALREADY_EXISTS`` over
49-
``FAILED_PRECONDITION``.
50-
51-
Attributes:
52-
OK (int): Not an error; returned on success
53-
54-
HTTP Mapping: 200 OK
55-
CANCELLED (int): The operation was cancelled, typically by the caller.
56-
57-
HTTP Mapping: 499 Client Closed Request
58-
UNKNOWN (int): Unknown error. For example, this error may be returned when a ``Status``
59-
value received from another address space belongs to an error space that
60-
is not known in this address space. Also errors raised by APIs that do
61-
not return enough error information may be converted to this error.
62-
63-
HTTP Mapping: 500 Internal Server Error
64-
INVALID_ARGUMENT (int): The client specified an invalid argument. Note that this differs from
65-
``FAILED_PRECONDITION``. ``INVALID_ARGUMENT`` indicates arguments that
66-
are problematic regardless of the state of the system (e.g., a malformed
67-
file name).
68-
69-
HTTP Mapping: 400 Bad Request
70-
DEADLINE_EXCEEDED (int): The deadline expired before the operation could complete. For operations
71-
that change the state of the system, this error may be returned
72-
even if the operation has completed successfully. For example, a
73-
successful response from a server could have been delayed long
74-
enough for the deadline to expire.
75-
76-
HTTP Mapping: 504 Gateway Timeout
77-
NOT_FOUND (int): Some requested entity (e.g., file or directory) was not found.
78-
79-
Note to server developers: if a request is denied for an entire class of
80-
users, such as gradual feature rollout or undocumented whitelist,
81-
``NOT_FOUND`` may be used. If a request is denied for some users within
82-
a class of users, such as user-based access control,
83-
``PERMISSION_DENIED`` must be used.
84-
85-
HTTP Mapping: 404 Not Found
86-
ALREADY_EXISTS (int): The entity that a client attempted to create (e.g., file or directory)
87-
already exists.
88-
89-
HTTP Mapping: 409 Conflict
90-
PERMISSION_DENIED (int): The caller does not have permission to execute the specified operation.
91-
``PERMISSION_DENIED`` must not be used for rejections caused by
92-
exhausting some resource (use ``RESOURCE_EXHAUSTED`` instead for those
93-
errors). ``PERMISSION_DENIED`` must not be used if the caller can not be
94-
identified (use ``UNAUTHENTICATED`` instead for those errors). This
95-
error code does not imply the request is valid or the requested entity
96-
exists or satisfies other pre-conditions.
97-
98-
HTTP Mapping: 403 Forbidden
99-
UNAUTHENTICATED (int): The request does not have valid authentication credentials for the
100-
operation.
101-
102-
HTTP Mapping: 401 Unauthorized
103-
RESOURCE_EXHAUSTED (int): Some resource has been exhausted, perhaps a per-user quota, or
104-
perhaps the entire file system is out of space.
105-
106-
HTTP Mapping: 429 Too Many Requests
107-
FAILED_PRECONDITION (int): The operation was rejected because the system is not in a state required
108-
for the operation's execution. For example, the directory to be deleted
109-
is non-empty, an rmdir operation is applied to a non-directory, etc.
110-
111-
Service implementors can use the following guidelines to decide between
112-
``FAILED_PRECONDITION``, ``ABORTED``, and ``UNAVAILABLE``: (a) Use
113-
``UNAVAILABLE`` if the client can retry just the failing call. (b) Use
114-
``ABORTED`` if the client should retry at a higher level (e.g., when a
115-
client-specified test-and-set fails, indicating the client should
116-
restart a read-modify-write sequence). (c) Use ``FAILED_PRECONDITION``
117-
if the client should not retry until the system state has been
118-
explicitly fixed. E.g., if an "rmdir" fails because the directory is
119-
non-empty, ``FAILED_PRECONDITION`` should be returned since the client
120-
should not retry unless the files are deleted from the directory.
121-
122-
HTTP Mapping: 400 Bad Request
123-
ABORTED (int): The operation was aborted, typically due to a concurrency issue such as
124-
a sequencer check failure or transaction abort.
125-
126-
See the guidelines above for deciding between ``FAILED_PRECONDITION``,
127-
``ABORTED``, and ``UNAVAILABLE``.
128-
129-
HTTP Mapping: 409 Conflict
130-
OUT_OF_RANGE (int): The operation was attempted past the valid range. E.g., seeking or
131-
reading past end-of-file.
132-
133-
Unlike ``INVALID_ARGUMENT``, this error indicates a problem that may be
134-
fixed if the system state changes. For example, a 32-bit file system
135-
will generate ``INVALID_ARGUMENT`` if asked to read at an offset that is
136-
not in the range [0,2^32-1], but it will generate ``OUT_OF_RANGE`` if
137-
asked to read from an offset past the current file size.
138-
139-
There is a fair bit of overlap between ``FAILED_PRECONDITION`` and
140-
``OUT_OF_RANGE``. We recommend using ``OUT_OF_RANGE`` (the more specific
141-
error) when it applies so that callers who are iterating through a space
142-
can easily look for an ``OUT_OF_RANGE`` error to detect when they are
143-
done.
144-
145-
HTTP Mapping: 400 Bad Request
146-
UNIMPLEMENTED (int): The operation is not implemented or is not supported/enabled in this
147-
service.
148-
149-
HTTP Mapping: 501 Not Implemented
150-
INTERNAL (int): Internal errors. This means that some invariants expected by the
151-
underlying system have been broken. This error code is reserved
152-
for serious errors.
153-
154-
HTTP Mapping: 500 Internal Server Error
155-
UNAVAILABLE (int): The service is currently unavailable. This is most likely a transient
156-
condition, which can be corrected by retrying with a backoff.
157-
158-
See the guidelines above for deciding between ``FAILED_PRECONDITION``,
159-
``ABORTED``, and ``UNAVAILABLE``.
160-
161-
HTTP Mapping: 503 Service Unavailable
162-
DATA_LOSS (int): Unrecoverable data loss or corruption.
163-
164-
HTTP Mapping: 500 Internal Server Error
165-
"""
166-
OK = 0
167-
CANCELLED = 1
168-
UNKNOWN = 2
169-
INVALID_ARGUMENT = 3
170-
DEADLINE_EXCEEDED = 4
171-
NOT_FOUND = 5
172-
ALREADY_EXISTS = 6
173-
PERMISSION_DENIED = 7
174-
UNAUTHENTICATED = 16
175-
RESOURCE_EXHAUSTED = 8
176-
FAILED_PRECONDITION = 9
177-
ABORTED = 10
178-
OUT_OF_RANGE = 11
179-
UNIMPLEMENTED = 12
180-
INTERNAL = 13
181-
UNAVAILABLE = 14
182-
DATA_LOSS = 15
183-
184-
18541
class Queue(object):
18642
class State(enum.IntEnum):
18743
"""

0 commit comments

Comments
 (0)








ApplySandwichStrip

pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

Fetched URL: http://github.com/googleapis/google-cloud-python/commit/1372d93a629360829a4d0e5fbb903364ee0a2d4e

Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy