diff --git a/.release-please-manifest.json b/.release-please-manifest.json index 64e0684..d0972da 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "1.7.0" + ".": "1.7.1" } diff --git a/CHANGELOG.md b/CHANGELOG.md index 07a0045..588a69d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,17 @@ # Changelog +## [1.7.1](https://github.com/googleapis/python-service-control/compare/v1.7.0...v1.7.1) (2023-01-20) + + +### Bug Fixes + +* Add context manager return types ([ef5bc1b](https://github.com/googleapis/python-service-control/commit/ef5bc1b64c42e344a9a25f85da655f5533dd0730)) + + +### Documentation + +* Add documentation for enums ([ef5bc1b](https://github.com/googleapis/python-service-control/commit/ef5bc1b64c42e344a9a25f85da655f5533dd0730)) + ## [1.7.0](https://github.com/googleapis/python-service-control/compare/v1.6.0...v1.7.0) (2023-01-10) diff --git a/google/cloud/servicecontrol/gapic_version.py b/google/cloud/servicecontrol/gapic_version.py index f033c61..84856f0 100644 --- a/google/cloud/servicecontrol/gapic_version.py +++ b/google/cloud/servicecontrol/gapic_version.py @@ -13,4 +13,4 @@ # See the License for the specific language governing permissions and # limitations under the License. # -__version__ = "1.7.0" # {x-release-please-version} +__version__ = "1.7.1" # {x-release-please-version} diff --git a/google/cloud/servicecontrol_v1/gapic_version.py b/google/cloud/servicecontrol_v1/gapic_version.py index f033c61..84856f0 100644 --- a/google/cloud/servicecontrol_v1/gapic_version.py +++ b/google/cloud/servicecontrol_v1/gapic_version.py @@ -13,4 +13,4 @@ # See the License for the specific language governing permissions and # limitations under the License. # -__version__ = "1.7.0" # {x-release-please-version} +__version__ = "1.7.1" # {x-release-please-version} diff --git a/google/cloud/servicecontrol_v1/services/quota_controller/client.py b/google/cloud/servicecontrol_v1/services/quota_controller/client.py index 1811095..207f293 100644 --- a/google/cloud/servicecontrol_v1/services/quota_controller/client.py +++ b/google/cloud/servicecontrol_v1/services/quota_controller/client.py @@ -515,7 +515,7 @@ def sample_allocate_quota(): # Done; return the response. return response - def __enter__(self): + def __enter__(self) -> "QuotaControllerClient": return self def __exit__(self, type, value, traceback): diff --git a/google/cloud/servicecontrol_v1/services/service_controller/client.py b/google/cloud/servicecontrol_v1/services/service_controller/client.py index 8b44582..c2c58bf 100644 --- a/google/cloud/servicecontrol_v1/services/service_controller/client.py +++ b/google/cloud/servicecontrol_v1/services/service_controller/client.py @@ -621,7 +621,7 @@ def sample_report(): # Done; return the response. return response - def __enter__(self): + def __enter__(self) -> "ServiceControllerClient": return self def __exit__(self, type, value, traceback): diff --git a/google/cloud/servicecontrol_v1/types/check_error.py b/google/cloud/servicecontrol_v1/types/check_error.py index b88ff16..1a11ba2 100644 --- a/google/cloud/servicecontrol_v1/types/check_error.py +++ b/google/cloud/servicecontrol_v1/types/check_error.py @@ -50,7 +50,72 @@ class CheckError(proto.Message): """ class Code(proto.Enum): - r"""Error codes for Check responses.""" + r"""Error codes for Check responses. + + Values: + ERROR_CODE_UNSPECIFIED (0): + This is never used in ``CheckResponse``. + NOT_FOUND (5): + The consumer's project id, network container, or resource + container was not found. Same as + [google.rpc.Code.NOT_FOUND][google.rpc.Code.NOT_FOUND]. + PERMISSION_DENIED (7): + The consumer doesn't have access to the specified resource. + Same as + [google.rpc.Code.PERMISSION_DENIED][google.rpc.Code.PERMISSION_DENIED]. + RESOURCE_EXHAUSTED (8): + Quota check failed. Same as + [google.rpc.Code.RESOURCE_EXHAUSTED][google.rpc.Code.RESOURCE_EXHAUSTED]. + SERVICE_NOT_ACTIVATED (104): + The consumer hasn't activated the service. + BILLING_DISABLED (107): + The consumer cannot access the service + because billing is disabled. + PROJECT_DELETED (108): + The consumer's project has been marked as + deleted (soft deletion). + PROJECT_INVALID (114): + The consumer's project number or id does not + represent a valid project. + CONSUMER_INVALID (125): + The input consumer info does not represent a + valid consumer folder or organization. + IP_ADDRESS_BLOCKED (109): + The IP address of the consumer is invalid for + the specific consumer project. + REFERER_BLOCKED (110): + The referer address of the consumer request + is invalid for the specific consumer project. + CLIENT_APP_BLOCKED (111): + The client application of the consumer + request is invalid for the specific consumer + project. + API_TARGET_BLOCKED (122): + The API targeted by this request is invalid + for the specified consumer project. + API_KEY_INVALID (105): + The consumer's API key is invalid. + API_KEY_EXPIRED (112): + The consumer's API Key has expired. + API_KEY_NOT_FOUND (113): + The consumer's API Key was not found in + config record. + INVALID_CREDENTIAL (123): + The credential in the request can not be + verified. + NAMESPACE_LOOKUP_UNAVAILABLE (300): + The backend server for looking up project + id/number is unavailable. + SERVICE_STATUS_UNAVAILABLE (301): + The backend server for checking service + status is unavailable. + BILLING_STATUS_UNAVAILABLE (302): + The backend server for checking billing + status is unavailable. + CLOUD_RESOURCE_MANAGER_BACKEND_UNAVAILABLE (305): + Cloud Resource Manager backend server is + unavailable. + """ ERROR_CODE_UNSPECIFIED = 0 NOT_FOUND = 5 PERMISSION_DENIED = 7 diff --git a/google/cloud/servicecontrol_v1/types/operation.py b/google/cloud/servicecontrol_v1/types/operation.py index ebb05d6..0243f1f 100644 --- a/google/cloud/servicecontrol_v1/types/operation.py +++ b/google/cloud/servicecontrol_v1/types/operation.py @@ -116,6 +116,17 @@ class Operation(proto.Message): class Importance(proto.Enum): r"""Defines the importance of the data contained in the operation. + + Values: + LOW (0): + Allows data caching, batching, and + aggregation. It provides higher performance with + higher data loss risk. + HIGH (1): + Disables data aggregation to minimize data + loss. It is for operations that contains + significant monetary value or audit trail. This + feature only applies to the client libraries. """ LOW = 0 HIGH = 1 diff --git a/google/cloud/servicecontrol_v1/types/quota_controller.py b/google/cloud/servicecontrol_v1/types/quota_controller.py index 2b68626..3b988ce 100644 --- a/google/cloud/servicecontrol_v1/types/quota_controller.py +++ b/google/cloud/servicecontrol_v1/types/quota_controller.py @@ -121,7 +121,54 @@ class QuotaOperation(proto.Message): """ class QuotaMode(proto.Enum): - r"""Supported quota modes.""" + r"""Supported quota modes. + + Values: + UNSPECIFIED (0): + Guard against implicit default. Must not be + used. + NORMAL (1): + For AllocateQuota request, allocates quota + for the amount specified in the service + configuration or specified using the quota + metrics. If the amount is higher than the + available quota, allocation error will be + returned and no quota will be allocated. + If multiple quotas are part of the request, and + one fails, none of the quotas are allocated or + released. + BEST_EFFORT (2): + The operation allocates quota for the amount specified in + the service configuration or specified using the quota + metrics. If the amount is higher than the available quota, + request does not fail but all available quota will be + allocated. For rate quota, BEST_EFFORT will continue to + deduct from other groups even if one does not have enough + quota. For allocation, it will find the minimum available + amount across all groups and deduct that amount from all the + affected groups. + CHECK_ONLY (3): + For AllocateQuota request, only checks if + there is enough quota available and does not + change the available quota. No lock is placed on + the available quota either. + QUERY_ONLY (4): + Unimplemented. When used in + AllocateQuotaRequest, this returns the effective + quota limit(s) in the response, and no quota + check will be performed. Not supported for other + requests, and even for AllocateQuotaRequest, + this is currently supported only for allowlisted + services. + ADJUST_ONLY (5): + The operation allocates quota for the amount + specified in the service configuration or + specified using the quota metrics. If the + requested amount is higher than the available + quota, request does not fail and remaining quota + would become negative (going over the limit). + Not supported for Rate Quota. + """ UNSPECIFIED = 0 NORMAL = 1 BEST_EFFORT = 2 @@ -232,6 +279,23 @@ class Code(proto.Enum): quota_properties field, to perform these validations before calling the quota controller methods. These methods check only for project deletion to be wipe out compliant. + + Values: + UNSPECIFIED (0): + This is never used. + RESOURCE_EXHAUSTED (8): + Quota allocation failed. Same as + [google.rpc.Code.RESOURCE_EXHAUSTED][google.rpc.Code.RESOURCE_EXHAUSTED]. + BILLING_NOT_ACTIVE (107): + Consumer cannot access the service because + the service requires active billing. + PROJECT_DELETED (108): + Consumer's project has been marked as deleted + (soft deletion). + API_KEY_INVALID (105): + Specified API key is invalid. + API_KEY_EXPIRED (112): + Specified API Key has expired. """ UNSPECIFIED = 0 RESOURCE_EXHAUSTED = 8 diff --git a/google/cloud/servicecontrol_v1/types/service_controller.py b/google/cloud/servicecontrol_v1/types/service_controller.py index 14f56dc..d132ef0 100644 --- a/google/cloud/servicecontrol_v1/types/service_controller.py +++ b/google/cloud/servicecontrol_v1/types/service_controller.py @@ -141,6 +141,22 @@ class ConsumerInfo(proto.Message): class ConsumerType(proto.Enum): r"""The type of the consumer as defined in `Google Resource Manager `__. + + Values: + CONSUMER_TYPE_UNSPECIFIED (0): + This is never used. + PROJECT (1): + The consumer is a Google Cloud Project. + FOLDER (2): + The consumer is a Google Cloud Folder. + ORGANIZATION (3): + The consumer is a Google Cloud Organization. + SERVICE_SPECIFIC (4): + Service-specific resource container which is + defined by the service producer to offer their + users the ability to manage service control + functionalities at a finer level of granularity + than the PROJECT. """ CONSUMER_TYPE_UNSPECIFIED = 0 PROJECT = 1 diff --git a/google/cloud/servicecontrol_v2/gapic_version.py b/google/cloud/servicecontrol_v2/gapic_version.py index f033c61..84856f0 100644 --- a/google/cloud/servicecontrol_v2/gapic_version.py +++ b/google/cloud/servicecontrol_v2/gapic_version.py @@ -13,4 +13,4 @@ # See the License for the specific language governing permissions and # limitations under the License. # -__version__ = "1.7.0" # {x-release-please-version} +__version__ = "1.7.1" # {x-release-please-version} diff --git a/google/cloud/servicecontrol_v2/services/service_controller/client.py b/google/cloud/servicecontrol_v2/services/service_controller/client.py index bfe114f..b5eb1cd 100644 --- a/google/cloud/servicecontrol_v2/services/service_controller/client.py +++ b/google/cloud/servicecontrol_v2/services/service_controller/client.py @@ -636,7 +636,7 @@ def sample_report(): # Done; return the response. return response - def __enter__(self): + def __enter__(self) -> "ServiceControllerClient": return self def __exit__(self, type, value, traceback): diff --git a/samples/generated_samples/snippet_metadata_google.api.servicecontrol.v1.json b/samples/generated_samples/snippet_metadata_google.api.servicecontrol.v1.json index 97a396b..ea92ccc 100644 --- a/samples/generated_samples/snippet_metadata_google.api.servicecontrol.v1.json +++ b/samples/generated_samples/snippet_metadata_google.api.servicecontrol.v1.json @@ -8,7 +8,7 @@ ], "language": "PYTHON", "name": "google-cloud-service-control", - "version": "1.7.0" + "version": "1.7.1" }, "snippets": [ { diff --git a/samples/generated_samples/snippet_metadata_google.api.servicecontrol.v2.json b/samples/generated_samples/snippet_metadata_google.api.servicecontrol.v2.json index 248c0df..afda38d 100644 --- a/samples/generated_samples/snippet_metadata_google.api.servicecontrol.v2.json +++ b/samples/generated_samples/snippet_metadata_google.api.servicecontrol.v2.json @@ -8,7 +8,7 @@ ], "language": "PYTHON", "name": "google-cloud-service-control", - "version": "1.7.0" + "version": "1.7.1" }, "snippets": [ {