Skip to content

Commit

Permalink
fix(deps): Require google-api-core >=1.34.0, >=2.11.0 (#221)
Browse files Browse the repository at this point in the history
* fix(deps): Require google-api-core >=1.34.0, >=2.11.0

fix: Drop usage of pkg_resources

fix: Fix timeout default values

docs(samples): Snippetgen should call await on the operation coroutine before calling result

PiperOrigin-RevId: 493260409

Source-Link: googleapis/googleapis@fea4387

Source-Link: googleapis/googleapis-gen@387b734
Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiMzg3YjczNDRjNzUyOWVlNDRiZTg0ZTYxM2IxOWE4MjA1MDhjNjEyYiJ9

* 🦉 Updates from OwlBot post-processor

See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md

* add gapic_version.py

Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
Co-authored-by: Anthonios Partheniou <[email protected]>
  • Loading branch information
3 people authored Dec 6, 2022
1 parent cd9f742 commit 7271f51
Show file tree
Hide file tree
Showing 16 changed files with 110 additions and 107 deletions.
5 changes: 0 additions & 5 deletions packages/google-cloud-assured-workloads/.coveragerc
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,3 @@ exclude_lines =
pragma: NO COVER
# Ignore debug-only repr
def __repr__
# Ignore pkg_resources exceptions.
# This is added at the module level as a safeguard for if someone
# generates the code and tries to run it without pip installing. This
# makes it virtually impossible to test properly.
except pkg_resources.DistributionNotFound
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# -*- coding: utf-8 -*-
# Copyright 2022 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
__version__ = "1.8.0" # {x-release-please-version}
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@
from google.api_core.client_options import ClientOptions
from google.auth import credentials as ga_credentials # type: ignore
from google.oauth2 import service_account # type: ignore
import pkg_resources

from google.cloud.assuredworkloads_v1 import gapic_version as package_version

try:
OptionalRetry = Union[retries.Retry, gapic_v1.method._MethodDefault]
Expand Down Expand Up @@ -237,7 +238,7 @@ async def create_workload(
parent: Optional[str] = None,
workload: Optional[assuredworkloads.Workload] = None,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: Optional[float] = None,
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
metadata: Sequence[Tuple[str, str]] = (),
) -> operation_async.AsyncOperation:
r"""Creates Assured Workload.
Expand Down Expand Up @@ -272,7 +273,7 @@ async def sample_create_workload():
print("Waiting for operation to complete...")
response = await operation.result()
response = (await operation).result()
# Handle the response
print(response)
Expand Down Expand Up @@ -366,7 +367,7 @@ async def update_workload(
workload: Optional[assuredworkloads.Workload] = None,
update_mask: Optional[field_mask_pb2.FieldMask] = None,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: Optional[float] = None,
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
metadata: Sequence[Tuple[str, str]] = (),
) -> assuredworkloads.Workload:
r"""Updates an existing workload. Currently allows updating of
Expand Down Expand Up @@ -488,7 +489,7 @@ async def restrict_allowed_resources(
] = None,
*,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: Optional[float] = None,
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
metadata: Sequence[Tuple[str, str]] = (),
) -> assuredworkloads.RestrictAllowedResourcesResponse:
r"""Restrict the list of resources allowed in the
Expand Down Expand Up @@ -577,7 +578,7 @@ async def delete_workload(
*,
name: Optional[str] = None,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: Optional[float] = None,
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
metadata: Sequence[Tuple[str, str]] = (),
) -> None:
r"""Deletes the workload. Make sure that workload's direct children
Expand Down Expand Up @@ -669,7 +670,7 @@ async def get_workload(
*,
name: Optional[str] = None,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: Optional[float] = None,
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
metadata: Sequence[Tuple[str, str]] = (),
) -> assuredworkloads.Workload:
r"""Gets Assured Workload associated with a CRM Node
Expand Down Expand Up @@ -774,7 +775,7 @@ async def list_workloads(
*,
parent: Optional[str] = None,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: Optional[float] = None,
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
metadata: Sequence[Tuple[str, str]] = (),
) -> pagers.ListWorkloadsAsyncPager:
r"""Lists Assured Workloads under a CRM Node.
Expand Down Expand Up @@ -889,7 +890,7 @@ async def list_violations(
*,
parent: Optional[str] = None,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: Optional[float] = None,
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
metadata: Sequence[Tuple[str, str]] = (),
) -> pagers.ListViolationsAsyncPager:
r"""Lists the Violations in the AssuredWorkload Environment. Callers
Expand Down Expand Up @@ -1002,7 +1003,7 @@ async def get_violation(
*,
name: Optional[str] = None,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: Optional[float] = None,
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
metadata: Sequence[Tuple[str, str]] = (),
) -> assuredworkloads.Violation:
r"""Retrieves Assured Workload Violation based on ID.
Expand Down Expand Up @@ -1099,7 +1100,7 @@ async def acknowledge_violation(
] = None,
*,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: Optional[float] = None,
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
metadata: Sequence[Tuple[str, str]] = (),
) -> assuredworkloads.AcknowledgeViolationResponse:
r"""Acknowledges an existing violation. By acknowledging
Expand Down Expand Up @@ -1179,7 +1180,7 @@ async def list_operations(
request: Optional[operations_pb2.ListOperationsRequest] = None,
*,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: Optional[float] = None,
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
metadata: Sequence[Tuple[str, str]] = (),
) -> operations_pb2.ListOperationsResponse:
r"""Lists operations that match the specified filter in the request.
Expand Down Expand Up @@ -1233,7 +1234,7 @@ async def get_operation(
request: Optional[operations_pb2.GetOperationRequest] = None,
*,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: Optional[float] = None,
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
metadata: Sequence[Tuple[str, str]] = (),
) -> operations_pb2.Operation:
r"""Gets the latest state of a long-running operation.
Expand Down Expand Up @@ -1289,14 +1290,9 @@ async def __aexit__(self, exc_type, exc, tb):
await self.transport.close()


try:
DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo(
gapic_version=pkg_resources.get_distribution(
"google-cloud-assured-workloads",
).version,
)
except pkg_resources.DistributionNotFound:
DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo()
DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo(
gapic_version=package_version.__version__
)


__all__ = ("AssuredWorkloadsServiceAsyncClient",)
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,8 @@
from google.auth.transport import mtls # type: ignore
from google.auth.transport.grpc import SslCredentials # type: ignore
from google.oauth2 import service_account # type: ignore
import pkg_resources

from google.cloud.assuredworkloads_v1 import gapic_version as package_version

try:
OptionalRetry = Union[retries.Retry, gapic_v1.method._MethodDefault]
Expand Down Expand Up @@ -477,7 +478,7 @@ def create_workload(
parent: Optional[str] = None,
workload: Optional[assuredworkloads.Workload] = None,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: Optional[float] = None,
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
metadata: Sequence[Tuple[str, str]] = (),
) -> operation.Operation:
r"""Creates Assured Workload.
Expand Down Expand Up @@ -606,7 +607,7 @@ def update_workload(
workload: Optional[assuredworkloads.Workload] = None,
update_mask: Optional[field_mask_pb2.FieldMask] = None,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: Optional[float] = None,
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
metadata: Sequence[Tuple[str, str]] = (),
) -> assuredworkloads.Workload:
r"""Updates an existing workload. Currently allows updating of
Expand Down Expand Up @@ -728,7 +729,7 @@ def restrict_allowed_resources(
] = None,
*,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: Optional[float] = None,
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
metadata: Sequence[Tuple[str, str]] = (),
) -> assuredworkloads.RestrictAllowedResourcesResponse:
r"""Restrict the list of resources allowed in the
Expand Down Expand Up @@ -820,7 +821,7 @@ def delete_workload(
*,
name: Optional[str] = None,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: Optional[float] = None,
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
metadata: Sequence[Tuple[str, str]] = (),
) -> None:
r"""Deletes the workload. Make sure that workload's direct children
Expand Down Expand Up @@ -912,7 +913,7 @@ def get_workload(
*,
name: Optional[str] = None,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: Optional[float] = None,
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
metadata: Sequence[Tuple[str, str]] = (),
) -> assuredworkloads.Workload:
r"""Gets Assured Workload associated with a CRM Node
Expand Down Expand Up @@ -1017,7 +1018,7 @@ def list_workloads(
*,
parent: Optional[str] = None,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: Optional[float] = None,
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
metadata: Sequence[Tuple[str, str]] = (),
) -> pagers.ListWorkloadsPager:
r"""Lists Assured Workloads under a CRM Node.
Expand Down Expand Up @@ -1132,7 +1133,7 @@ def list_violations(
*,
parent: Optional[str] = None,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: Optional[float] = None,
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
metadata: Sequence[Tuple[str, str]] = (),
) -> pagers.ListViolationsPager:
r"""Lists the Violations in the AssuredWorkload Environment. Callers
Expand Down Expand Up @@ -1245,7 +1246,7 @@ def get_violation(
*,
name: Optional[str] = None,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: Optional[float] = None,
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
metadata: Sequence[Tuple[str, str]] = (),
) -> assuredworkloads.Violation:
r"""Retrieves Assured Workload Violation based on ID.
Expand Down Expand Up @@ -1342,7 +1343,7 @@ def acknowledge_violation(
] = None,
*,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: Optional[float] = None,
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
metadata: Sequence[Tuple[str, str]] = (),
) -> assuredworkloads.AcknowledgeViolationResponse:
r"""Acknowledges an existing violation. By acknowledging
Expand Down Expand Up @@ -1436,7 +1437,7 @@ def list_operations(
request: Optional[operations_pb2.ListOperationsRequest] = None,
*,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: Optional[float] = None,
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
metadata: Sequence[Tuple[str, str]] = (),
) -> operations_pb2.ListOperationsResponse:
r"""Lists operations that match the specified filter in the request.
Expand Down Expand Up @@ -1490,7 +1491,7 @@ def get_operation(
request: Optional[operations_pb2.GetOperationRequest] = None,
*,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: Optional[float] = None,
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
metadata: Sequence[Tuple[str, str]] = (),
) -> operations_pb2.Operation:
r"""Gets the latest state of a long-running operation.
Expand Down Expand Up @@ -1540,14 +1541,9 @@ def get_operation(
return response


try:
DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo(
gapic_version=pkg_resources.get_distribution(
"google-cloud-assured-workloads",
).version,
)
except pkg_resources.DistributionNotFound:
DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo()
DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo(
gapic_version=package_version.__version__
)


__all__ = ("AssuredWorkloadsServiceClient",)
Original file line number Diff line number Diff line change
Expand Up @@ -25,18 +25,13 @@
from google.longrunning import operations_pb2 # type: ignore
from google.oauth2 import service_account # type: ignore
from google.protobuf import empty_pb2 # type: ignore
import pkg_resources

from google.cloud.assuredworkloads_v1 import gapic_version as package_version
from google.cloud.assuredworkloads_v1.types import assuredworkloads

try:
DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo(
gapic_version=pkg_resources.get_distribution(
"google-cloud-assured-workloads",
).version,
)
except pkg_resources.DistributionNotFound:
DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo()
DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo(
gapic_version=package_version.__version__
)


class AssuredWorkloadsServiceTransport(abc.ABC):
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# -*- coding: utf-8 -*-
# Copyright 2022 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
__version__ = "1.8.0" # {x-release-please-version}
Loading

0 comments on commit 7271f51

Please sign in to comment.