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

Commit

Permalink
docs(v1beta1): Update analyzeWorkloadMove documentation (#190)
Browse files Browse the repository at this point in the history
fix(v1beta1): Removed `restrict_allowed_services`, `RestrictAllowedServicesRequest`, `RestrictAllowedServicesResponse`

- [ ] Regenerate this pull request now.

Committer: @ketanbshah
PiperOrigin-RevId: 469606602

Source-Link: googleapis/googleapis@32d2f9b

Source-Link: googleapis/googleapis-gen@f87e852
Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiZjg3ZTg1MjAxMzY2NDBmNzY4Y2MyZTQyZDljNTZjYTRkZWYyMjlmNCJ9
  • Loading branch information
gcf-owl-bot[bot] committed Aug 24, 2022
1 parent d9e32b8 commit b07a36a
Show file tree
Hide file tree
Showing 16 changed files with 87 additions and 697 deletions.
4 changes: 0 additions & 4 deletions google/cloud/assuredworkloads_v1beta1/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,6 @@
from .types.assuredworkloads import ListWorkloadsResponse
from .types.assuredworkloads import RestrictAllowedResourcesRequest
from .types.assuredworkloads import RestrictAllowedResourcesResponse
from .types.assuredworkloads import RestrictAllowedServicesRequest
from .types.assuredworkloads import RestrictAllowedServicesResponse
from .types.assuredworkloads import UpdateWorkloadRequest
from .types.assuredworkloads import Workload

Expand All @@ -45,8 +43,6 @@
"ListWorkloadsResponse",
"RestrictAllowedResourcesRequest",
"RestrictAllowedResourcesResponse",
"RestrictAllowedServicesRequest",
"RestrictAllowedServicesResponse",
"UpdateWorkloadRequest",
"Workload",
)
10 changes: 0 additions & 10 deletions google/cloud/assuredworkloads_v1beta1/gapic_metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,6 @@
"restrict_allowed_resources"
]
},
"RestrictAllowedServices": {
"methods": [
"restrict_allowed_services"
]
},
"UpdateWorkload": {
"methods": [
"update_workload"
Expand Down Expand Up @@ -85,11 +80,6 @@
"restrict_allowed_resources"
]
},
"RestrictAllowedServices": {
"methods": [
"restrict_allowed_services"
]
},
"UpdateWorkload": {
"methods": [
"update_workload"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@ async def sample_create_workload():
# Initialize request argument(s)
workload = assuredworkloads_v1beta1.Workload()
workload.display_name = "display_name_value"
workload.compliance_regime = "ITAR"
workload.compliance_regime = "AU_REGIONS_AND_US_SUPPORT"
request = assuredworkloads_v1beta1.CreateWorkloadRequest(
parent="parent_value",
Expand Down Expand Up @@ -364,7 +364,7 @@ async def sample_update_workload():
# Initialize request argument(s)
workload = assuredworkloads_v1beta1.Workload()
workload.display_name = "display_name_value"
workload.compliance_regime = "ITAR"
workload.compliance_regime = "AU_REGIONS_AND_US_SUPPORT"
request = assuredworkloads_v1beta1.UpdateWorkloadRequest(
workload=workload,
Expand Down Expand Up @@ -435,89 +435,6 @@ async def sample_update_workload():
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(
(("workload.name", request.workload.name),)
),
)

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

# Done; return the response.
return response

async def restrict_allowed_services(
self,
request: Union[assuredworkloads.RestrictAllowedServicesRequest, dict] = None,
*,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: float = None,
metadata: Sequence[Tuple[str, str]] = (),
) -> assuredworkloads.RestrictAllowedServicesResponse:
r"""Restrict the list of services allowed in the Workload
environment. The current list of allowed services can be
found at
https://cloud.google.com/assured-workloads/docs/supported-products
In addition to assuredworkloads.workload.update
permission, the user should also have
orgpolicy.policy.set permission on the folder resource
to use this functionality.
.. code-block:: python
from google.cloud import assuredworkloads_v1beta1
async def sample_restrict_allowed_services():
# Create a client
client = assuredworkloads_v1beta1.AssuredWorkloadsServiceAsyncClient()
# Initialize request argument(s)
request = assuredworkloads_v1beta1.RestrictAllowedServicesRequest(
name="name_value",
restriction_type="ALLOW_COMPLIANT_SERVICES",
)
# Make the request
response = await client.restrict_allowed_services(request=request)
# Handle the response
print(response)
Args:
request (Union[google.cloud.assuredworkloads_v1beta1.types.RestrictAllowedServicesRequest, dict]):
The request object. Request for restricting list of
available services in Workload environment.
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.assuredworkloads_v1beta1.types.RestrictAllowedServicesResponse:
Response for restricting the list of
allowed services.
"""
# Create or coerce a protobuf request object.
request = assuredworkloads.RestrictAllowedServicesRequest(request)

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

# Send the request.
response = await rpc(
request,
Expand Down Expand Up @@ -819,8 +736,9 @@ async def analyze_workload_move(
timeout: float = None,
metadata: Sequence[Tuple[str, str]] = (),
) -> assuredworkloads.AnalyzeWorkloadMoveResponse:
r"""Analyze if the source Assured Workloads can be moved
to the target Assured Workload
r"""A request to analyze a hypothetical move of a source
project or project-based workload to a target
(destination) folder-based workload.
.. code-block:: python
Expand All @@ -844,27 +762,29 @@ async def sample_analyze_workload_move():
Args:
request (Union[google.cloud.assuredworkloads_v1beta1.types.AnalyzeWorkloadMoveRequest, dict]):
The request object. Request to check if source workload
can be moved to target workload.
The request object. A request to analyze a hypothetical
move of a source project or project-based workload to a
target (destination) folder-based workload.
project (:class:`str`):
The Source is a project based to be moved. This is the
project's relative path in the API, formatted as
"cloudresourcemanager.googleapis.com/projects/{project_number}"
"projects/{project_number}"
"cloudresourcemanager.googleapis.com/projects/{project_id}"
"projects/{project_id}" For example,
"organizations/123/locations/us-east1/workloads/assured-workload-1".
The source type is a project. Specify the project's
relative resource name, formatted as either a project
number or a project ID: "projects/{PROJECT_NUMBER}" or
"projects/{PROJECT_ID}" For example:
"projects/951040570662" when specifying a project
number, or "projects/my-project-123" when specifying a
project ID.
This corresponds to the ``project`` field
on the ``request`` instance; if ``request`` is provided, this
should not be set.
target (:class:`str`):
Required. The resource name of the Workload to fetch.
This is the workloads's relative path in the API,
formatted as
"organizations/{organization_id}/locations/{location_id}/workloads/{workload_id}".
For example,
"organizations/123/locations/us-east1/workloads/assured-workload-2".
Required. The resource ID of the folder-based
destination workload. This workload is where the source
project will hypothetically be moved to. Specify the
workload's relative resource name, formatted as:
"organizations/{ORGANIZATION_ID}/locations/{LOCATION_ID}/workloads/{WORKLOAD_ID}"
For example:
"organizations/123/locations/us-east1/workloads/assured-workload-2"
This corresponds to the ``target`` field
on the ``request`` instance; if ``request`` is provided, this
Expand All @@ -877,9 +797,8 @@ async def sample_analyze_workload_move():
Returns:
google.cloud.assuredworkloads_v1beta1.types.AnalyzeWorkloadMoveResponse:
Response with the analysis if the
source workload can be moved to the
target workload
A response that includes the analysis
of the hypothetical resource move.
"""
# Create or coerce a protobuf request object.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -457,7 +457,7 @@ def sample_create_workload():
# Initialize request argument(s)
workload = assuredworkloads_v1beta1.Workload()
workload.display_name = "display_name_value"
workload.compliance_regime = "ITAR"
workload.compliance_regime = "AU_REGIONS_AND_US_SUPPORT"
request = assuredworkloads_v1beta1.CreateWorkloadRequest(
parent="parent_value",
Expand Down Expand Up @@ -582,7 +582,7 @@ def sample_update_workload():
# Initialize request argument(s)
workload = assuredworkloads_v1beta1.Workload()
workload.display_name = "display_name_value"
workload.compliance_regime = "ITAR"
workload.compliance_regime = "AU_REGIONS_AND_US_SUPPORT"
request = assuredworkloads_v1beta1.UpdateWorkloadRequest(
workload=workload,
Expand Down Expand Up @@ -653,92 +653,6 @@ def sample_update_workload():
# and friendly error handling.
rpc = self._transport._wrapped_methods[self._transport.update_workload]

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

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

# Done; return the response.
return response

def restrict_allowed_services(
self,
request: Union[assuredworkloads.RestrictAllowedServicesRequest, dict] = None,
*,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: float = None,
metadata: Sequence[Tuple[str, str]] = (),
) -> assuredworkloads.RestrictAllowedServicesResponse:
r"""Restrict the list of services allowed in the Workload
environment. The current list of allowed services can be
found at
https://cloud.google.com/assured-workloads/docs/supported-products
In addition to assuredworkloads.workload.update
permission, the user should also have
orgpolicy.policy.set permission on the folder resource
to use this functionality.
.. code-block:: python
from google.cloud import assuredworkloads_v1beta1
def sample_restrict_allowed_services():
# Create a client
client = assuredworkloads_v1beta1.AssuredWorkloadsServiceClient()
# Initialize request argument(s)
request = assuredworkloads_v1beta1.RestrictAllowedServicesRequest(
name="name_value",
restriction_type="ALLOW_COMPLIANT_SERVICES",
)
# Make the request
response = client.restrict_allowed_services(request=request)
# Handle the response
print(response)
Args:
request (Union[google.cloud.assuredworkloads_v1beta1.types.RestrictAllowedServicesRequest, dict]):
The request object. Request for restricting list of
available services in Workload environment.
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.assuredworkloads_v1beta1.types.RestrictAllowedServicesResponse:
Response for restricting the list of
allowed services.
"""
# Create or coerce a protobuf request object.
# Minor optimization to avoid making a copy if the user passes
# in a assuredworkloads.RestrictAllowedServicesRequest.
# There's no risk of modifying the input as we've already verified
# there are no flattened fields.
if not isinstance(request, assuredworkloads.RestrictAllowedServicesRequest):
request = assuredworkloads.RestrictAllowedServicesRequest(request)

# Wrap the RPC method; this adds retry and timeout information,
# and friendly error handling.
rpc = self._transport._wrapped_methods[
self._transport.restrict_allowed_services
]

# Send the request.
response = rpc(
request,
Expand Down Expand Up @@ -1025,8 +939,9 @@ def analyze_workload_move(
timeout: float = None,
metadata: Sequence[Tuple[str, str]] = (),
) -> assuredworkloads.AnalyzeWorkloadMoveResponse:
r"""Analyze if the source Assured Workloads can be moved
to the target Assured Workload
r"""A request to analyze a hypothetical move of a source
project or project-based workload to a target
(destination) folder-based workload.
.. code-block:: python
Expand All @@ -1050,27 +965,29 @@ def sample_analyze_workload_move():
Args:
request (Union[google.cloud.assuredworkloads_v1beta1.types.AnalyzeWorkloadMoveRequest, dict]):
The request object. Request to check if source workload
can be moved to target workload.
The request object. A request to analyze a hypothetical
move of a source project or project-based workload to a
target (destination) folder-based workload.
project (str):
The Source is a project based to be moved. This is the
project's relative path in the API, formatted as
"cloudresourcemanager.googleapis.com/projects/{project_number}"
"projects/{project_number}"
"cloudresourcemanager.googleapis.com/projects/{project_id}"
"projects/{project_id}" For example,
"organizations/123/locations/us-east1/workloads/assured-workload-1".
The source type is a project. Specify the project's
relative resource name, formatted as either a project
number or a project ID: "projects/{PROJECT_NUMBER}" or
"projects/{PROJECT_ID}" For example:
"projects/951040570662" when specifying a project
number, or "projects/my-project-123" when specifying a
project ID.
This corresponds to the ``project`` field
on the ``request`` instance; if ``request`` is provided, this
should not be set.
target (str):
Required. The resource name of the Workload to fetch.
This is the workloads's relative path in the API,
formatted as
"organizations/{organization_id}/locations/{location_id}/workloads/{workload_id}".
For example,
"organizations/123/locations/us-east1/workloads/assured-workload-2".
Required. The resource ID of the folder-based
destination workload. This workload is where the source
project will hypothetically be moved to. Specify the
workload's relative resource name, formatted as:
"organizations/{ORGANIZATION_ID}/locations/{LOCATION_ID}/workloads/{WORKLOAD_ID}"
For example:
"organizations/123/locations/us-east1/workloads/assured-workload-2"
This corresponds to the ``target`` field
on the ``request`` instance; if ``request`` is provided, this
Expand All @@ -1083,9 +1000,8 @@ def sample_analyze_workload_move():
Returns:
google.cloud.assuredworkloads_v1beta1.types.AnalyzeWorkloadMoveResponse:
Response with the analysis if the
source workload can be moved to the
target workload
A response that includes the analysis
of the hypothetical resource move.
"""
# Create or coerce a protobuf request object.
Expand Down
Loading

0 comments on commit b07a36a

Please sign in to comment.