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

Commit

Permalink
fix: Remove ActivateSpoke and DeactivateSpoke methods (#69)
Browse files Browse the repository at this point in the history
- [ ] Regenerate this pull request now.

PiperOrigin-RevId: 392500501

Source-Link: googleapis/googleapis@d06d94e

Source-Link: https://github.com/googleapis/googleapis-gen/commit/b368af0aabeac99dfd7c267950a412e2c1eaca11

feat: Add hub.routing_vpcs field 
docs: Specify that site_to_site_data_transfer field must be set to true
  • Loading branch information
gcf-owl-bot[bot] authored Aug 25, 2021
1 parent 2493693 commit 3fd21d4
Show file tree
Hide file tree
Showing 13 changed files with 109 additions and 1,050 deletions.
6 changes: 2 additions & 4 deletions google/cloud/networkconnectivity/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,8 @@
)

from google.cloud.networkconnectivity_v1.types.common import OperationMetadata
from google.cloud.networkconnectivity_v1.types.hub import ActivateSpokeRequest
from google.cloud.networkconnectivity_v1.types.hub import CreateHubRequest
from google.cloud.networkconnectivity_v1.types.hub import CreateSpokeRequest
from google.cloud.networkconnectivity_v1.types.hub import DeactivateSpokeRequest
from google.cloud.networkconnectivity_v1.types.hub import DeleteHubRequest
from google.cloud.networkconnectivity_v1.types.hub import DeleteSpokeRequest
from google.cloud.networkconnectivity_v1.types.hub import GetHubRequest
Expand All @@ -39,6 +37,7 @@
from google.cloud.networkconnectivity_v1.types.hub import ListSpokesRequest
from google.cloud.networkconnectivity_v1.types.hub import ListSpokesResponse
from google.cloud.networkconnectivity_v1.types.hub import RouterApplianceInstance
from google.cloud.networkconnectivity_v1.types.hub import RoutingVPC
from google.cloud.networkconnectivity_v1.types.hub import Spoke
from google.cloud.networkconnectivity_v1.types.hub import UpdateHubRequest
from google.cloud.networkconnectivity_v1.types.hub import UpdateSpokeRequest
Expand All @@ -48,10 +47,8 @@
"HubServiceClient",
"HubServiceAsyncClient",
"OperationMetadata",
"ActivateSpokeRequest",
"CreateHubRequest",
"CreateSpokeRequest",
"DeactivateSpokeRequest",
"DeleteHubRequest",
"DeleteSpokeRequest",
"GetHubRequest",
Expand All @@ -65,6 +62,7 @@
"ListSpokesRequest",
"ListSpokesResponse",
"RouterApplianceInstance",
"RoutingVPC",
"Spoke",
"UpdateHubRequest",
"UpdateSpokeRequest",
Expand Down
6 changes: 2 additions & 4 deletions google/cloud/networkconnectivity_v1/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,8 @@
from .services.hub_service import HubServiceAsyncClient

from .types.common import OperationMetadata
from .types.hub import ActivateSpokeRequest
from .types.hub import CreateHubRequest
from .types.hub import CreateSpokeRequest
from .types.hub import DeactivateSpokeRequest
from .types.hub import DeleteHubRequest
from .types.hub import DeleteSpokeRequest
from .types.hub import GetHubRequest
Expand All @@ -35,17 +33,16 @@
from .types.hub import ListSpokesRequest
from .types.hub import ListSpokesResponse
from .types.hub import RouterApplianceInstance
from .types.hub import RoutingVPC
from .types.hub import Spoke
from .types.hub import UpdateHubRequest
from .types.hub import UpdateSpokeRequest
from .types.hub import State

__all__ = (
"HubServiceAsyncClient",
"ActivateSpokeRequest",
"CreateHubRequest",
"CreateSpokeRequest",
"DeactivateSpokeRequest",
"DeleteHubRequest",
"DeleteSpokeRequest",
"GetHubRequest",
Expand All @@ -61,6 +58,7 @@
"ListSpokesResponse",
"OperationMetadata",
"RouterApplianceInstance",
"RoutingVPC",
"Spoke",
"State",
"UpdateHubRequest",
Expand Down
20 changes: 0 additions & 20 deletions google/cloud/networkconnectivity_v1/gapic_metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,6 @@
"grpc": {
"libraryClient": "HubServiceClient",
"rpcs": {
"ActivateSpoke": {
"methods": [
"activate_spoke"
]
},
"CreateHub": {
"methods": [
"create_hub"
Expand All @@ -25,11 +20,6 @@
"create_spoke"
]
},
"DeactivateSpoke": {
"methods": [
"deactivate_spoke"
]
},
"DeleteHub": {
"methods": [
"delete_hub"
Expand Down Expand Up @@ -75,11 +65,6 @@
"grpc-async": {
"libraryClient": "HubServiceAsyncClient",
"rpcs": {
"ActivateSpoke": {
"methods": [
"activate_spoke"
]
},
"CreateHub": {
"methods": [
"create_hub"
Expand All @@ -90,11 +75,6 @@
"create_spoke"
]
},
"DeactivateSpoke": {
"methods": [
"deactivate_spoke"
]
},
"DeleteHub": {
"methods": [
"delete_hub"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,8 @@ class HubServiceAsyncClient:
parse_interconnect_attachment_path = staticmethod(
HubServiceClient.parse_interconnect_attachment_path
)
network_path = staticmethod(HubServiceClient.network_path)
parse_network_path = staticmethod(HubServiceClient.parse_network_path)
spoke_path = staticmethod(HubServiceClient.spoke_path)
parse_spoke_path = staticmethod(HubServiceClient.parse_spoke_path)
vpn_tunnel_path = staticmethod(HubServiceClient.vpn_tunnel_path)
Expand Down Expand Up @@ -999,189 +1001,6 @@ async def update_spoke(
# Done; return the response.
return response

async def deactivate_spoke(
self,
request: hub.DeactivateSpokeRequest = None,
*,
name: str = None,
retry: retries.Retry = gapic_v1.method.DEFAULT,
timeout: float = None,
metadata: Sequence[Tuple[str, str]] = (),
) -> operation_async.AsyncOperation:
r"""Deactivates the specified spoke. Deactivating keeps
the spoke information for future re-activation, but
disconnects the Google Cloud network from non-Google-
Cloud network.
Args:
request (:class:`google.cloud.networkconnectivity_v1.types.DeactivateSpokeRequest`):
The request object. The request for
[HubService.DeactivateSpoke][google.cloud.networkconnectivity.v1.HubService.DeactivateSpoke].
name (:class:`str`):
Required. The name of the spoke to
deactivate.
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.api_core.operation_async.AsyncOperation:
An object representing a long-running operation.
The result type for the operation will be :class:`google.cloud.networkconnectivity_v1.types.Spoke` A spoke represents a connection between your Google Cloud network resources
and a non-Google-Cloud network.
When you create a spoke, you associate it with a hub.
You must also identify a value for exactly one of the
following fields:
- linked_vpn_tunnels
- linked_interconnect_attachments
- linked_router_appliance_instances
"""
# Create or coerce a protobuf request object.
# Sanity 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 = hub.DeactivateSpokeRequest(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.deactivate_spoke,
default_timeout=60.0,
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,)

# Wrap the response in an operation future.
response = operation_async.from_gapic(
response,
self._client._transport.operations_client,
hub.Spoke,
metadata_type=common.OperationMetadata,
)

# Done; return the response.
return response

async def activate_spoke(
self,
request: hub.ActivateSpokeRequest = None,
*,
name: str = None,
retry: retries.Retry = gapic_v1.method.DEFAULT,
timeout: float = None,
metadata: Sequence[Tuple[str, str]] = (),
) -> operation_async.AsyncOperation:
r"""Activates the specified spoke. Activating reconnects
the Google Cloud network with the non-Google-Cloud
network.
Args:
request (:class:`google.cloud.networkconnectivity_v1.types.ActivateSpokeRequest`):
The request object. The request for
[HubService.ActivateSpoke][google.cloud.networkconnectivity.v1.HubService.ActivateSpoke].
name (:class:`str`):
Required. The name of the spoke to
activate.
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.api_core.operation_async.AsyncOperation:
An object representing a long-running operation.
The result type for the operation will be :class:`google.cloud.networkconnectivity_v1.types.Spoke` A spoke represents a connection between your Google Cloud network resources
and a non-Google-Cloud network.
When you create a spoke, you associate it with a hub.
You must also identify a value for exactly one of the
following fields:
- linked_vpn_tunnels
- linked_interconnect_attachments
- linked_router_appliance_instances
"""
# Create or coerce a protobuf request object.
# Sanity 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 = hub.ActivateSpokeRequest(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.activate_spoke,
default_timeout=60.0,
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,)

# Wrap the response in an operation future.
response = operation_async.from_gapic(
response,
self._client._transport.operations_client,
hub.Spoke,
metadata_type=common.OperationMetadata,
)

# Done; return the response.
return response

async def delete_spoke(
self,
request: hub.DeleteSpokeRequest = None,
Expand Down
Loading

0 comments on commit 3fd21d4

Please sign in to comment.