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

Commit 07f3ff5

Browse files
feat: Updated the method signature of analyzeWorkloadMove for v1beta API to accept project as source. AnalyzeWorkloadMove now also returns information about org policy differences between the project and target folder (#463)
- [ ] Regenerate this pull request now. Committer: @ketanbshah PiperOrigin-RevId: 461626403 Source-Link: googleapis/googleapis@6aee59c Source-Link: https://github.com/googleapis/googleapis-gen/commit/1e4553d63e79ed253db11974bc6c740567bcb03c Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiMWU0NTUzZDYzZTc5ZWQyNTNkYjExOTc0YmM2Yzc0MDU2N2JjYjAzYyJ9
1 parent b30d9ba commit 07f3ff5

File tree

44 files changed

+8492
-1422
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+8492
-1422
lines changed

google-cloud-assured-workloads/src/main/java/com/google/cloud/assuredworkloads/v1beta1/AssuredWorkloadsServiceClient.java

Lines changed: 212 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -368,7 +368,7 @@ public final UnaryCallable<CreateWorkloadRequest, Operation> createWorkloadCalla
368368
* }
369369
* }</pre>
370370
*
371-
* @param workload Required. The workload to update. The workloads `name` field is used to
371+
* @param workload Required. The workload to update. The workload's `name` field is used to
372372
* identify the workload to be updated. Format:
373373
* organizations/{org_id}/locations/{location_id}/workloads/{workload_id}
374374
* @param updateMask Required. The list of fields to be updated.
@@ -438,10 +438,126 @@ public final UnaryCallable<UpdateWorkloadRequest, Workload> updateWorkloadCallab
438438
return stub.updateWorkloadCallable();
439439
}
440440

441+
// AUTO-GENERATED DOCUMENTATION AND METHOD.
442+
/**
443+
* Restrict the list of services allowed in the Workload environment. The current list of allowed
444+
* services can be found at https://cloud.google.com/assured-workloads/docs/supported-products In
445+
* addition to assuredworkloads.workload.update permission, the user should also have
446+
* orgpolicy.policy.set permission on the folder resource to use this functionality.
447+
*
448+
* <p>Sample code:
449+
*
450+
* <pre>{@code
451+
* // This snippet has been automatically generated for illustrative purposes only.
452+
* // It may require modifications to work in your environment.
453+
* try (AssuredWorkloadsServiceClient assuredWorkloadsServiceClient =
454+
* AssuredWorkloadsServiceClient.create()) {
455+
* RestrictAllowedServicesRequest request =
456+
* RestrictAllowedServicesRequest.newBuilder().setName("name3373707").build();
457+
* RestrictAllowedServicesResponse response =
458+
* assuredWorkloadsServiceClient.restrictAllowedServices(request);
459+
* }
460+
* }</pre>
461+
*
462+
* @param request The request object containing all of the parameters for the API call.
463+
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
464+
*/
465+
public final RestrictAllowedServicesResponse restrictAllowedServices(
466+
RestrictAllowedServicesRequest request) {
467+
return restrictAllowedServicesCallable().call(request);
468+
}
469+
470+
// AUTO-GENERATED DOCUMENTATION AND METHOD.
471+
/**
472+
* Restrict the list of services allowed in the Workload environment. The current list of allowed
473+
* services can be found at https://cloud.google.com/assured-workloads/docs/supported-products In
474+
* addition to assuredworkloads.workload.update permission, the user should also have
475+
* orgpolicy.policy.set permission on the folder resource to use this functionality.
476+
*
477+
* <p>Sample code:
478+
*
479+
* <pre>{@code
480+
* // This snippet has been automatically generated for illustrative purposes only.
481+
* // It may require modifications to work in your environment.
482+
* try (AssuredWorkloadsServiceClient assuredWorkloadsServiceClient =
483+
* AssuredWorkloadsServiceClient.create()) {
484+
* RestrictAllowedServicesRequest request =
485+
* RestrictAllowedServicesRequest.newBuilder().setName("name3373707").build();
486+
* ApiFuture<RestrictAllowedServicesResponse> future =
487+
* assuredWorkloadsServiceClient.restrictAllowedServicesCallable().futureCall(request);
488+
* // Do something.
489+
* RestrictAllowedServicesResponse response = future.get();
490+
* }
491+
* }</pre>
492+
*/
493+
public final UnaryCallable<RestrictAllowedServicesRequest, RestrictAllowedServicesResponse>
494+
restrictAllowedServicesCallable() {
495+
return stub.restrictAllowedServicesCallable();
496+
}
497+
498+
// AUTO-GENERATED DOCUMENTATION AND METHOD.
499+
/**
500+
* Restrict the list of resources allowed in the Workload environment. The current list of allowed
501+
* products can be found at https://cloud.google.com/assured-workloads/docs/supported-products In
502+
* addition to assuredworkloads.workload.update permission, the user should also have
503+
* orgpolicy.policy.set permission on the folder resource to use this functionality.
504+
*
505+
* <p>Sample code:
506+
*
507+
* <pre>{@code
508+
* // This snippet has been automatically generated for illustrative purposes only.
509+
* // It may require modifications to work in your environment.
510+
* try (AssuredWorkloadsServiceClient assuredWorkloadsServiceClient =
511+
* AssuredWorkloadsServiceClient.create()) {
512+
* RestrictAllowedResourcesRequest request =
513+
* RestrictAllowedResourcesRequest.newBuilder().setName("name3373707").build();
514+
* RestrictAllowedResourcesResponse response =
515+
* assuredWorkloadsServiceClient.restrictAllowedResources(request);
516+
* }
517+
* }</pre>
518+
*
519+
* @param request The request object containing all of the parameters for the API call.
520+
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
521+
*/
522+
public final RestrictAllowedResourcesResponse restrictAllowedResources(
523+
RestrictAllowedResourcesRequest request) {
524+
return restrictAllowedResourcesCallable().call(request);
525+
}
526+
527+
// AUTO-GENERATED DOCUMENTATION AND METHOD.
528+
/**
529+
* Restrict the list of resources allowed in the Workload environment. The current list of allowed
530+
* products can be found at https://cloud.google.com/assured-workloads/docs/supported-products In
531+
* addition to assuredworkloads.workload.update permission, the user should also have
532+
* orgpolicy.policy.set permission on the folder resource to use this functionality.
533+
*
534+
* <p>Sample code:
535+
*
536+
* <pre>{@code
537+
* // This snippet has been automatically generated for illustrative purposes only.
538+
* // It may require modifications to work in your environment.
539+
* try (AssuredWorkloadsServiceClient assuredWorkloadsServiceClient =
540+
* AssuredWorkloadsServiceClient.create()) {
541+
* RestrictAllowedResourcesRequest request =
542+
* RestrictAllowedResourcesRequest.newBuilder().setName("name3373707").build();
543+
* ApiFuture<RestrictAllowedResourcesResponse> future =
544+
* assuredWorkloadsServiceClient.restrictAllowedResourcesCallable().futureCall(request);
545+
* // Do something.
546+
* RestrictAllowedResourcesResponse response = future.get();
547+
* }
548+
* }</pre>
549+
*/
550+
public final UnaryCallable<RestrictAllowedResourcesRequest, RestrictAllowedResourcesResponse>
551+
restrictAllowedResourcesCallable() {
552+
return stub.restrictAllowedResourcesCallable();
553+
}
554+
441555
// AUTO-GENERATED DOCUMENTATION AND METHOD.
442556
/**
443557
* Deletes the workload. Make sure that workload's direct children are already in a deleted state,
444-
* otherwise the request will fail with a FAILED_PRECONDITION error.
558+
* otherwise the request will fail with a FAILED_PRECONDITION error. In addition to
559+
* assuredworkloads.workload.delete permission, the user should also have orgpolicy.policy.set
560+
* permission on the deleted folder to remove Assured Workloads OrgPolicies.
445561
*
446562
* <p>Sample code:
447563
*
@@ -468,7 +584,9 @@ public final void deleteWorkload(WorkloadName name) {
468584
// AUTO-GENERATED DOCUMENTATION AND METHOD.
469585
/**
470586
* Deletes the workload. Make sure that workload's direct children are already in a deleted state,
471-
* otherwise the request will fail with a FAILED_PRECONDITION error.
587+
* otherwise the request will fail with a FAILED_PRECONDITION error. In addition to
588+
* assuredworkloads.workload.delete permission, the user should also have orgpolicy.policy.set
589+
* permission on the deleted folder to remove Assured Workloads OrgPolicies.
472590
*
473591
* <p>Sample code:
474592
*
@@ -494,7 +612,9 @@ public final void deleteWorkload(String name) {
494612
// AUTO-GENERATED DOCUMENTATION AND METHOD.
495613
/**
496614
* Deletes the workload. Make sure that workload's direct children are already in a deleted state,
497-
* otherwise the request will fail with a FAILED_PRECONDITION error.
615+
* otherwise the request will fail with a FAILED_PRECONDITION error. In addition to
616+
* assuredworkloads.workload.delete permission, the user should also have orgpolicy.policy.set
617+
* permission on the deleted folder to remove Assured Workloads OrgPolicies.
498618
*
499619
* <p>Sample code:
500620
*
@@ -522,7 +642,9 @@ public final void deleteWorkload(DeleteWorkloadRequest request) {
522642
// AUTO-GENERATED DOCUMENTATION AND METHOD.
523643
/**
524644
* Deletes the workload. Make sure that workload's direct children are already in a deleted state,
525-
* otherwise the request will fail with a FAILED_PRECONDITION error.
645+
* otherwise the request will fail with a FAILED_PRECONDITION error. In addition to
646+
* assuredworkloads.workload.delete permission, the user should also have orgpolicy.policy.set
647+
* permission on the deleted folder to remove Assured Workloads OrgPolicies.
526648
*
527649
* <p>Sample code:
528650
*
@@ -654,6 +776,91 @@ public final UnaryCallable<GetWorkloadRequest, Workload> getWorkloadCallable() {
654776
return stub.getWorkloadCallable();
655777
}
656778

779+
// AUTO-GENERATED DOCUMENTATION AND METHOD.
780+
/**
781+
* Analyze if the source Assured Workloads can be moved to the target Assured Workload
782+
*
783+
* <p>Sample code:
784+
*
785+
* <pre>{@code
786+
* // This snippet has been automatically generated for illustrative purposes only.
787+
* // It may require modifications to work in your environment.
788+
* try (AssuredWorkloadsServiceClient assuredWorkloadsServiceClient =
789+
* AssuredWorkloadsServiceClient.create()) {
790+
* String project = "project-309310695";
791+
* String target = "target-880905839";
792+
* AnalyzeWorkloadMoveResponse response =
793+
* assuredWorkloadsServiceClient.analyzeWorkloadMove(project, target);
794+
* }
795+
* }</pre>
796+
*
797+
* @param project The Source is a project based to be moved. This is the project's relative path
798+
* in the API, formatted as "cloudresourcemanager.googleapis.com/projects/{project_number}"
799+
* "projects/{project_number}" "cloudresourcemanager.googleapis.com/projects/{project_id}"
800+
* "projects/{project_id}" For example,
801+
* "organizations/123/locations/us-east1/workloads/assured-workload-1".
802+
* @param target Required. The resource name of the Workload to fetch. This is the workloads's
803+
* relative path in the API, formatted as
804+
* "organizations/{organization_id}/locations/{location_id}/workloads/{workload_id}". For
805+
* example, "organizations/123/locations/us-east1/workloads/assured-workload-2".
806+
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
807+
*/
808+
public final AnalyzeWorkloadMoveResponse analyzeWorkloadMove(String project, String target) {
809+
AnalyzeWorkloadMoveRequest request =
810+
AnalyzeWorkloadMoveRequest.newBuilder().setProject(project).setTarget(target).build();
811+
return analyzeWorkloadMove(request);
812+
}
813+
814+
// AUTO-GENERATED DOCUMENTATION AND METHOD.
815+
/**
816+
* Analyze if the source Assured Workloads can be moved to the target Assured Workload
817+
*
818+
* <p>Sample code:
819+
*
820+
* <pre>{@code
821+
* // This snippet has been automatically generated for illustrative purposes only.
822+
* // It may require modifications to work in your environment.
823+
* try (AssuredWorkloadsServiceClient assuredWorkloadsServiceClient =
824+
* AssuredWorkloadsServiceClient.create()) {
825+
* AnalyzeWorkloadMoveRequest request =
826+
* AnalyzeWorkloadMoveRequest.newBuilder().setTarget("target-880905839").build();
827+
* AnalyzeWorkloadMoveResponse response =
828+
* assuredWorkloadsServiceClient.analyzeWorkloadMove(request);
829+
* }
830+
* }</pre>
831+
*
832+
* @param request The request object containing all of the parameters for the API call.
833+
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
834+
*/
835+
public final AnalyzeWorkloadMoveResponse analyzeWorkloadMove(AnalyzeWorkloadMoveRequest request) {
836+
return analyzeWorkloadMoveCallable().call(request);
837+
}
838+
839+
// AUTO-GENERATED DOCUMENTATION AND METHOD.
840+
/**
841+
* Analyze if the source Assured Workloads can be moved to the target Assured Workload
842+
*
843+
* <p>Sample code:
844+
*
845+
* <pre>{@code
846+
* // This snippet has been automatically generated for illustrative purposes only.
847+
* // It may require modifications to work in your environment.
848+
* try (AssuredWorkloadsServiceClient assuredWorkloadsServiceClient =
849+
* AssuredWorkloadsServiceClient.create()) {
850+
* AnalyzeWorkloadMoveRequest request =
851+
* AnalyzeWorkloadMoveRequest.newBuilder().setTarget("target-880905839").build();
852+
* ApiFuture<AnalyzeWorkloadMoveResponse> future =
853+
* assuredWorkloadsServiceClient.analyzeWorkloadMoveCallable().futureCall(request);
854+
* // Do something.
855+
* AnalyzeWorkloadMoveResponse response = future.get();
856+
* }
857+
* }</pre>
858+
*/
859+
public final UnaryCallable<AnalyzeWorkloadMoveRequest, AnalyzeWorkloadMoveResponse>
860+
analyzeWorkloadMoveCallable() {
861+
return stub.analyzeWorkloadMoveCallable();
862+
}
863+
657864
// AUTO-GENERATED DOCUMENTATION AND METHOD.
658865
/**
659866
* Lists Assured Workloads under a CRM Node.

google-cloud-assured-workloads/src/main/java/com/google/cloud/assuredworkloads/v1beta1/AssuredWorkloadsServiceSettings.java

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,20 @@ public UnaryCallSettings<UpdateWorkloadRequest, Workload> updateWorkloadSettings
9696
return ((AssuredWorkloadsServiceStubSettings) getStubSettings()).updateWorkloadSettings();
9797
}
9898

99+
/** Returns the object with the settings used for calls to restrictAllowedServices. */
100+
public UnaryCallSettings<RestrictAllowedServicesRequest, RestrictAllowedServicesResponse>
101+
restrictAllowedServicesSettings() {
102+
return ((AssuredWorkloadsServiceStubSettings) getStubSettings())
103+
.restrictAllowedServicesSettings();
104+
}
105+
106+
/** Returns the object with the settings used for calls to restrictAllowedResources. */
107+
public UnaryCallSettings<RestrictAllowedResourcesRequest, RestrictAllowedResourcesResponse>
108+
restrictAllowedResourcesSettings() {
109+
return ((AssuredWorkloadsServiceStubSettings) getStubSettings())
110+
.restrictAllowedResourcesSettings();
111+
}
112+
99113
/** Returns the object with the settings used for calls to deleteWorkload. */
100114
public UnaryCallSettings<DeleteWorkloadRequest, Empty> deleteWorkloadSettings() {
101115
return ((AssuredWorkloadsServiceStubSettings) getStubSettings()).deleteWorkloadSettings();
@@ -106,6 +120,12 @@ public UnaryCallSettings<GetWorkloadRequest, Workload> getWorkloadSettings() {
106120
return ((AssuredWorkloadsServiceStubSettings) getStubSettings()).getWorkloadSettings();
107121
}
108122

123+
/** Returns the object with the settings used for calls to analyzeWorkloadMove. */
124+
public UnaryCallSettings<AnalyzeWorkloadMoveRequest, AnalyzeWorkloadMoveResponse>
125+
analyzeWorkloadMoveSettings() {
126+
return ((AssuredWorkloadsServiceStubSettings) getStubSettings()).analyzeWorkloadMoveSettings();
127+
}
128+
109129
/** Returns the object with the settings used for calls to listWorkloads. */
110130
public PagedCallSettings<ListWorkloadsRequest, ListWorkloadsResponse, ListWorkloadsPagedResponse>
111131
listWorkloadsSettings() {
@@ -245,6 +265,20 @@ public UnaryCallSettings.Builder<UpdateWorkloadRequest, Workload> updateWorkload
245265
return getStubSettingsBuilder().updateWorkloadSettings();
246266
}
247267

268+
/** Returns the builder for the settings used for calls to restrictAllowedServices. */
269+
public UnaryCallSettings.Builder<
270+
RestrictAllowedServicesRequest, RestrictAllowedServicesResponse>
271+
restrictAllowedServicesSettings() {
272+
return getStubSettingsBuilder().restrictAllowedServicesSettings();
273+
}
274+
275+
/** Returns the builder for the settings used for calls to restrictAllowedResources. */
276+
public UnaryCallSettings.Builder<
277+
RestrictAllowedResourcesRequest, RestrictAllowedResourcesResponse>
278+
restrictAllowedResourcesSettings() {
279+
return getStubSettingsBuilder().restrictAllowedResourcesSettings();
280+
}
281+
248282
/** Returns the builder for the settings used for calls to deleteWorkload. */
249283
public UnaryCallSettings.Builder<DeleteWorkloadRequest, Empty> deleteWorkloadSettings() {
250284
return getStubSettingsBuilder().deleteWorkloadSettings();
@@ -255,6 +289,12 @@ public UnaryCallSettings.Builder<GetWorkloadRequest, Workload> getWorkloadSettin
255289
return getStubSettingsBuilder().getWorkloadSettings();
256290
}
257291

292+
/** Returns the builder for the settings used for calls to analyzeWorkloadMove. */
293+
public UnaryCallSettings.Builder<AnalyzeWorkloadMoveRequest, AnalyzeWorkloadMoveResponse>
294+
analyzeWorkloadMoveSettings() {
295+
return getStubSettingsBuilder().analyzeWorkloadMoveSettings();
296+
}
297+
258298
/** Returns the builder for the settings used for calls to listWorkloads. */
259299
public PagedCallSettings.Builder<
260300
ListWorkloadsRequest, ListWorkloadsResponse, ListWorkloadsPagedResponse>

google-cloud-assured-workloads/src/main/java/com/google/cloud/assuredworkloads/v1beta1/gapic_metadata.json

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@
1010
"grpc": {
1111
"libraryClient": "AssuredWorkloadsServiceClient",
1212
"rpcs": {
13+
"AnalyzeWorkloadMove": {
14+
"methods": ["analyzeWorkloadMove", "analyzeWorkloadMove", "analyzeWorkloadMoveCallable"]
15+
},
1316
"CreateWorkload": {
1417
"methods": ["createWorkloadAsync", "createWorkloadAsync", "createWorkloadAsync", "createWorkloadOperationCallable", "createWorkloadCallable"]
1518
},
@@ -22,6 +25,12 @@
2225
"ListWorkloads": {
2326
"methods": ["listWorkloads", "listWorkloads", "listWorkloads", "listWorkloadsPagedCallable", "listWorkloadsCallable"]
2427
},
28+
"RestrictAllowedResources": {
29+
"methods": ["restrictAllowedResources", "restrictAllowedResourcesCallable"]
30+
},
31+
"RestrictAllowedServices": {
32+
"methods": ["restrictAllowedServices", "restrictAllowedServicesCallable"]
33+
},
2534
"UpdateWorkload": {
2635
"methods": ["updateWorkload", "updateWorkload", "updateWorkloadCallable"]
2736
}

0 commit comments

Comments
 (0)