Skip to content

Commit ddd1508

Browse files
fix!: [google-cloud-storage-control] An existing resource pattern value projects/{project}/buckets/{bucket}/managedFolders/{managedFolder=**} to resource definition storage.googleapis.com/ManagedFolder is removed (#12659)
BEGIN_COMMIT_OVERRIDE fix!: An existing resource pattern value `projects/{project}/buckets/{bucket}/managedFolders/{managedFolder=**}` to resource definition `[storage.googleapis.com/ManagedFolder](https://www.google.com/url?sa=D&q=http%3A%2F%2Fstorage.googleapis.com%2FManagedFolder)` is removed feat: A new resource pattern value `projects/{project}/buckets/{bucket}/managedFolders/{managed_folder=**}` added to the resource definition `[storage.googleapis.com/ManagedFolder](https://www.google.com/url?sa=D&q=http%3A%2F%2Fstorage.googleapis.com%2FManagedFolder)` END_COMMIT_OVERRIDE - [ ] Regenerate this pull request now. feat: A new resource pattern value `projects/{project}/buckets/{bucket}/managedFolders/{managed_folder=**}` added to the resource definition `storage.googleapis.com/ManagedFolder` PiperOrigin-RevId: 630439820 Source-Link: googleapis/googleapis@d9a3161 Source-Link: googleapis/googleapis-gen@d39d37f Copy-Tag: eyJwIjoicGFja2FnZXMvZ29vZ2xlLWNsb3VkLXN0b3JhZ2UtY29udHJvbC8uT3dsQm90LnlhbWwiLCJoIjoiZDM5ZDM3ZjRiYWQ5NzVkYTBmYjBiYjI3N2RkNGUxOGZiZWJhMjRkNSJ9 --------- Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com> Co-authored-by: ohmayr <omairnaveed@ymail.com>
1 parent ae30a4e commit ddd1508

File tree

8 files changed

+1233
-264
lines changed

8 files changed

+1233
-264
lines changed

packages/google-cloud-storage-control/google/cloud/storage_control/gapic_version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,4 @@
1313
# See the License for the specific language governing permissions and
1414
# limitations under the License.
1515
#
16-
__version__ = "0.1.3" # {x-release-please-version}
16+
__version__ = "0.0.0" # {x-release-please-version}

packages/google-cloud-storage-control/google/cloud/storage_control_v2/gapic_version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,4 @@
1313
# See the License for the specific language governing permissions and
1414
# limitations under the License.
1515
#
16-
__version__ = "0.1.3" # {x-release-please-version}
16+
__version__ = "0.0.0" # {x-release-please-version}

packages/google-cloud-storage-control/google/cloud/storage_control_v2/services/storage_control/async_client.py

Lines changed: 99 additions & 162 deletions
Large diffs are not rendered by default.

packages/google-cloud-storage-control/google/cloud/storage_control_v2/services/storage_control/client.py

Lines changed: 64 additions & 74 deletions
Large diffs are not rendered by default.

packages/google-cloud-storage-control/google/cloud/storage_control_v2/services/storage_control/transports/grpc.py

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ def __init__(
5252
credentials: Optional[ga_credentials.Credentials] = None,
5353
credentials_file: Optional[str] = None,
5454
scopes: Optional[Sequence[str]] = None,
55-
channel: Optional[grpc.Channel] = None,
55+
channel: Optional[Union[grpc.Channel, Callable[..., grpc.Channel]]] = None,
5656
api_mtls_endpoint: Optional[str] = None,
5757
client_cert_source: Optional[Callable[[], Tuple[bytes, bytes]]] = None,
5858
ssl_channel_credentials: Optional[grpc.ChannelCredentials] = None,
@@ -72,14 +72,17 @@ def __init__(
7272
credentials identify the application to the service; if none
7373
are specified, the client will attempt to ascertain the
7474
credentials from the environment.
75-
This argument is ignored if ``channel`` is provided.
75+
This argument is ignored if a ``channel`` instance is provided.
7676
credentials_file (Optional[str]): A file with credentials that can
7777
be loaded with :func:`google.auth.load_credentials_from_file`.
78-
This argument is ignored if ``channel`` is provided.
78+
This argument is ignored if a ``channel`` instance is provided.
7979
scopes (Optional(Sequence[str])): A list of scopes. This argument is
80-
ignored if ``channel`` is provided.
81-
channel (Optional[grpc.Channel]): A ``Channel`` instance through
82-
which to make calls.
80+
ignored if a ``channel`` instance is provided.
81+
channel (Optional[Union[grpc.Channel, Callable[..., grpc.Channel]]]):
82+
A ``Channel`` instance through which to make calls, or a Callable
83+
that constructs and returns one. If set to None, ``self.create_channel``
84+
is used to create the channel. If a Callable is given, it will be called
85+
with the same arguments as used in ``self.create_channel``.
8386
api_mtls_endpoint (Optional[str]): Deprecated. The mutual TLS endpoint.
8487
If provided, it overrides the ``host`` argument and tries to create
8588
a mutual TLS channel with client SSL credentials from
@@ -89,11 +92,11 @@ def __init__(
8992
private key bytes, both in PEM format. It is ignored if
9093
``api_mtls_endpoint`` is None.
9194
ssl_channel_credentials (grpc.ChannelCredentials): SSL credentials
92-
for the grpc channel. It is ignored if ``channel`` is provided.
95+
for the grpc channel. It is ignored if a ``channel`` instance is provided.
9396
client_cert_source_for_mtls (Optional[Callable[[], Tuple[bytes, bytes]]]):
9497
A callback to provide client certificate bytes and private key bytes,
9598
both in PEM format. It is used to configure a mutual TLS channel. It is
96-
ignored if ``channel`` or ``ssl_channel_credentials`` is provided.
99+
ignored if a ``channel`` instance or ``ssl_channel_credentials`` is provided.
97100
quota_project_id (Optional[str]): An optional project to use for billing
98101
and quota.
99102
client_info (google.api_core.gapic_v1.client_info.ClientInfo):
@@ -120,7 +123,7 @@ def __init__(
120123
if client_cert_source:
121124
warnings.warn("client_cert_source is deprecated", DeprecationWarning)
122125

123-
if channel:
126+
if isinstance(channel, grpc.Channel):
124127
# Ignore credentials if a channel was passed.
125128
credentials = False
126129
# If a channel was explicitly provided, set it.
@@ -161,7 +164,9 @@ def __init__(
161164
)
162165

163166
if not self._grpc_channel:
164-
self._grpc_channel = type(self).create_channel(
167+
# initialize with the provided callable or the default channel
168+
channel_init = channel or type(self).create_channel
169+
self._grpc_channel = channel_init(
165170
self._host,
166171
# use the credentials which are saved
167172
credentials=self._credentials,

packages/google-cloud-storage-control/google/cloud/storage_control_v2/services/storage_control/transports/grpc_asyncio.py

Lines changed: 149 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,9 @@
1616
from typing import Awaitable, Callable, Dict, Optional, Sequence, Tuple, Union
1717
import warnings
1818

19+
from google.api_core import exceptions as core_exceptions
1920
from google.api_core import gapic_v1, grpc_helpers_async, operations_v1
21+
from google.api_core import retry_async as retries
2022
from google.auth import credentials as ga_credentials # type: ignore
2123
from google.auth.transport.grpc import SslCredentials # type: ignore
2224
from google.longrunning import operations_pb2 # type: ignore
@@ -67,7 +69,6 @@ def create_channel(
6769
the credentials from the environment.
6870
credentials_file (Optional[str]): A file with credentials that can
6971
be loaded with :func:`google.auth.load_credentials_from_file`.
70-
This argument is ignored if ``channel`` is provided.
7172
scopes (Optional[Sequence[str]]): A optional list of scopes needed for this
7273
service. These are only used when credentials are not specified and
7374
are passed to :func:`google.auth.default`.
@@ -97,7 +98,7 @@ def __init__(
9798
credentials: Optional[ga_credentials.Credentials] = None,
9899
credentials_file: Optional[str] = None,
99100
scopes: Optional[Sequence[str]] = None,
100-
channel: Optional[aio.Channel] = None,
101+
channel: Optional[Union[aio.Channel, Callable[..., aio.Channel]]] = None,
101102
api_mtls_endpoint: Optional[str] = None,
102103
client_cert_source: Optional[Callable[[], Tuple[bytes, bytes]]] = None,
103104
ssl_channel_credentials: Optional[grpc.ChannelCredentials] = None,
@@ -117,15 +118,18 @@ def __init__(
117118
credentials identify the application to the service; if none
118119
are specified, the client will attempt to ascertain the
119120
credentials from the environment.
120-
This argument is ignored if ``channel`` is provided.
121+
This argument is ignored if a ``channel`` instance is provided.
121122
credentials_file (Optional[str]): A file with credentials that can
122123
be loaded with :func:`google.auth.load_credentials_from_file`.
123-
This argument is ignored if ``channel`` is provided.
124+
This argument is ignored if a ``channel`` instance is provided.
124125
scopes (Optional[Sequence[str]]): A optional list of scopes needed for this
125126
service. These are only used when credentials are not specified and
126127
are passed to :func:`google.auth.default`.
127-
channel (Optional[aio.Channel]): A ``Channel`` instance through
128-
which to make calls.
128+
channel (Optional[Union[aio.Channel, Callable[..., aio.Channel]]]):
129+
A ``Channel`` instance through which to make calls, or a Callable
130+
that constructs and returns one. If set to None, ``self.create_channel``
131+
is used to create the channel. If a Callable is given, it will be called
132+
with the same arguments as used in ``self.create_channel``.
129133
api_mtls_endpoint (Optional[str]): Deprecated. The mutual TLS endpoint.
130134
If provided, it overrides the ``host`` argument and tries to create
131135
a mutual TLS channel with client SSL credentials from
@@ -135,11 +139,11 @@ def __init__(
135139
private key bytes, both in PEM format. It is ignored if
136140
``api_mtls_endpoint`` is None.
137141
ssl_channel_credentials (grpc.ChannelCredentials): SSL credentials
138-
for the grpc channel. It is ignored if ``channel`` is provided.
142+
for the grpc channel. It is ignored if a ``channel`` instance is provided.
139143
client_cert_source_for_mtls (Optional[Callable[[], Tuple[bytes, bytes]]]):
140144
A callback to provide client certificate bytes and private key bytes,
141145
both in PEM format. It is used to configure a mutual TLS channel. It is
142-
ignored if ``channel`` or ``ssl_channel_credentials`` is provided.
146+
ignored if a ``channel`` instance or ``ssl_channel_credentials`` is provided.
143147
quota_project_id (Optional[str]): An optional project to use for billing
144148
and quota.
145149
client_info (google.api_core.gapic_v1.client_info.ClientInfo):
@@ -166,7 +170,7 @@ def __init__(
166170
if client_cert_source:
167171
warnings.warn("client_cert_source is deprecated", DeprecationWarning)
168172

169-
if channel:
173+
if isinstance(channel, aio.Channel):
170174
# Ignore credentials if a channel was passed.
171175
credentials = False
172176
# If a channel was explicitly provided, set it.
@@ -206,7 +210,9 @@ def __init__(
206210
)
207211

208212
if not self._grpc_channel:
209-
self._grpc_channel = type(self).create_channel(
213+
# initialize with the provided callable or the default channel
214+
channel_init = channel or type(self).create_channel
215+
self._grpc_channel = channel_init(
210216
self._host,
211217
# use the credentials which are saved
212218
credentials=self._credentials,
@@ -551,6 +557,139 @@ def list_managed_folders(
551557
)
552558
return self._stubs["list_managed_folders"]
553559

560+
def _prep_wrapped_messages(self, client_info):
561+
"""Precompute the wrapped methods, overriding the base class method to use async wrappers."""
562+
self._wrapped_methods = {
563+
self.create_folder: gapic_v1.method_async.wrap_method(
564+
self.create_folder,
565+
default_timeout=None,
566+
client_info=client_info,
567+
),
568+
self.delete_folder: gapic_v1.method_async.wrap_method(
569+
self.delete_folder,
570+
default_timeout=None,
571+
client_info=client_info,
572+
),
573+
self.get_folder: gapic_v1.method_async.wrap_method(
574+
self.get_folder,
575+
default_retry=retries.AsyncRetry(
576+
initial=1.0,
577+
maximum=60.0,
578+
multiplier=2,
579+
predicate=retries.if_exception_type(
580+
core_exceptions.DeadlineExceeded,
581+
core_exceptions.InternalServerError,
582+
core_exceptions.ResourceExhausted,
583+
core_exceptions.ServiceUnavailable,
584+
core_exceptions.Unknown,
585+
),
586+
deadline=60.0,
587+
),
588+
default_timeout=60.0,
589+
client_info=client_info,
590+
),
591+
self.list_folders: gapic_v1.method_async.wrap_method(
592+
self.list_folders,
593+
default_retry=retries.AsyncRetry(
594+
initial=1.0,
595+
maximum=60.0,
596+
multiplier=2,
597+
predicate=retries.if_exception_type(
598+
core_exceptions.DeadlineExceeded,
599+
core_exceptions.InternalServerError,
600+
core_exceptions.ResourceExhausted,
601+
core_exceptions.ServiceUnavailable,
602+
core_exceptions.Unknown,
603+
),
604+
deadline=60.0,
605+
),
606+
default_timeout=60.0,
607+
client_info=client_info,
608+
),
609+
self.rename_folder: gapic_v1.method_async.wrap_method(
610+
self.rename_folder,
611+
default_retry=retries.AsyncRetry(
612+
initial=1.0,
613+
maximum=60.0,
614+
multiplier=2,
615+
predicate=retries.if_exception_type(
616+
core_exceptions.DeadlineExceeded,
617+
core_exceptions.InternalServerError,
618+
core_exceptions.ResourceExhausted,
619+
core_exceptions.ServiceUnavailable,
620+
core_exceptions.Unknown,
621+
),
622+
deadline=60.0,
623+
),
624+
default_timeout=60.0,
625+
client_info=client_info,
626+
),
627+
self.get_storage_layout: gapic_v1.method_async.wrap_method(
628+
self.get_storage_layout,
629+
default_retry=retries.AsyncRetry(
630+
initial=1.0,
631+
maximum=60.0,
632+
multiplier=2,
633+
predicate=retries.if_exception_type(
634+
core_exceptions.DeadlineExceeded,
635+
core_exceptions.InternalServerError,
636+
core_exceptions.ResourceExhausted,
637+
core_exceptions.ServiceUnavailable,
638+
core_exceptions.Unknown,
639+
),
640+
deadline=60.0,
641+
),
642+
default_timeout=60.0,
643+
client_info=client_info,
644+
),
645+
self.create_managed_folder: gapic_v1.method_async.wrap_method(
646+
self.create_managed_folder,
647+
default_timeout=None,
648+
client_info=client_info,
649+
),
650+
self.delete_managed_folder: gapic_v1.method_async.wrap_method(
651+
self.delete_managed_folder,
652+
default_timeout=None,
653+
client_info=client_info,
654+
),
655+
self.get_managed_folder: gapic_v1.method_async.wrap_method(
656+
self.get_managed_folder,
657+
default_retry=retries.AsyncRetry(
658+
initial=1.0,
659+
maximum=60.0,
660+
multiplier=2,
661+
predicate=retries.if_exception_type(
662+
core_exceptions.DeadlineExceeded,
663+
core_exceptions.InternalServerError,
664+
core_exceptions.ResourceExhausted,
665+
core_exceptions.ServiceUnavailable,
666+
core_exceptions.Unknown,
667+
),
668+
deadline=60.0,
669+
),
670+
default_timeout=60.0,
671+
client_info=client_info,
672+
),
673+
self.list_managed_folders: gapic_v1.method_async.wrap_method(
674+
self.list_managed_folders,
675+
default_retry=retries.AsyncRetry(
676+
initial=1.0,
677+
maximum=60.0,
678+
multiplier=2,
679+
predicate=retries.if_exception_type(
680+
core_exceptions.DeadlineExceeded,
681+
core_exceptions.InternalServerError,
682+
core_exceptions.ResourceExhausted,
683+
core_exceptions.ServiceUnavailable,
684+
core_exceptions.Unknown,
685+
),
686+
deadline=60.0,
687+
),
688+
default_timeout=60.0,
689+
client_info=client_info,
690+
),
691+
}
692+
554693
def close(self):
555694
return self.grpc_channel.close()
556695

packages/google-cloud-storage-control/samples/generated_samples/snippet_metadata_google.storage.control.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-storage-control",
11-
"version": "0.1.3"
11+
"version": "0.1.0"
1212
},
1313
"snippets": [
1414
{

0 commit comments

Comments
 (0)