Skip to content

Commit 0846c97

Browse files
feat: [google-cloud-gdchardwaremanagement] add a DeleteSite method (#13215)
- [ ] Regenerate this pull request now. BEGIN_COMMIT_OVERRIDE feat: add a DeleteSite method feat: add MAC address and disk info to the Hardware resource docs: annotate rack_location field as required; this was always enforced END_COMMIT_OVERRIDE PiperOrigin-RevId: 689565044 Source-Link: googleapis/googleapis@17aef37 Source-Link: googleapis/googleapis-gen@856b1e6 Copy-Tag: eyJwIjoicGFja2FnZXMvZ29vZ2xlLWNsb3VkLWdkY2hhcmR3YXJlbWFuYWdlbWVudC8uT3dsQm90LnlhbWwiLCJoIjoiODU2YjFlNjE2Yzc1YWY0MWY1ODVlZDExYWVmOWE2OTNhNWU5ZDhlNSJ9 --------- Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
1 parent 365d55d commit 0846c97

24 files changed

Lines changed: 1846 additions & 112 deletions

packages/google-cloud-gdchardwaremanagement/google/cloud/gdchardwaremanagement/__init__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@
6060
DeleteHardwareGroupRequest,
6161
DeleteHardwareRequest,
6262
DeleteOrderRequest,
63+
DeleteSiteRequest,
6364
DeleteZoneRequest,
6465
GetChangeLogEntryRequest,
6566
GetCommentRequest,
@@ -132,6 +133,7 @@
132133
"DeleteHardwareGroupRequest",
133134
"DeleteHardwareRequest",
134135
"DeleteOrderRequest",
136+
"DeleteSiteRequest",
135137
"DeleteZoneRequest",
136138
"GetChangeLogEntryRequest",
137139
"GetCommentRequest",

packages/google-cloud-gdchardwaremanagement/google/cloud/gdchardwaremanagement/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.5" # {x-release-please-version}
16+
__version__ = "0.0.0" # {x-release-please-version}

packages/google-cloud-gdchardwaremanagement/google/cloud/gdchardwaremanagement_v1alpha/__init__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@
5858
DeleteHardwareGroupRequest,
5959
DeleteHardwareRequest,
6060
DeleteOrderRequest,
61+
DeleteSiteRequest,
6162
DeleteZoneRequest,
6263
GetChangeLogEntryRequest,
6364
GetCommentRequest,
@@ -108,6 +109,7 @@
108109
"DeleteHardwareGroupRequest",
109110
"DeleteHardwareRequest",
110111
"DeleteOrderRequest",
112+
"DeleteSiteRequest",
111113
"DeleteZoneRequest",
112114
"Dimensions",
113115
"Entity",

packages/google-cloud-gdchardwaremanagement/google/cloud/gdchardwaremanagement_v1alpha/gapic_metadata.json

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,11 @@
5555
"delete_order"
5656
]
5757
},
58+
"DeleteSite": {
59+
"methods": [
60+
"delete_site"
61+
]
62+
},
5863
"DeleteZone": {
5964
"methods": [
6065
"delete_zone"
@@ -230,6 +235,11 @@
230235
"delete_order"
231236
]
232237
},
238+
"DeleteSite": {
239+
"methods": [
240+
"delete_site"
241+
]
242+
},
233243
"DeleteZone": {
234244
"methods": [
235245
"delete_zone"
@@ -405,6 +415,11 @@
405415
"delete_order"
406416
]
407417
},
418+
"DeleteSite": {
419+
"methods": [
420+
"delete_site"
421+
]
422+
},
408423
"DeleteZone": {
409424
"methods": [
410425
"delete_zone"

packages/google-cloud-gdchardwaremanagement/google/cloud/gdchardwaremanagement_v1alpha/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.5" # {x-release-please-version}
16+
__version__ = "0.0.0" # {x-release-please-version}

packages/google-cloud-gdchardwaremanagement/google/cloud/gdchardwaremanagement_v1alpha/services/gdc_hardware_management/async_client.py

Lines changed: 147 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -336,6 +336,10 @@ async def sample_list_orders():
336336
Required. The project and location to list orders in.
337337
Format: ``projects/{project}/locations/{location}``
338338
339+
To list orders across all locations, substitute ``-``
340+
(the hyphen or dash character) for the location and
341+
check the unreachable field in the response message.
342+
339343
This corresponds to the ``parent`` field
340344
on the ``request`` instance; if ``request`` is provided, this
341345
should not be set.
@@ -1100,6 +1104,10 @@ async def sample_list_sites():
11001104
Required. The project and location to list sites in.
11011105
Format: ``projects/{project}/locations/{location}``
11021106
1107+
To list sites across all locations, substitute ``-``
1108+
(the hyphen or dash character) for the location and
1109+
check the unreachable field in the response message.
1110+
11031111
This corresponds to the ``parent`` field
11041112
on the ``request`` instance; if ``request`` is provided, this
11051113
should not be set.
@@ -1311,7 +1319,6 @@ async def sample_create_site():
13111319
site.organization_contact.contacts.given_name = "given_name_value"
13121320
site.organization_contact.contacts.email = "email_value"
13131321
site.organization_contact.contacts.phone = "phone_value"
1314-
site.google_maps_pin_uri = "google_maps_pin_uri_value"
13151322
13161323
request = gdchardwaremanagement_v1alpha.CreateSiteRequest(
13171324
parent="parent_value",
@@ -1462,7 +1469,6 @@ async def sample_update_site():
14621469
site.organization_contact.contacts.given_name = "given_name_value"
14631470
site.organization_contact.contacts.email = "email_value"
14641471
site.organization_contact.contacts.phone = "phone_value"
1465-
site.google_maps_pin_uri = "google_maps_pin_uri_value"
14661472
14671473
request = gdchardwaremanagement_v1alpha.UpdateSiteRequest(
14681474
site=site,
@@ -1570,6 +1576,133 @@ async def sample_update_site():
15701576
# Done; return the response.
15711577
return response
15721578

1579+
async def delete_site(
1580+
self,
1581+
request: Optional[Union[service.DeleteSiteRequest, dict]] = None,
1582+
*,
1583+
name: Optional[str] = None,
1584+
retry: OptionalRetry = gapic_v1.method.DEFAULT,
1585+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
1586+
metadata: Sequence[Tuple[str, str]] = (),
1587+
) -> operation_async.AsyncOperation:
1588+
r"""Deletes a site.
1589+
1590+
.. code-block:: python
1591+
1592+
# This snippet has been automatically generated and should be regarded as a
1593+
# code template only.
1594+
# It will require modifications to work:
1595+
# - It may require correct/in-range values for request initialization.
1596+
# - It may require specifying regional endpoints when creating the service
1597+
# client as shown in:
1598+
# https://googleapis.dev/python/google-api-core/latest/client_options.html
1599+
from google.cloud import gdchardwaremanagement_v1alpha
1600+
1601+
async def sample_delete_site():
1602+
# Create a client
1603+
client = gdchardwaremanagement_v1alpha.GDCHardwareManagementAsyncClient()
1604+
1605+
# Initialize request argument(s)
1606+
request = gdchardwaremanagement_v1alpha.DeleteSiteRequest(
1607+
name="name_value",
1608+
)
1609+
1610+
# Make the request
1611+
operation = client.delete_site(request=request)
1612+
1613+
print("Waiting for operation to complete...")
1614+
1615+
response = (await operation).result()
1616+
1617+
# Handle the response
1618+
print(response)
1619+
1620+
Args:
1621+
request (Optional[Union[google.cloud.gdchardwaremanagement_v1alpha.types.DeleteSiteRequest, dict]]):
1622+
The request object. A request to delete a site.
1623+
name (:class:`str`):
1624+
Required. The name of the site. Format:
1625+
``projects/{project}/locations/{location}/sites/{site}``
1626+
1627+
This corresponds to the ``name`` field
1628+
on the ``request`` instance; if ``request`` is provided, this
1629+
should not be set.
1630+
retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any,
1631+
should be retried.
1632+
timeout (float): The timeout for this request.
1633+
metadata (Sequence[Tuple[str, str]]): Strings which should be
1634+
sent along with the request as metadata.
1635+
1636+
Returns:
1637+
google.api_core.operation_async.AsyncOperation:
1638+
An object representing a long-running operation.
1639+
1640+
The result type for the operation will be :class:`google.protobuf.empty_pb2.Empty` A generic empty message that you can re-use to avoid defining duplicated
1641+
empty messages in your APIs. A typical example is to
1642+
use it as the request or the response type of an API
1643+
method. For instance:
1644+
1645+
service Foo {
1646+
rpc Bar(google.protobuf.Empty) returns
1647+
(google.protobuf.Empty);
1648+
1649+
}
1650+
1651+
"""
1652+
# Create or coerce a protobuf request object.
1653+
# - Quick check: If we got a request object, we should *not* have
1654+
# gotten any keyword arguments that map to the request.
1655+
has_flattened_params = any([name])
1656+
if request is not None and has_flattened_params:
1657+
raise ValueError(
1658+
"If the `request` argument is set, then none of "
1659+
"the individual field arguments should be set."
1660+
)
1661+
1662+
# - Use the request object if provided (there's no risk of modifying the input as
1663+
# there are no flattened fields), or create one.
1664+
if not isinstance(request, service.DeleteSiteRequest):
1665+
request = service.DeleteSiteRequest(request)
1666+
1667+
# If we have keyword arguments corresponding to fields on the
1668+
# request, apply these.
1669+
if name is not None:
1670+
request.name = name
1671+
1672+
# Wrap the RPC method; this adds retry and timeout information,
1673+
# and friendly error handling.
1674+
rpc = self._client._transport._wrapped_methods[
1675+
self._client._transport.delete_site
1676+
]
1677+
1678+
# Certain fields should be provided within the metadata header;
1679+
# add these here.
1680+
metadata = tuple(metadata) + (
1681+
gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)),
1682+
)
1683+
1684+
# Validate the universe domain.
1685+
self._client._validate_universe_domain()
1686+
1687+
# Send the request.
1688+
response = await rpc(
1689+
request,
1690+
retry=retry,
1691+
timeout=timeout,
1692+
metadata=metadata,
1693+
)
1694+
1695+
# Wrap the response in an operation future.
1696+
response = operation_async.from_gapic(
1697+
response,
1698+
self._client._transport.operations_client,
1699+
empty_pb2.Empty,
1700+
metadata_type=service.OperationMetadata,
1701+
)
1702+
1703+
# Done; return the response.
1704+
return response
1705+
15731706
async def list_hardware_groups(
15741707
self,
15751708
request: Optional[Union[service.ListHardwareGroupsRequest, dict]] = None,
@@ -2264,6 +2397,10 @@ async def sample_list_hardware():
22642397
Required. The project and location to list hardware in.
22652398
Format: ``projects/{project}/locations/{location}``
22662399
2400+
To list hardware across all locations, substitute ``-``
2401+
(the hyphen or dash character) for the location and
2402+
check the unreachable field in the response message.
2403+
22672404
This corresponds to the ``parent`` field
22682405
on the ``request`` instance; if ``request`` is provided, this
22692406
should not be set.
@@ -3628,6 +3765,10 @@ async def sample_list_skus():
36283765
Required. The project and location to list SKUs in.
36293766
Format: ``projects/{project}/locations/{location}``
36303767
3768+
To list SKUs across all locations, substitute ``-`` (the
3769+
hyphen or dash character) for the location and check the
3770+
unreachable field in the response message.
3771+
36313772
This corresponds to the ``parent`` field
36323773
on the ``request`` instance; if ``request`` is provided, this
36333774
should not be set.
@@ -3851,6 +3992,10 @@ async def sample_list_zones():
38513992
Required. The project and location to list zones in.
38523993
Format: ``projects/{project}/locations/{location}``
38533994
3995+
To list zones across all locations, substitute ``-``
3996+
(the hyphen or dash character) for the location and
3997+
check the unreachable field in the response message.
3998+
38543999
This corresponds to the ``parent`` field
38554000
on the ``request`` instance; if ``request`` is provided, this
38564001
should not be set.

0 commit comments

Comments
 (0)