Skip to content

Commit

Permalink
feat: [google-apps-events-subscriptions] Add support for opt-in debug…
Browse files Browse the repository at this point in the history
… logging (#13315)

BEGIN_COMMIT_OVERRIDE
feat: Add support for opt-in debug logging
fix: Fix typing issue with gRPC metadata when key ends in -bin
chore: Update gapic-generator-python to v1.21.0
feat: A new field `dns_endpoint` is added to message
`.google.cloud.deploy.v1.GkeCluster`
docs: A comment for field `internal_ip` in message
`.google.cloud.deploy.v1.GkeCluster` is changed
docs: A comment for field `skaffold_version` in message
`.google.cloud.deploy.v1.Release` is changed
docs: A comment for field `requested_cancellation` in message
`.google.cloud.deploy.v1.OperationMetadata` is changed
END_COMMIT_OVERRIDE

- [ ] Regenerate this pull request now.

fix: Fix typing issue with gRPC metadata when key ends in -bin
chore: Update gapic-generator-python to v1.21.0

PiperOrigin-RevId: 705285820

Source-Link:
googleapis/googleapis@f9b8b91

Source-Link:
googleapis/googleapis-gen@ca1e0a1
Copy-Tag:
eyJwIjoicGFja2FnZXMvZ29vZ2xlLWFwcHMtZXZlbnRzLXN1YnNjcmlwdGlvbnMvLk93bEJvdC55YW1sIiwiaCI6ImNhMWUwYTFlNDcyZDZlNmY1ZGU4ODNhNWNiNTQ3MjRmMTEyY2UzNDgifQ==

BEGIN_NESTED_COMMIT
feat: [google-apps-events-subscriptions] A new field `dns_endpoint` is
added to message `.google.cloud.deploy.v1.GkeCluster`
docs: A comment for field `internal_ip` in message
`.google.cloud.deploy.v1.GkeCluster` is changed
docs: A comment for field `skaffold_version` in message
`.google.cloud.deploy.v1.Release` is changed
docs: A comment for field `requested_cancellation` in message
`.google.cloud.deploy.v1.OperationMetadata` is changed

PiperOrigin-RevId: 702047981

Source-Link:
googleapis/googleapis@99a5e29

Source-Link:
googleapis/googleapis-gen@2fdcaaf
Copy-Tag:
eyJwIjoicGFja2FnZXMvZ29vZ2xlLWFwcHMtZXZlbnRzLXN1YnNjcmlwdGlvbnMvLk93bEJvdC55YW1sIiwiaCI6IjJmZGNhYWZlNWUxZWJkNmZlMTkyMWNiYjUzZjQxNDI3MDg2NDYyZGYifQ==
END_NESTED_COMMIT

---------

Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
Co-authored-by: ohmayr <omairnaveed@ymail.com>
  • Loading branch information
3 people authored Dec 12, 2024
1 parent 74833d3 commit 917e8d3
Show file tree
Hide file tree
Showing 10 changed files with 812 additions and 119 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
__version__ = "0.1.4" # {x-release-please-version}
__version__ = "0.0.0" # {x-release-please-version}
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
__version__ = "0.1.4" # {x-release-please-version}
__version__ = "0.0.0" # {x-release-please-version}
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
# limitations under the License.
#
from collections import OrderedDict
import logging as std_logging
import re
from typing import (
Callable,
Expand Down Expand Up @@ -60,6 +61,15 @@
from .transports.base import DEFAULT_CLIENT_INFO, SubscriptionsServiceTransport
from .transports.grpc_asyncio import SubscriptionsServiceGrpcAsyncIOTransport

try:
from google.api_core import client_logging # type: ignore

CLIENT_LOGGING_SUPPORTED = True # pragma: NO COVER
except ImportError: # pragma: NO COVER
CLIENT_LOGGING_SUPPORTED = False

_LOGGER = std_logging.getLogger(__name__)


class SubscriptionsServiceAsyncClient:
"""A service that manages subscriptions to Google Workspace
Expand Down Expand Up @@ -277,6 +287,28 @@ def __init__(
client_info=client_info,
)

if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor(
std_logging.DEBUG
): # pragma: NO COVER
_LOGGER.debug(
"Created client `google.apps.events.subscriptions_v1.SubscriptionsServiceAsyncClient`.",
extra={
"serviceName": "google.apps.events.subscriptions.v1.SubscriptionsService",
"universeDomain": getattr(
self._client._transport._credentials, "universe_domain", ""
),
"credentialsType": f"{type(self._client._transport._credentials).__module__}.{type(self._client._transport._credentials).__qualname__}",
"credentialsInfo": getattr(
self.transport._credentials, "get_cred_info", lambda: None
)(),
}
if hasattr(self._client._transport, "_credentials")
else {
"serviceName": "google.apps.events.subscriptions.v1.SubscriptionsService",
"credentialsType": None,
},
)

async def create_subscription(
self,
request: Optional[
Expand All @@ -286,7 +318,7 @@ async def create_subscription(
subscription: Optional[subscription_resource.Subscription] = None,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
metadata: Sequence[Tuple[str, str]] = (),
metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
) -> operation_async.AsyncOperation:
r"""Creates a Google Workspace subscription. To learn how to use
this method, see `Create a Google Workspace
Expand Down Expand Up @@ -341,8 +373,10 @@ async def sample_create_subscription():
retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any,
should be retried.
timeout (float): The timeout for this request.
metadata (Sequence[Tuple[str, str]]): Strings which should be
sent along with the request as metadata.
metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
sent along with the request as metadata. Normally, each value must be of type `str`,
but for metadata keys ending with the suffix `-bin`, the corresponding values must
be of type `bytes`.
Returns:
google.api_core.operation_async.AsyncOperation:
Expand Down Expand Up @@ -411,7 +445,7 @@ async def delete_subscription(
name: Optional[str] = None,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
metadata: Sequence[Tuple[str, str]] = (),
metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
) -> operation_async.AsyncOperation:
r"""Deletes a Google Workspace subscription. To learn how to use
this method, see `Delete a Google Workspace
Expand Down Expand Up @@ -462,8 +496,10 @@ async def sample_delete_subscription():
retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any,
should be retried.
timeout (float): The timeout for this request.
metadata (Sequence[Tuple[str, str]]): Strings which should be
sent along with the request as metadata.
metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
sent along with the request as metadata. Normally, each value must be of type `str`,
but for metadata keys ending with the suffix `-bin`, the corresponding values must
be of type `bytes`.
Returns:
google.api_core.operation_async.AsyncOperation:
Expand Down Expand Up @@ -544,7 +580,7 @@ async def get_subscription(
name: Optional[str] = None,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
metadata: Sequence[Tuple[str, str]] = (),
metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
) -> subscription_resource.Subscription:
r"""Gets details about a Google Workspace subscription. To learn how
to use this method, see `Get details about a Google Workspace
Expand Down Expand Up @@ -591,8 +627,10 @@ async def sample_get_subscription():
retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any,
should be retried.
timeout (float): The timeout for this request.
metadata (Sequence[Tuple[str, str]]): Strings which should be
sent along with the request as metadata.
metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
sent along with the request as metadata. Normally, each value must be of type `str`,
but for metadata keys ending with the suffix `-bin`, the corresponding values must
be of type `bytes`.
Returns:
google.apps.events_subscriptions_v1.types.Subscription:
Expand Down Expand Up @@ -657,7 +695,7 @@ async def list_subscriptions(
filter: Optional[str] = None,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
metadata: Sequence[Tuple[str, str]] = (),
metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
) -> pagers.ListSubscriptionsAsyncPager:
r"""Lists Google Workspace subscriptions. To learn how to use this
method, see `List Google Workspace
Expand Down Expand Up @@ -732,8 +770,10 @@ async def sample_list_subscriptions():
retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any,
should be retried.
timeout (float): The timeout for this request.
metadata (Sequence[Tuple[str, str]]): Strings which should be
sent along with the request as metadata.
metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
sent along with the request as metadata. Normally, each value must be of type `str`,
but for metadata keys ending with the suffix `-bin`, the corresponding values must
be of type `bytes`.
Returns:
google.apps.events_subscriptions_v1.services.subscriptions_service.pagers.ListSubscriptionsAsyncPager:
Expand Down Expand Up @@ -805,7 +845,7 @@ async def update_subscription(
update_mask: Optional[field_mask_pb2.FieldMask] = None,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
metadata: Sequence[Tuple[str, str]] = (),
metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
) -> operation_async.AsyncOperation:
r"""Updates or renews a Google Workspace subscription. To learn how
to use this method, see `Update or renew a Google Workspace
Expand Down Expand Up @@ -877,8 +917,10 @@ async def sample_update_subscription():
retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any,
should be retried.
timeout (float): The timeout for this request.
metadata (Sequence[Tuple[str, str]]): Strings which should be
sent along with the request as metadata.
metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
sent along with the request as metadata. Normally, each value must be of type `str`,
but for metadata keys ending with the suffix `-bin`, the corresponding values must
be of type `bytes`.
Returns:
google.api_core.operation_async.AsyncOperation:
Expand Down Expand Up @@ -957,7 +999,7 @@ async def reactivate_subscription(
name: Optional[str] = None,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
metadata: Sequence[Tuple[str, str]] = (),
metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
) -> operation_async.AsyncOperation:
r"""Reactivates a suspended Google Workspace subscription.
Expand Down Expand Up @@ -1012,8 +1054,10 @@ async def sample_reactivate_subscription():
retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any,
should be retried.
timeout (float): The timeout for this request.
metadata (Sequence[Tuple[str, str]]): Strings which should be
sent along with the request as metadata.
metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
sent along with the request as metadata. Normally, each value must be of type `str`,
but for metadata keys ending with the suffix `-bin`, the corresponding values must
be of type `bytes`.
Returns:
google.api_core.operation_async.AsyncOperation:
Expand Down Expand Up @@ -1085,7 +1129,7 @@ async def get_operation(
*,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
metadata: Sequence[Tuple[str, str]] = (),
metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
) -> operations_pb2.Operation:
r"""Gets the latest state of a long-running operation.
Expand All @@ -1096,8 +1140,10 @@ async def get_operation(
retry (google.api_core.retry_async.AsyncRetry): Designation of what errors,
if any, should be retried.
timeout (float): The timeout for this request.
metadata (Sequence[Tuple[str, str]]): Strings which should be
sent along with the request as metadata.
metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
sent along with the request as metadata. Normally, each value must be of type `str`,
but for metadata keys ending with the suffix `-bin`, the corresponding values must
be of type `bytes`.
Returns:
~.operations_pb2.Operation:
An ``Operation`` object.
Expand Down
Loading

0 comments on commit 917e8d3

Please sign in to comment.