Skip to content

Commit

Permalink
fix!: [google-cloud-storage-control] An existing resource pattern val…
Browse files Browse the repository at this point in the history
…ue `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 <[email protected]>
  • Loading branch information
3 people authored May 7, 2024
1 parent ae30a4e commit ddd1508
Show file tree
Hide file tree
Showing 8 changed files with 1,233 additions and 264 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.3" # {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.3" # {x-release-please-version}
__version__ = "0.0.0" # {x-release-please-version}

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ def __init__(
credentials: Optional[ga_credentials.Credentials] = None,
credentials_file: Optional[str] = None,
scopes: Optional[Sequence[str]] = None,
channel: Optional[grpc.Channel] = None,
channel: Optional[Union[grpc.Channel, Callable[..., grpc.Channel]]] = None,
api_mtls_endpoint: Optional[str] = None,
client_cert_source: Optional[Callable[[], Tuple[bytes, bytes]]] = None,
ssl_channel_credentials: Optional[grpc.ChannelCredentials] = None,
Expand All @@ -72,14 +72,17 @@ def __init__(
credentials identify the application to the service; if none
are specified, the client will attempt to ascertain the
credentials from the environment.
This argument is ignored if ``channel`` is provided.
This argument is ignored if a ``channel`` instance is provided.
credentials_file (Optional[str]): A file with credentials that can
be loaded with :func:`google.auth.load_credentials_from_file`.
This argument is ignored if ``channel`` is provided.
This argument is ignored if a ``channel`` instance is provided.
scopes (Optional(Sequence[str])): A list of scopes. This argument is
ignored if ``channel`` is provided.
channel (Optional[grpc.Channel]): A ``Channel`` instance through
which to make calls.
ignored if a ``channel`` instance is provided.
channel (Optional[Union[grpc.Channel, Callable[..., grpc.Channel]]]):
A ``Channel`` instance through which to make calls, or a Callable
that constructs and returns one. If set to None, ``self.create_channel``
is used to create the channel. If a Callable is given, it will be called
with the same arguments as used in ``self.create_channel``.
api_mtls_endpoint (Optional[str]): Deprecated. The mutual TLS endpoint.
If provided, it overrides the ``host`` argument and tries to create
a mutual TLS channel with client SSL credentials from
Expand All @@ -89,11 +92,11 @@ def __init__(
private key bytes, both in PEM format. It is ignored if
``api_mtls_endpoint`` is None.
ssl_channel_credentials (grpc.ChannelCredentials): SSL credentials
for the grpc channel. It is ignored if ``channel`` is provided.
for the grpc channel. It is ignored if a ``channel`` instance is provided.
client_cert_source_for_mtls (Optional[Callable[[], Tuple[bytes, bytes]]]):
A callback to provide client certificate bytes and private key bytes,
both in PEM format. It is used to configure a mutual TLS channel. It is
ignored if ``channel`` or ``ssl_channel_credentials`` is provided.
ignored if a ``channel`` instance or ``ssl_channel_credentials`` is provided.
quota_project_id (Optional[str]): An optional project to use for billing
and quota.
client_info (google.api_core.gapic_v1.client_info.ClientInfo):
Expand All @@ -120,7 +123,7 @@ def __init__(
if client_cert_source:
warnings.warn("client_cert_source is deprecated", DeprecationWarning)

if channel:
if isinstance(channel, grpc.Channel):
# Ignore credentials if a channel was passed.
credentials = False
# If a channel was explicitly provided, set it.
Expand Down Expand Up @@ -161,7 +164,9 @@ def __init__(
)

if not self._grpc_channel:
self._grpc_channel = type(self).create_channel(
# initialize with the provided callable or the default channel
channel_init = channel or type(self).create_channel
self._grpc_channel = channel_init(
self._host,
# use the credentials which are saved
credentials=self._credentials,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,9 @@
from typing import Awaitable, Callable, Dict, Optional, Sequence, Tuple, Union
import warnings

from google.api_core import exceptions as core_exceptions
from google.api_core import gapic_v1, grpc_helpers_async, operations_v1
from google.api_core import retry_async as retries
from google.auth import credentials as ga_credentials # type: ignore
from google.auth.transport.grpc import SslCredentials # type: ignore
from google.longrunning import operations_pb2 # type: ignore
Expand Down Expand Up @@ -67,7 +69,6 @@ def create_channel(
the credentials from the environment.
credentials_file (Optional[str]): A file with credentials that can
be loaded with :func:`google.auth.load_credentials_from_file`.
This argument is ignored if ``channel`` is provided.
scopes (Optional[Sequence[str]]): A optional list of scopes needed for this
service. These are only used when credentials are not specified and
are passed to :func:`google.auth.default`.
Expand Down Expand Up @@ -97,7 +98,7 @@ def __init__(
credentials: Optional[ga_credentials.Credentials] = None,
credentials_file: Optional[str] = None,
scopes: Optional[Sequence[str]] = None,
channel: Optional[aio.Channel] = None,
channel: Optional[Union[aio.Channel, Callable[..., aio.Channel]]] = None,
api_mtls_endpoint: Optional[str] = None,
client_cert_source: Optional[Callable[[], Tuple[bytes, bytes]]] = None,
ssl_channel_credentials: Optional[grpc.ChannelCredentials] = None,
Expand All @@ -117,15 +118,18 @@ def __init__(
credentials identify the application to the service; if none
are specified, the client will attempt to ascertain the
credentials from the environment.
This argument is ignored if ``channel`` is provided.
This argument is ignored if a ``channel`` instance is provided.
credentials_file (Optional[str]): A file with credentials that can
be loaded with :func:`google.auth.load_credentials_from_file`.
This argument is ignored if ``channel`` is provided.
This argument is ignored if a ``channel`` instance is provided.
scopes (Optional[Sequence[str]]): A optional list of scopes needed for this
service. These are only used when credentials are not specified and
are passed to :func:`google.auth.default`.
channel (Optional[aio.Channel]): A ``Channel`` instance through
which to make calls.
channel (Optional[Union[aio.Channel, Callable[..., aio.Channel]]]):
A ``Channel`` instance through which to make calls, or a Callable
that constructs and returns one. If set to None, ``self.create_channel``
is used to create the channel. If a Callable is given, it will be called
with the same arguments as used in ``self.create_channel``.
api_mtls_endpoint (Optional[str]): Deprecated. The mutual TLS endpoint.
If provided, it overrides the ``host`` argument and tries to create
a mutual TLS channel with client SSL credentials from
Expand All @@ -135,11 +139,11 @@ def __init__(
private key bytes, both in PEM format. It is ignored if
``api_mtls_endpoint`` is None.
ssl_channel_credentials (grpc.ChannelCredentials): SSL credentials
for the grpc channel. It is ignored if ``channel`` is provided.
for the grpc channel. It is ignored if a ``channel`` instance is provided.
client_cert_source_for_mtls (Optional[Callable[[], Tuple[bytes, bytes]]]):
A callback to provide client certificate bytes and private key bytes,
both in PEM format. It is used to configure a mutual TLS channel. It is
ignored if ``channel`` or ``ssl_channel_credentials`` is provided.
ignored if a ``channel`` instance or ``ssl_channel_credentials`` is provided.
quota_project_id (Optional[str]): An optional project to use for billing
and quota.
client_info (google.api_core.gapic_v1.client_info.ClientInfo):
Expand All @@ -166,7 +170,7 @@ def __init__(
if client_cert_source:
warnings.warn("client_cert_source is deprecated", DeprecationWarning)

if channel:
if isinstance(channel, aio.Channel):
# Ignore credentials if a channel was passed.
credentials = False
# If a channel was explicitly provided, set it.
Expand Down Expand Up @@ -206,7 +210,9 @@ def __init__(
)

if not self._grpc_channel:
self._grpc_channel = type(self).create_channel(
# initialize with the provided callable or the default channel
channel_init = channel or type(self).create_channel
self._grpc_channel = channel_init(
self._host,
# use the credentials which are saved
credentials=self._credentials,
Expand Down Expand Up @@ -551,6 +557,139 @@ def list_managed_folders(
)
return self._stubs["list_managed_folders"]

def _prep_wrapped_messages(self, client_info):
"""Precompute the wrapped methods, overriding the base class method to use async wrappers."""
self._wrapped_methods = {
self.create_folder: gapic_v1.method_async.wrap_method(
self.create_folder,
default_timeout=None,
client_info=client_info,
),
self.delete_folder: gapic_v1.method_async.wrap_method(
self.delete_folder,
default_timeout=None,
client_info=client_info,
),
self.get_folder: gapic_v1.method_async.wrap_method(
self.get_folder,
default_retry=retries.AsyncRetry(
initial=1.0,
maximum=60.0,
multiplier=2,
predicate=retries.if_exception_type(
core_exceptions.DeadlineExceeded,
core_exceptions.InternalServerError,
core_exceptions.ResourceExhausted,
core_exceptions.ServiceUnavailable,
core_exceptions.Unknown,
),
deadline=60.0,
),
default_timeout=60.0,
client_info=client_info,
),
self.list_folders: gapic_v1.method_async.wrap_method(
self.list_folders,
default_retry=retries.AsyncRetry(
initial=1.0,
maximum=60.0,
multiplier=2,
predicate=retries.if_exception_type(
core_exceptions.DeadlineExceeded,
core_exceptions.InternalServerError,
core_exceptions.ResourceExhausted,
core_exceptions.ServiceUnavailable,
core_exceptions.Unknown,
),
deadline=60.0,
),
default_timeout=60.0,
client_info=client_info,
),
self.rename_folder: gapic_v1.method_async.wrap_method(
self.rename_folder,
default_retry=retries.AsyncRetry(
initial=1.0,
maximum=60.0,
multiplier=2,
predicate=retries.if_exception_type(
core_exceptions.DeadlineExceeded,
core_exceptions.InternalServerError,
core_exceptions.ResourceExhausted,
core_exceptions.ServiceUnavailable,
core_exceptions.Unknown,
),
deadline=60.0,
),
default_timeout=60.0,
client_info=client_info,
),
self.get_storage_layout: gapic_v1.method_async.wrap_method(
self.get_storage_layout,
default_retry=retries.AsyncRetry(
initial=1.0,
maximum=60.0,
multiplier=2,
predicate=retries.if_exception_type(
core_exceptions.DeadlineExceeded,
core_exceptions.InternalServerError,
core_exceptions.ResourceExhausted,
core_exceptions.ServiceUnavailable,
core_exceptions.Unknown,
),
deadline=60.0,
),
default_timeout=60.0,
client_info=client_info,
),
self.create_managed_folder: gapic_v1.method_async.wrap_method(
self.create_managed_folder,
default_timeout=None,
client_info=client_info,
),
self.delete_managed_folder: gapic_v1.method_async.wrap_method(
self.delete_managed_folder,
default_timeout=None,
client_info=client_info,
),
self.get_managed_folder: gapic_v1.method_async.wrap_method(
self.get_managed_folder,
default_retry=retries.AsyncRetry(
initial=1.0,
maximum=60.0,
multiplier=2,
predicate=retries.if_exception_type(
core_exceptions.DeadlineExceeded,
core_exceptions.InternalServerError,
core_exceptions.ResourceExhausted,
core_exceptions.ServiceUnavailable,
core_exceptions.Unknown,
),
deadline=60.0,
),
default_timeout=60.0,
client_info=client_info,
),
self.list_managed_folders: gapic_v1.method_async.wrap_method(
self.list_managed_folders,
default_retry=retries.AsyncRetry(
initial=1.0,
maximum=60.0,
multiplier=2,
predicate=retries.if_exception_type(
core_exceptions.DeadlineExceeded,
core_exceptions.InternalServerError,
core_exceptions.ResourceExhausted,
core_exceptions.ServiceUnavailable,
core_exceptions.Unknown,
),
deadline=60.0,
),
default_timeout=60.0,
client_info=client_info,
),
}

def close(self):
return self.grpc_channel.close()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
],
"language": "PYTHON",
"name": "google-cloud-storage-control",
"version": "0.1.3"
"version": "0.1.0"
},
"snippets": [
{
Expand Down
Loading

0 comments on commit ddd1508

Please sign in to comment.