Skip to content
This repository was archived by the owner on Jul 6, 2023. It is now read-only.

Commit ef5bc1b

Browse files
docs: Add documentation for enums (#188)
* docs: Add documentation for enums fix: Add context manager return types chore: Update gapic-generator-python to v1.8.1 PiperOrigin-RevId: 503210727 Source-Link: googleapis/googleapis@a391fd1 Source-Link: https://github.com/googleapis/googleapis-gen/commit/0080f830dec37c3384157082bce279e37079ea58 Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiMDA4MGY4MzBkZWMzN2MzMzg0MTU3MDgyYmNlMjc5ZTM3MDc5ZWE1OCJ9 * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
1 parent 8f98e77 commit ef5bc1b

File tree

9 files changed

+163
-7
lines changed

9 files changed

+163
-7
lines changed

google/cloud/servicecontrol_v1/services/quota_controller/client.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -515,7 +515,7 @@ def sample_allocate_quota():
515515
# Done; return the response.
516516
return response
517517

518-
def __enter__(self):
518+
def __enter__(self) -> "QuotaControllerClient":
519519
return self
520520

521521
def __exit__(self, type, value, traceback):

google/cloud/servicecontrol_v1/services/service_controller/client.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -621,7 +621,7 @@ def sample_report():
621621
# Done; return the response.
622622
return response
623623

624-
def __enter__(self):
624+
def __enter__(self) -> "ServiceControllerClient":
625625
return self
626626

627627
def __exit__(self, type, value, traceback):

google/cloud/servicecontrol_v1/types/check_error.py

Lines changed: 66 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,72 @@ class CheckError(proto.Message):
5050
"""
5151

5252
class Code(proto.Enum):
53-
r"""Error codes for Check responses."""
53+
r"""Error codes for Check responses.
54+
55+
Values:
56+
ERROR_CODE_UNSPECIFIED (0):
57+
This is never used in ``CheckResponse``.
58+
NOT_FOUND (5):
59+
The consumer's project id, network container, or resource
60+
container was not found. Same as
61+
[google.rpc.Code.NOT_FOUND][google.rpc.Code.NOT_FOUND].
62+
PERMISSION_DENIED (7):
63+
The consumer doesn't have access to the specified resource.
64+
Same as
65+
[google.rpc.Code.PERMISSION_DENIED][google.rpc.Code.PERMISSION_DENIED].
66+
RESOURCE_EXHAUSTED (8):
67+
Quota check failed. Same as
68+
[google.rpc.Code.RESOURCE_EXHAUSTED][google.rpc.Code.RESOURCE_EXHAUSTED].
69+
SERVICE_NOT_ACTIVATED (104):
70+
The consumer hasn't activated the service.
71+
BILLING_DISABLED (107):
72+
The consumer cannot access the service
73+
because billing is disabled.
74+
PROJECT_DELETED (108):
75+
The consumer's project has been marked as
76+
deleted (soft deletion).
77+
PROJECT_INVALID (114):
78+
The consumer's project number or id does not
79+
represent a valid project.
80+
CONSUMER_INVALID (125):
81+
The input consumer info does not represent a
82+
valid consumer folder or organization.
83+
IP_ADDRESS_BLOCKED (109):
84+
The IP address of the consumer is invalid for
85+
the specific consumer project.
86+
REFERER_BLOCKED (110):
87+
The referer address of the consumer request
88+
is invalid for the specific consumer project.
89+
CLIENT_APP_BLOCKED (111):
90+
The client application of the consumer
91+
request is invalid for the specific consumer
92+
project.
93+
API_TARGET_BLOCKED (122):
94+
The API targeted by this request is invalid
95+
for the specified consumer project.
96+
API_KEY_INVALID (105):
97+
The consumer's API key is invalid.
98+
API_KEY_EXPIRED (112):
99+
The consumer's API Key has expired.
100+
API_KEY_NOT_FOUND (113):
101+
The consumer's API Key was not found in
102+
config record.
103+
INVALID_CREDENTIAL (123):
104+
The credential in the request can not be
105+
verified.
106+
NAMESPACE_LOOKUP_UNAVAILABLE (300):
107+
The backend server for looking up project
108+
id/number is unavailable.
109+
SERVICE_STATUS_UNAVAILABLE (301):
110+
The backend server for checking service
111+
status is unavailable.
112+
BILLING_STATUS_UNAVAILABLE (302):
113+
The backend server for checking billing
114+
status is unavailable.
115+
CLOUD_RESOURCE_MANAGER_BACKEND_UNAVAILABLE (305):
116+
Cloud Resource Manager backend server is
117+
unavailable.
118+
"""
54119
ERROR_CODE_UNSPECIFIED = 0
55120
NOT_FOUND = 5
56121
PERMISSION_DENIED = 7

google/cloud/servicecontrol_v1/types/operation.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,17 @@ class Operation(proto.Message):
116116
class Importance(proto.Enum):
117117
r"""Defines the importance of the data contained in the
118118
operation.
119+
120+
Values:
121+
LOW (0):
122+
Allows data caching, batching, and
123+
aggregation. It provides higher performance with
124+
higher data loss risk.
125+
HIGH (1):
126+
Disables data aggregation to minimize data
127+
loss. It is for operations that contains
128+
significant monetary value or audit trail. This
129+
feature only applies to the client libraries.
119130
"""
120131
LOW = 0
121132
HIGH = 1

google/cloud/servicecontrol_v1/types/quota_controller.py

Lines changed: 65 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,54 @@ class QuotaOperation(proto.Message):
121121
"""
122122

123123
class QuotaMode(proto.Enum):
124-
r"""Supported quota modes."""
124+
r"""Supported quota modes.
125+
126+
Values:
127+
UNSPECIFIED (0):
128+
Guard against implicit default. Must not be
129+
used.
130+
NORMAL (1):
131+
For AllocateQuota request, allocates quota
132+
for the amount specified in the service
133+
configuration or specified using the quota
134+
metrics. If the amount is higher than the
135+
available quota, allocation error will be
136+
returned and no quota will be allocated.
137+
If multiple quotas are part of the request, and
138+
one fails, none of the quotas are allocated or
139+
released.
140+
BEST_EFFORT (2):
141+
The operation allocates quota for the amount specified in
142+
the service configuration or specified using the quota
143+
metrics. If the amount is higher than the available quota,
144+
request does not fail but all available quota will be
145+
allocated. For rate quota, BEST_EFFORT will continue to
146+
deduct from other groups even if one does not have enough
147+
quota. For allocation, it will find the minimum available
148+
amount across all groups and deduct that amount from all the
149+
affected groups.
150+
CHECK_ONLY (3):
151+
For AllocateQuota request, only checks if
152+
there is enough quota available and does not
153+
change the available quota. No lock is placed on
154+
the available quota either.
155+
QUERY_ONLY (4):
156+
Unimplemented. When used in
157+
AllocateQuotaRequest, this returns the effective
158+
quota limit(s) in the response, and no quota
159+
check will be performed. Not supported for other
160+
requests, and even for AllocateQuotaRequest,
161+
this is currently supported only for allowlisted
162+
services.
163+
ADJUST_ONLY (5):
164+
The operation allocates quota for the amount
165+
specified in the service configuration or
166+
specified using the quota metrics. If the
167+
requested amount is higher than the available
168+
quota, request does not fail and remaining quota
169+
would become negative (going over the limit).
170+
Not supported for Rate Quota.
171+
"""
125172
UNSPECIFIED = 0
126173
NORMAL = 1
127174
BEST_EFFORT = 2
@@ -232,6 +279,23 @@ class Code(proto.Enum):
232279
quota_properties field, to perform these validations before calling
233280
the quota controller methods. These methods check only for project
234281
deletion to be wipe out compliant.
282+
283+
Values:
284+
UNSPECIFIED (0):
285+
This is never used.
286+
RESOURCE_EXHAUSTED (8):
287+
Quota allocation failed. Same as
288+
[google.rpc.Code.RESOURCE_EXHAUSTED][google.rpc.Code.RESOURCE_EXHAUSTED].
289+
BILLING_NOT_ACTIVE (107):
290+
Consumer cannot access the service because
291+
the service requires active billing.
292+
PROJECT_DELETED (108):
293+
Consumer's project has been marked as deleted
294+
(soft deletion).
295+
API_KEY_INVALID (105):
296+
Specified API key is invalid.
297+
API_KEY_EXPIRED (112):
298+
Specified API Key has expired.
235299
"""
236300
UNSPECIFIED = 0
237301
RESOURCE_EXHAUSTED = 8

google/cloud/servicecontrol_v1/types/service_controller.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,22 @@ class ConsumerInfo(proto.Message):
141141
class ConsumerType(proto.Enum):
142142
r"""The type of the consumer as defined in `Google Resource
143143
Manager <https://cloud.google.com/resource-manager/>`__.
144+
145+
Values:
146+
CONSUMER_TYPE_UNSPECIFIED (0):
147+
This is never used.
148+
PROJECT (1):
149+
The consumer is a Google Cloud Project.
150+
FOLDER (2):
151+
The consumer is a Google Cloud Folder.
152+
ORGANIZATION (3):
153+
The consumer is a Google Cloud Organization.
154+
SERVICE_SPECIFIC (4):
155+
Service-specific resource container which is
156+
defined by the service producer to offer their
157+
users the ability to manage service control
158+
functionalities at a finer level of granularity
159+
than the PROJECT.
144160
"""
145161
CONSUMER_TYPE_UNSPECIFIED = 0
146162
PROJECT = 1

google/cloud/servicecontrol_v2/services/service_controller/client.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -636,7 +636,7 @@ def sample_report():
636636
# Done; return the response.
637637
return response
638638

639-
def __enter__(self):
639+
def __enter__(self) -> "ServiceControllerClient":
640640
return self
641641

642642
def __exit__(self, type, value, traceback):

samples/generated_samples/snippet_metadata_google.api.servicecontrol.v1.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
],
99
"language": "PYTHON",
1010
"name": "google-cloud-service-control",
11-
"version": "1.7.0"
11+
"version": "0.1.0"
1212
},
1313
"snippets": [
1414
{

samples/generated_samples/snippet_metadata_google.api.servicecontrol.v2.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
],
99
"language": "PYTHON",
1010
"name": "google-cloud-service-control",
11-
"version": "1.7.0"
11+
"version": "0.1.0"
1212
},
1313
"snippets": [
1414
{

0 commit comments

Comments
 (0)