Skip to content

Commit

Permalink
feat: [google-cloud-gdchardwaremanagement] add a DeleteSite method (#…
Browse files Browse the repository at this point in the history
…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>
  • Loading branch information
gcf-owl-bot[bot] and gcf-owl-bot[bot] authored Oct 25, 2024
1 parent 365d55d commit 0846c97
Show file tree
Hide file tree
Showing 24 changed files with 1,846 additions and 112 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@
DeleteHardwareGroupRequest,
DeleteHardwareRequest,
DeleteOrderRequest,
DeleteSiteRequest,
DeleteZoneRequest,
GetChangeLogEntryRequest,
GetCommentRequest,
Expand Down Expand Up @@ -132,6 +133,7 @@
"DeleteHardwareGroupRequest",
"DeleteHardwareRequest",
"DeleteOrderRequest",
"DeleteSiteRequest",
"DeleteZoneRequest",
"GetChangeLogEntryRequest",
"GetCommentRequest",
Expand Down
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.5" # {x-release-please-version}
__version__ = "0.0.0" # {x-release-please-version}
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@
DeleteHardwareGroupRequest,
DeleteHardwareRequest,
DeleteOrderRequest,
DeleteSiteRequest,
DeleteZoneRequest,
GetChangeLogEntryRequest,
GetCommentRequest,
Expand Down Expand Up @@ -108,6 +109,7 @@
"DeleteHardwareGroupRequest",
"DeleteHardwareRequest",
"DeleteOrderRequest",
"DeleteSiteRequest",
"DeleteZoneRequest",
"Dimensions",
"Entity",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,11 @@
"delete_order"
]
},
"DeleteSite": {
"methods": [
"delete_site"
]
},
"DeleteZone": {
"methods": [
"delete_zone"
Expand Down Expand Up @@ -230,6 +235,11 @@
"delete_order"
]
},
"DeleteSite": {
"methods": [
"delete_site"
]
},
"DeleteZone": {
"methods": [
"delete_zone"
Expand Down Expand Up @@ -405,6 +415,11 @@
"delete_order"
]
},
"DeleteSite": {
"methods": [
"delete_site"
]
},
"DeleteZone": {
"methods": [
"delete_zone"
Expand Down
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.5" # {x-release-please-version}
__version__ = "0.0.0" # {x-release-please-version}
Original file line number Diff line number Diff line change
Expand Up @@ -336,6 +336,10 @@ async def sample_list_orders():
Required. The project and location to list orders in.
Format: ``projects/{project}/locations/{location}``
To list orders across all locations, substitute ``-``
(the hyphen or dash character) for the location and
check the unreachable field in the response message.
This corresponds to the ``parent`` field
on the ``request`` instance; if ``request`` is provided, this
should not be set.
Expand Down Expand Up @@ -1100,6 +1104,10 @@ async def sample_list_sites():
Required. The project and location to list sites in.
Format: ``projects/{project}/locations/{location}``
To list sites across all locations, substitute ``-``
(the hyphen or dash character) for the location and
check the unreachable field in the response message.
This corresponds to the ``parent`` field
on the ``request`` instance; if ``request`` is provided, this
should not be set.
Expand Down Expand Up @@ -1311,7 +1319,6 @@ async def sample_create_site():
site.organization_contact.contacts.given_name = "given_name_value"
site.organization_contact.contacts.email = "email_value"
site.organization_contact.contacts.phone = "phone_value"
site.google_maps_pin_uri = "google_maps_pin_uri_value"
request = gdchardwaremanagement_v1alpha.CreateSiteRequest(
parent="parent_value",
Expand Down Expand Up @@ -1462,7 +1469,6 @@ async def sample_update_site():
site.organization_contact.contacts.given_name = "given_name_value"
site.organization_contact.contacts.email = "email_value"
site.organization_contact.contacts.phone = "phone_value"
site.google_maps_pin_uri = "google_maps_pin_uri_value"
request = gdchardwaremanagement_v1alpha.UpdateSiteRequest(
site=site,
Expand Down Expand Up @@ -1570,6 +1576,133 @@ async def sample_update_site():
# Done; return the response.
return response

async def delete_site(
self,
request: Optional[Union[service.DeleteSiteRequest, dict]] = None,
*,
name: Optional[str] = None,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
metadata: Sequence[Tuple[str, str]] = (),
) -> operation_async.AsyncOperation:
r"""Deletes a site.
.. code-block:: python
# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
# client as shown in:
# https://googleapis.dev/python/google-api-core/latest/client_options.html
from google.cloud import gdchardwaremanagement_v1alpha
async def sample_delete_site():
# Create a client
client = gdchardwaremanagement_v1alpha.GDCHardwareManagementAsyncClient()
# Initialize request argument(s)
request = gdchardwaremanagement_v1alpha.DeleteSiteRequest(
name="name_value",
)
# Make the request
operation = client.delete_site(request=request)
print("Waiting for operation to complete...")
response = (await operation).result()
# Handle the response
print(response)
Args:
request (Optional[Union[google.cloud.gdchardwaremanagement_v1alpha.types.DeleteSiteRequest, dict]]):
The request object. A request to delete a site.
name (:class:`str`):
Required. The name of the site. Format:
``projects/{project}/locations/{location}/sites/{site}``
This corresponds to the ``name`` field
on the ``request`` instance; if ``request`` is provided, this
should not be set.
retry (google.api_core.retry_async.AsyncRetry): 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.protobuf.empty_pb2.Empty` A generic empty message that you can re-use to avoid defining duplicated
empty messages in your APIs. A typical example is to
use it as the request or the response type of an API
method. For instance:
service Foo {
rpc Bar(google.protobuf.Empty) returns
(google.protobuf.Empty);
}
"""
# 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."
)

# - Use the request object if provided (there's no risk of modifying the input as
# there are no flattened fields), or create one.
if not isinstance(request, service.DeleteSiteRequest):
request = service.DeleteSiteRequest(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 = self._client._transport._wrapped_methods[
self._client._transport.delete_site
]

# 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),)),
)

# Validate the universe domain.
self._client._validate_universe_domain()

# 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,
empty_pb2.Empty,
metadata_type=service.OperationMetadata,
)

# Done; return the response.
return response

async def list_hardware_groups(
self,
request: Optional[Union[service.ListHardwareGroupsRequest, dict]] = None,
Expand Down Expand Up @@ -2264,6 +2397,10 @@ async def sample_list_hardware():
Required. The project and location to list hardware in.
Format: ``projects/{project}/locations/{location}``
To list hardware across all locations, substitute ``-``
(the hyphen or dash character) for the location and
check the unreachable field in the response message.
This corresponds to the ``parent`` field
on the ``request`` instance; if ``request`` is provided, this
should not be set.
Expand Down Expand Up @@ -3628,6 +3765,10 @@ async def sample_list_skus():
Required. The project and location to list SKUs in.
Format: ``projects/{project}/locations/{location}``
To list SKUs across all locations, substitute ``-`` (the
hyphen or dash character) for the location and check the
unreachable field in the response message.
This corresponds to the ``parent`` field
on the ``request`` instance; if ``request`` is provided, this
should not be set.
Expand Down Expand Up @@ -3851,6 +3992,10 @@ async def sample_list_zones():
Required. The project and location to list zones in.
Format: ``projects/{project}/locations/{location}``
To list zones across all locations, substitute ``-``
(the hyphen or dash character) for the location and
check the unreachable field in the response message.
This corresponds to the ``parent`` field
on the ``request`` instance; if ``request`` is provided, this
should not be set.
Expand Down
Loading

0 comments on commit 0846c97

Please sign in to comment.