Skip to content
This repository has been archived by the owner on Jul 6, 2023. It is now read-only.

Commit

Permalink
feat: Add Provider resources (#109)
Browse files Browse the repository at this point in the history
* feat: Add Provider resources

PiperOrigin-RevId: 449653329

Source-Link: googleapis/googleapis@a167db1

Source-Link: googleapis/googleapis-gen@4183d84
Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiNDE4M2Q4NDIxN2RlYzYzNmRmYzhhY2FjOGQ5OTEzNzlmZmU4NGM3MyJ9

* 🦉 Updates from OwlBot post-processor

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

Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
  • Loading branch information
gcf-owl-bot[bot] and gcf-owl-bot[bot] committed May 19, 2022
1 parent aa8c167 commit 11be2a5
Show file tree
Hide file tree
Showing 19 changed files with 2,215 additions and 22 deletions.
12 changes: 12 additions & 0 deletions google/cloud/eventarc/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@

from google.cloud.eventarc_v1.types.channel import Channel
from google.cloud.eventarc_v1.types.channel_connection import ChannelConnection
from google.cloud.eventarc_v1.types.discovery import EventType
from google.cloud.eventarc_v1.types.discovery import FilteringAttribute
from google.cloud.eventarc_v1.types.discovery import Provider
from google.cloud.eventarc_v1.types.eventarc import CreateChannelConnectionRequest
from google.cloud.eventarc_v1.types.eventarc import CreateChannelRequest
from google.cloud.eventarc_v1.types.eventarc import CreateTriggerRequest
Expand All @@ -27,11 +30,14 @@
from google.cloud.eventarc_v1.types.eventarc import DeleteTriggerRequest
from google.cloud.eventarc_v1.types.eventarc import GetChannelConnectionRequest
from google.cloud.eventarc_v1.types.eventarc import GetChannelRequest
from google.cloud.eventarc_v1.types.eventarc import GetProviderRequest
from google.cloud.eventarc_v1.types.eventarc import GetTriggerRequest
from google.cloud.eventarc_v1.types.eventarc import ListChannelConnectionsRequest
from google.cloud.eventarc_v1.types.eventarc import ListChannelConnectionsResponse
from google.cloud.eventarc_v1.types.eventarc import ListChannelsRequest
from google.cloud.eventarc_v1.types.eventarc import ListChannelsResponse
from google.cloud.eventarc_v1.types.eventarc import ListProvidersRequest
from google.cloud.eventarc_v1.types.eventarc import ListProvidersResponse
from google.cloud.eventarc_v1.types.eventarc import ListTriggersRequest
from google.cloud.eventarc_v1.types.eventarc import ListTriggersResponse
from google.cloud.eventarc_v1.types.eventarc import OperationMetadata
Expand All @@ -50,6 +56,9 @@
"EventarcAsyncClient",
"Channel",
"ChannelConnection",
"EventType",
"FilteringAttribute",
"Provider",
"CreateChannelConnectionRequest",
"CreateChannelRequest",
"CreateTriggerRequest",
Expand All @@ -58,11 +67,14 @@
"DeleteTriggerRequest",
"GetChannelConnectionRequest",
"GetChannelRequest",
"GetProviderRequest",
"GetTriggerRequest",
"ListChannelConnectionsRequest",
"ListChannelConnectionsResponse",
"ListChannelsRequest",
"ListChannelsResponse",
"ListProvidersRequest",
"ListProvidersResponse",
"ListTriggersRequest",
"ListTriggersResponse",
"OperationMetadata",
Expand Down
12 changes: 12 additions & 0 deletions google/cloud/eventarc_v1/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@

from .types.channel import Channel
from .types.channel_connection import ChannelConnection
from .types.discovery import EventType
from .types.discovery import FilteringAttribute
from .types.discovery import Provider
from .types.eventarc import CreateChannelConnectionRequest
from .types.eventarc import CreateChannelRequest
from .types.eventarc import CreateTriggerRequest
Expand All @@ -27,11 +30,14 @@
from .types.eventarc import DeleteTriggerRequest
from .types.eventarc import GetChannelConnectionRequest
from .types.eventarc import GetChannelRequest
from .types.eventarc import GetProviderRequest
from .types.eventarc import GetTriggerRequest
from .types.eventarc import ListChannelConnectionsRequest
from .types.eventarc import ListChannelConnectionsResponse
from .types.eventarc import ListChannelsRequest
from .types.eventarc import ListChannelsResponse
from .types.eventarc import ListProvidersRequest
from .types.eventarc import ListProvidersResponse
from .types.eventarc import ListTriggersRequest
from .types.eventarc import ListTriggersResponse
from .types.eventarc import OperationMetadata
Expand All @@ -58,18 +64,24 @@
"DeleteTriggerRequest",
"Destination",
"EventFilter",
"EventType",
"EventarcClient",
"FilteringAttribute",
"GKE",
"GetChannelConnectionRequest",
"GetChannelRequest",
"GetProviderRequest",
"GetTriggerRequest",
"ListChannelConnectionsRequest",
"ListChannelConnectionsResponse",
"ListChannelsRequest",
"ListChannelsResponse",
"ListProvidersRequest",
"ListProvidersResponse",
"ListTriggersRequest",
"ListTriggersResponse",
"OperationMetadata",
"Provider",
"Pubsub",
"Transport",
"Trigger",
Expand Down
20 changes: 20 additions & 0 deletions google/cloud/eventarc_v1/gapic_metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,11 @@
"get_channel_connection"
]
},
"GetProvider": {
"methods": [
"get_provider"
]
},
"GetTrigger": {
"methods": [
"get_trigger"
Expand All @@ -65,6 +70,11 @@
"list_channels"
]
},
"ListProviders": {
"methods": [
"list_providers"
]
},
"ListTriggers": {
"methods": [
"list_triggers"
Expand Down Expand Up @@ -125,6 +135,11 @@
"get_channel_connection"
]
},
"GetProvider": {
"methods": [
"get_provider"
]
},
"GetTrigger": {
"methods": [
"get_trigger"
Expand All @@ -140,6 +155,11 @@
"list_channels"
]
},
"ListProviders": {
"methods": [
"list_providers"
]
},
"ListTriggers": {
"methods": [
"list_triggers"
Expand Down
205 changes: 205 additions & 0 deletions google/cloud/eventarc_v1/services/eventarc/async_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
from google.cloud.eventarc_v1.types import channel as gce_channel
from google.cloud.eventarc_v1.types import channel_connection
from google.cloud.eventarc_v1.types import channel_connection as gce_channel_connection
from google.cloud.eventarc_v1.types import discovery
from google.cloud.eventarc_v1.types import eventarc
from google.cloud.eventarc_v1.types import trigger
from google.cloud.eventarc_v1.types import trigger as gce_trigger
Expand Down Expand Up @@ -67,6 +68,8 @@ class EventarcAsyncClient:
)
cloud_function_path = staticmethod(EventarcClient.cloud_function_path)
parse_cloud_function_path = staticmethod(EventarcClient.parse_cloud_function_path)
provider_path = staticmethod(EventarcClient.provider_path)
parse_provider_path = staticmethod(EventarcClient.parse_provider_path)
service_path = staticmethod(EventarcClient.service_path)

service_account_path = staticmethod(EventarcClient.service_account_path)
Expand Down Expand Up @@ -1402,6 +1405,208 @@ async def sample_delete_channel():
# Done; return the response.
return response

async def get_provider(
self,
request: Union[eventarc.GetProviderRequest, dict] = None,
*,
name: str = None,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: float = None,
metadata: Sequence[Tuple[str, str]] = (),
) -> discovery.Provider:
r"""Get a single Provider.
.. code-block:: python
from google.cloud import eventarc_v1
async def sample_get_provider():
# Create a client
client = eventarc_v1.EventarcAsyncClient()
# Initialize request argument(s)
request = eventarc_v1.GetProviderRequest(
name="name_value",
)
# Make the request
response = await client.get_provider(request=request)
# Handle the response
print(response)
Args:
request (Union[google.cloud.eventarc_v1.types.GetProviderRequest, dict]):
The request object. The request message for the
GetProvider method.
name (:class:`str`):
Required. The name of the provider to
get.
This corresponds to the ``name`` field
on the ``request`` instance; if ``request`` is provided, this
should not be set.
retry (google.api_core.retry.Retry): 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.
Returns:
google.cloud.eventarc_v1.types.Provider:
A representation of the Provider
resource.
"""
# Create or coerce a protobuf request object.
# Quick check: If we got a request object, we should *not* have
# gotten any keyword arguments that map to the request.
has_flattened_params = any([name])
if request is not None and has_flattened_params:
raise ValueError(
"If the `request` argument is set, then none of "
"the individual field arguments should be set."
)

request = eventarc.GetProviderRequest(request)

# If we have keyword arguments corresponding to fields on the
# request, apply these.
if name is not None:
request.name = name

# Wrap the RPC method; this adds retry and timeout information,
# and friendly error handling.
rpc = gapic_v1.method_async.wrap_method(
self._client._transport.get_provider,
default_timeout=None,
client_info=DEFAULT_CLIENT_INFO,
)

# Certain fields should be provided within the metadata header;
# add these here.
metadata = tuple(metadata) + (
gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)),
)

# Send the request.
response = await rpc(
request,
retry=retry,
timeout=timeout,
metadata=metadata,
)

# Done; return the response.
return response

async def list_providers(
self,
request: Union[eventarc.ListProvidersRequest, dict] = None,
*,
parent: str = None,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: float = None,
metadata: Sequence[Tuple[str, str]] = (),
) -> pagers.ListProvidersAsyncPager:
r"""List providers.
.. code-block:: python
from google.cloud import eventarc_v1
async def sample_list_providers():
# Create a client
client = eventarc_v1.EventarcAsyncClient()
# Initialize request argument(s)
request = eventarc_v1.ListProvidersRequest(
parent="parent_value",
)
# Make the request
page_result = client.list_providers(request=request)
# Handle the response
async for response in page_result:
print(response)
Args:
request (Union[google.cloud.eventarc_v1.types.ListProvidersRequest, dict]):
The request object. The request message for the
ListProviders method.
parent (:class:`str`):
Required. The parent of the provider
to get.
This corresponds to the ``parent`` field
on the ``request`` instance; if ``request`` is provided, this
should not be set.
retry (google.api_core.retry.Retry): 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.
Returns:
google.cloud.eventarc_v1.services.eventarc.pagers.ListProvidersAsyncPager:
The response message for the ListProviders method.
Iterating over this object will yield results and
resolve additional pages automatically.
"""
# Create or coerce a protobuf request object.
# Quick check: If we got a request object, we should *not* have
# gotten any keyword arguments that map to the request.
has_flattened_params = any([parent])
if request is not None and has_flattened_params:
raise ValueError(
"If the `request` argument is set, then none of "
"the individual field arguments should be set."
)

request = eventarc.ListProvidersRequest(request)

# If we have keyword arguments corresponding to fields on the
# request, apply these.
if parent is not None:
request.parent = parent

# Wrap the RPC method; this adds retry and timeout information,
# and friendly error handling.
rpc = gapic_v1.method_async.wrap_method(
self._client._transport.list_providers,
default_timeout=None,
client_info=DEFAULT_CLIENT_INFO,
)

# Certain fields should be provided within the metadata header;
# add these here.
metadata = tuple(metadata) + (
gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)),
)

# Send the request.
response = await rpc(
request,
retry=retry,
timeout=timeout,
metadata=metadata,
)

# This method is paged; wrap the response in a pager, which provides
# an `__aiter__` convenience method.
response = pagers.ListProvidersAsyncPager(
method=rpc,
request=request,
response=response,
metadata=metadata,
)

# Done; return the response.
return response

async def get_channel_connection(
self,
request: Union[eventarc.GetChannelConnectionRequest, dict] = None,
Expand Down
Loading

0 comments on commit 11be2a5

Please sign in to comment.