Class AssuredWorkloadsServiceClient
- All Implemented Interfaces:
BackgroundResource,AutoCloseable
This class provides the ability to make remote calls to the backing service through method calls that map to API methods. Sample code to get started:
// 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://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (AssuredWorkloadsServiceClient assuredWorkloadsServiceClient =
AssuredWorkloadsServiceClient.create()) {
Workload workload = Workload.newBuilder().build();
FieldMask updateMask = FieldMask.newBuilder().build();
Workload response = assuredWorkloadsServiceClient.updateWorkload(workload, updateMask);
}
Note: close() needs to be called on the AssuredWorkloadsServiceClient object to clean up resources such as threads. In the example above, try-with-resources is used, which automatically calls close().
| Method | Description | Method Variants |
|---|---|---|
CreateWorkload |
Creates Assured Workload. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
Methods that return long-running operations have "Async" method variants that return `OperationFuture`, which is used to track polling of the service.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
UpdateWorkload |
Updates an existing workload. Currently allows updating of workload display_name and labels. For force updates don't set etag field in the Workload. Only one update operation per workload can be in progress. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
RestrictAllowedResources |
Restrict the list of resources allowed in the Workload environment. The current list of allowed products 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. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
DeleteWorkload |
Deletes the workload. Make sure that workload's direct children are already in a deleted state, otherwise the request will fail with a FAILED_PRECONDITION error. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
GetWorkload |
Gets Assured Workload associated with a CRM Node |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
ListWorkloads |
Lists Assured Workloads under a CRM Node. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
ListViolations |
Lists the Violations in the AssuredWorkload Environment. Callers may also choose to read across multiple Workloads as per [AIP-159](https://google.aip.dev/159) by using '-' (the hyphen or dash character) as a wildcard character instead of workload-id in the parent. Format `organizations/{org_id}/locations/{location}/workloads/-` |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
GetViolation |
Retrieves Assured Workload Violation based on ID. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
AcknowledgeViolation |
Acknowledges an existing violation. By acknowledging a violation, users acknowledge the existence of a compliance violation in their workload and decide to ignore it due to a valid business justification. Acknowledgement is a permanent operation and it cannot be reverted. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
See the individual methods for example code.
Many parameters require resource names to be formatted in a particular way. To assist with these names, this class includes a format method for each type of name, and additionally a parse method to extract the individual identifiers contained within names that are returned.
This class can be customized by passing in a custom instance of AssuredWorkloadsServiceSettings to create(). For example:
To customize credentials:
// 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://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
AssuredWorkloadsServiceSettings assuredWorkloadsServiceSettings =
AssuredWorkloadsServiceSettings.newBuilder()
.setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
.build();
AssuredWorkloadsServiceClient assuredWorkloadsServiceClient =
AssuredWorkloadsServiceClient.create(assuredWorkloadsServiceSettings);
To customize the endpoint:
// 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://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
AssuredWorkloadsServiceSettings assuredWorkloadsServiceSettings =
AssuredWorkloadsServiceSettings.newBuilder().setEndpoint(myEndpoint).build();
AssuredWorkloadsServiceClient assuredWorkloadsServiceClient =
AssuredWorkloadsServiceClient.create(assuredWorkloadsServiceSettings);
To use REST (HTTP1.1/JSON) transport (instead of gRPC) for sending and receiving requests over the wire:
// 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://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
AssuredWorkloadsServiceSettings assuredWorkloadsServiceSettings =
AssuredWorkloadsServiceSettings.newHttpJsonBuilder().build();
AssuredWorkloadsServiceClient assuredWorkloadsServiceClient =
AssuredWorkloadsServiceClient.create(assuredWorkloadsServiceSettings);
Please refer to the GitHub repository's samples for more quickstart code snippets.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classstatic classstatic classstatic classstatic classstatic class -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedConstructs an instance of AssuredWorkloadsServiceClient, using the given settings.protected -
Method Summary
Modifier and TypeMethodDescriptionAcknowledges an existing violation.Acknowledges an existing violation.booleanawaitTermination(long duration, TimeUnit unit) final voidclose()static final AssuredWorkloadsServiceClientcreate()Constructs an instance of AssuredWorkloadsServiceClient with default settings.static final AssuredWorkloadsServiceClientcreate(AssuredWorkloadsServiceSettings settings) Constructs an instance of AssuredWorkloadsServiceClient, using the given settings.static final AssuredWorkloadsServiceClientConstructs an instance of AssuredWorkloadsServiceClient, using the given stub for making calls.createWorkloadAsync(CreateWorkloadRequest request) Creates Assured Workload.createWorkloadAsync(LocationName parent, Workload workload) Creates Assured Workload.createWorkloadAsync(String parent, Workload workload) Creates Assured Workload.Creates Assured Workload.Creates Assured Workload.final voiddeleteWorkload(DeleteWorkloadRequest request) Deletes the workload.final voiddeleteWorkload(WorkloadName name) Deletes the workload.final voiddeleteWorkload(String name) Deletes the workload.final UnaryCallable<DeleteWorkloadRequest,com.google.protobuf.Empty> Deletes the workload.final OperationsClientReturns the OperationsClient that can be used to query the status of a long-running operation returned by another API method call.final OperationsClientReturns the OperationsClient that can be used to query the status of a long-running operation returned by another API method call.getStub()final ViolationgetViolation(GetViolationRequest request) Retrieves Assured Workload Violation based on ID.final ViolationgetViolation(ViolationName name) Retrieves Assured Workload Violation based on ID.final ViolationgetViolation(String name) Retrieves Assured Workload Violation based on ID.Retrieves Assured Workload Violation based on ID.final WorkloadgetWorkload(GetWorkloadRequest request) Gets Assured Workload associated with a CRM Nodefinal WorkloadgetWorkload(WorkloadName name) Gets Assured Workload associated with a CRM Nodefinal WorkloadgetWorkload(String name) Gets Assured Workload associated with a CRM NodeGets Assured Workload associated with a CRM NodebooleanbooleanlistViolations(ListViolationsRequest request) Lists the Violations in the AssuredWorkload Environment.listViolations(WorkloadName parent) Lists the Violations in the AssuredWorkload Environment.listViolations(String parent) Lists the Violations in the AssuredWorkload Environment.Lists the Violations in the AssuredWorkload Environment.final UnaryCallable<ListViolationsRequest,AssuredWorkloadsServiceClient.ListViolationsPagedResponse> Lists the Violations in the AssuredWorkload Environment.listWorkloads(ListWorkloadsRequest request) Lists Assured Workloads under a CRM Node.listWorkloads(LocationName parent) Lists Assured Workloads under a CRM Node.listWorkloads(String parent) Lists Assured Workloads under a CRM Node.Lists Assured Workloads under a CRM Node.Lists Assured Workloads under a CRM Node.Restrict the list of resources allowed in the Workload environment.Restrict the list of resources allowed in the Workload environment.voidshutdown()voidfinal WorkloadupdateWorkload(UpdateWorkloadRequest request) Updates an existing workload.final WorkloadupdateWorkload(Workload workload, com.google.protobuf.FieldMask updateMask) Updates an existing workload.Updates an existing workload.
-
Constructor Details
-
AssuredWorkloadsServiceClient
protected AssuredWorkloadsServiceClient(AssuredWorkloadsServiceSettings settings) throws IOException Constructs an instance of AssuredWorkloadsServiceClient, using the given settings. This is protected so that it is easy to make a subclass, but otherwise, the static factory methods should be preferred.- Throws:
IOException
-
AssuredWorkloadsServiceClient
-
-
Method Details
-
create
Constructs an instance of AssuredWorkloadsServiceClient with default settings.- Throws:
IOException
-
create
public static final AssuredWorkloadsServiceClient create(AssuredWorkloadsServiceSettings settings) throws IOException Constructs an instance of AssuredWorkloadsServiceClient, using the given settings. The channels are created based on the settings passed in, or defaults for any settings that are not set.- Throws:
IOException
-
create
Constructs an instance of AssuredWorkloadsServiceClient, using the given stub for making calls. This is for advanced usage - prefer using create(AssuredWorkloadsServiceSettings). -
getSettings
-
getStub
-
getOperationsClient
Returns the OperationsClient that can be used to query the status of a long-running operation returned by another API method call. -
getHttpJsonOperationsClient
Returns the OperationsClient that can be used to query the status of a long-running operation returned by another API method call. -
createWorkloadAsync
public final OperationFuture<Workload,CreateWorkloadOperationMetadata> createWorkloadAsync(LocationName parent, Workload workload) Creates Assured Workload.Sample code:
// 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://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (AssuredWorkloadsServiceClient assuredWorkloadsServiceClient = AssuredWorkloadsServiceClient.create()) { LocationName parent = LocationName.of("[ORGANIZATION]", "[LOCATION]"); Workload workload = Workload.newBuilder().build(); Workload response = assuredWorkloadsServiceClient.createWorkloadAsync(parent, workload).get(); }- Parameters:
parent- Required. The resource name of the new Workload's parent. Must be of the form `organizations/{org_id}/locations/{location_id}`.workload- Required. Assured Workload to create- Throws:
ApiException- if the remote call fails
-
createWorkloadAsync
public final OperationFuture<Workload,CreateWorkloadOperationMetadata> createWorkloadAsync(String parent, Workload workload) Creates Assured Workload.Sample code:
// 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://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (AssuredWorkloadsServiceClient assuredWorkloadsServiceClient = AssuredWorkloadsServiceClient.create()) { String parent = LocationName.of("[ORGANIZATION]", "[LOCATION]").toString(); Workload workload = Workload.newBuilder().build(); Workload response = assuredWorkloadsServiceClient.createWorkloadAsync(parent, workload).get(); }- Parameters:
parent- Required. The resource name of the new Workload's parent. Must be of the form `organizations/{org_id}/locations/{location_id}`.workload- Required. Assured Workload to create- Throws:
ApiException- if the remote call fails
-
createWorkloadAsync
public final OperationFuture<Workload,CreateWorkloadOperationMetadata> createWorkloadAsync(CreateWorkloadRequest request) Creates Assured Workload.Sample code:
// 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://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (AssuredWorkloadsServiceClient assuredWorkloadsServiceClient = AssuredWorkloadsServiceClient.create()) { CreateWorkloadRequest request = CreateWorkloadRequest.newBuilder() .setParent(LocationName.of("[ORGANIZATION]", "[LOCATION]").toString()) .setWorkload(Workload.newBuilder().build()) .setExternalId("externalId-1699764666") .build(); Workload response = assuredWorkloadsServiceClient.createWorkloadAsync(request).get(); }- Parameters:
request- The request object containing all of the parameters for the API call.- Throws:
ApiException- if the remote call fails
-
createWorkloadOperationCallable
public final OperationCallable<CreateWorkloadRequest,Workload, createWorkloadOperationCallable()CreateWorkloadOperationMetadata> Creates Assured Workload.Sample code:
// 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://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (AssuredWorkloadsServiceClient assuredWorkloadsServiceClient = AssuredWorkloadsServiceClient.create()) { CreateWorkloadRequest request = CreateWorkloadRequest.newBuilder() .setParent(LocationName.of("[ORGANIZATION]", "[LOCATION]").toString()) .setWorkload(Workload.newBuilder().build()) .setExternalId("externalId-1699764666") .build(); OperationFuture<Workload, CreateWorkloadOperationMetadata> future = assuredWorkloadsServiceClient.createWorkloadOperationCallable().futureCall(request); // Do something. Workload response = future.get(); } -
createWorkloadCallable
Creates Assured Workload.Sample code:
// 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://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (AssuredWorkloadsServiceClient assuredWorkloadsServiceClient = AssuredWorkloadsServiceClient.create()) { CreateWorkloadRequest request = CreateWorkloadRequest.newBuilder() .setParent(LocationName.of("[ORGANIZATION]", "[LOCATION]").toString()) .setWorkload(Workload.newBuilder().build()) .setExternalId("externalId-1699764666") .build(); ApiFuture<Operation> future = assuredWorkloadsServiceClient.createWorkloadCallable().futureCall(request); // Do something. Operation response = future.get(); } -
updateWorkload
Updates an existing workload. Currently allows updating of workload display_name and labels. For force updates don't set etag field in the Workload. Only one update operation per workload can be in progress.Sample code:
// 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://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (AssuredWorkloadsServiceClient assuredWorkloadsServiceClient = AssuredWorkloadsServiceClient.create()) { Workload workload = Workload.newBuilder().build(); FieldMask updateMask = FieldMask.newBuilder().build(); Workload response = assuredWorkloadsServiceClient.updateWorkload(workload, updateMask); }- Parameters:
workload- Required. The workload to update. The workload's `name` field is used to identify the workload to be updated. Format: organizations/{org_id}/locations/{location_id}/workloads/{workload_id}updateMask- Required. The list of fields to be updated.- Throws:
ApiException- if the remote call fails
-
updateWorkload
Updates an existing workload. Currently allows updating of workload display_name and labels. For force updates don't set etag field in the Workload. Only one update operation per workload can be in progress.Sample code:
// 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://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (AssuredWorkloadsServiceClient assuredWorkloadsServiceClient = AssuredWorkloadsServiceClient.create()) { UpdateWorkloadRequest request = UpdateWorkloadRequest.newBuilder() .setWorkload(Workload.newBuilder().build()) .setUpdateMask(FieldMask.newBuilder().build()) .build(); Workload response = assuredWorkloadsServiceClient.updateWorkload(request); }- Parameters:
request- The request object containing all of the parameters for the API call.- Throws:
ApiException- if the remote call fails
-
updateWorkloadCallable
Updates an existing workload. Currently allows updating of workload display_name and labels. For force updates don't set etag field in the Workload. Only one update operation per workload can be in progress.Sample code:
// 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://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (AssuredWorkloadsServiceClient assuredWorkloadsServiceClient = AssuredWorkloadsServiceClient.create()) { UpdateWorkloadRequest request = UpdateWorkloadRequest.newBuilder() .setWorkload(Workload.newBuilder().build()) .setUpdateMask(FieldMask.newBuilder().build()) .build(); ApiFuture<Workload> future = assuredWorkloadsServiceClient.updateWorkloadCallable().futureCall(request); // Do something. Workload response = future.get(); } -
restrictAllowedResources
public final RestrictAllowedResourcesResponse restrictAllowedResources(RestrictAllowedResourcesRequest request) Restrict the list of resources allowed in the Workload environment. The current list of allowed products 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.Sample code:
// 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://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (AssuredWorkloadsServiceClient assuredWorkloadsServiceClient = AssuredWorkloadsServiceClient.create()) { RestrictAllowedResourcesRequest request = RestrictAllowedResourcesRequest.newBuilder().setName("name3373707").build(); RestrictAllowedResourcesResponse response = assuredWorkloadsServiceClient.restrictAllowedResources(request); }- Parameters:
request- The request object containing all of the parameters for the API call.- Throws:
ApiException- if the remote call fails
-
restrictAllowedResourcesCallable
public final UnaryCallable<RestrictAllowedResourcesRequest,RestrictAllowedResourcesResponse> restrictAllowedResourcesCallable()Restrict the list of resources allowed in the Workload environment. The current list of allowed products 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.Sample code:
// 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://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (AssuredWorkloadsServiceClient assuredWorkloadsServiceClient = AssuredWorkloadsServiceClient.create()) { RestrictAllowedResourcesRequest request = RestrictAllowedResourcesRequest.newBuilder().setName("name3373707").build(); ApiFuture<RestrictAllowedResourcesResponse> future = assuredWorkloadsServiceClient.restrictAllowedResourcesCallable().futureCall(request); // Do something. RestrictAllowedResourcesResponse response = future.get(); } -
deleteWorkload
Deletes the workload. Make sure that workload's direct children are already in a deleted state, otherwise the request will fail with a FAILED_PRECONDITION error.Sample code:
// 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://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (AssuredWorkloadsServiceClient assuredWorkloadsServiceClient = AssuredWorkloadsServiceClient.create()) { WorkloadName name = WorkloadName.of("[ORGANIZATION]", "[LOCATION]", "[WORKLOAD]"); assuredWorkloadsServiceClient.deleteWorkload(name); }- Parameters:
name- Required. The `name` field is used to identify the workload. Format: organizations/{org_id}/locations/{location_id}/workloads/{workload_id}- Throws:
ApiException- if the remote call fails
-
deleteWorkload
Deletes the workload. Make sure that workload's direct children are already in a deleted state, otherwise the request will fail with a FAILED_PRECONDITION error.Sample code:
// 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://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (AssuredWorkloadsServiceClient assuredWorkloadsServiceClient = AssuredWorkloadsServiceClient.create()) { String name = WorkloadName.of("[ORGANIZATION]", "[LOCATION]", "[WORKLOAD]").toString(); assuredWorkloadsServiceClient.deleteWorkload(name); }- Parameters:
name- Required. The `name` field is used to identify the workload. Format: organizations/{org_id}/locations/{location_id}/workloads/{workload_id}- Throws:
ApiException- if the remote call fails
-
deleteWorkload
Deletes the workload. Make sure that workload's direct children are already in a deleted state, otherwise the request will fail with a FAILED_PRECONDITION error.Sample code:
// 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://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (AssuredWorkloadsServiceClient assuredWorkloadsServiceClient = AssuredWorkloadsServiceClient.create()) { DeleteWorkloadRequest request = DeleteWorkloadRequest.newBuilder() .setName(WorkloadName.of("[ORGANIZATION]", "[LOCATION]", "[WORKLOAD]").toString()) .setEtag("etag3123477") .build(); assuredWorkloadsServiceClient.deleteWorkload(request); }- Parameters:
request- The request object containing all of the parameters for the API call.- Throws:
ApiException- if the remote call fails
-
deleteWorkloadCallable
public final UnaryCallable<DeleteWorkloadRequest,com.google.protobuf.Empty> deleteWorkloadCallable()Deletes the workload. Make sure that workload's direct children are already in a deleted state, otherwise the request will fail with a FAILED_PRECONDITION error.Sample code:
// 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://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (AssuredWorkloadsServiceClient assuredWorkloadsServiceClient = AssuredWorkloadsServiceClient.create()) { DeleteWorkloadRequest request = DeleteWorkloadRequest.newBuilder() .setName(WorkloadName.of("[ORGANIZATION]", "[LOCATION]", "[WORKLOAD]").toString()) .setEtag("etag3123477") .build(); ApiFuture<Empty> future = assuredWorkloadsServiceClient.deleteWorkloadCallable().futureCall(request); // Do something. future.get(); } -
getWorkload
Gets Assured Workload associated with a CRM NodeSample code:
// 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://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (AssuredWorkloadsServiceClient assuredWorkloadsServiceClient = AssuredWorkloadsServiceClient.create()) { WorkloadName name = WorkloadName.of("[ORGANIZATION]", "[LOCATION]", "[WORKLOAD]"); Workload response = assuredWorkloadsServiceClient.getWorkload(name); }- Parameters:
name- Required. The resource name of the Workload to fetch. This is the workload'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-1".- Throws:
ApiException- if the remote call fails
-
getWorkload
Gets Assured Workload associated with a CRM NodeSample code:
// 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://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (AssuredWorkloadsServiceClient assuredWorkloadsServiceClient = AssuredWorkloadsServiceClient.create()) { String name = WorkloadName.of("[ORGANIZATION]", "[LOCATION]", "[WORKLOAD]").toString(); Workload response = assuredWorkloadsServiceClient.getWorkload(name); }- Parameters:
name- Required. The resource name of the Workload to fetch. This is the workload'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-1".- Throws:
ApiException- if the remote call fails
-
getWorkload
Gets Assured Workload associated with a CRM NodeSample code:
// 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://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (AssuredWorkloadsServiceClient assuredWorkloadsServiceClient = AssuredWorkloadsServiceClient.create()) { GetWorkloadRequest request = GetWorkloadRequest.newBuilder() .setName(WorkloadName.of("[ORGANIZATION]", "[LOCATION]", "[WORKLOAD]").toString()) .build(); Workload response = assuredWorkloadsServiceClient.getWorkload(request); }- Parameters:
request- The request object containing all of the parameters for the API call.- Throws:
ApiException- if the remote call fails
-
getWorkloadCallable
Gets Assured Workload associated with a CRM NodeSample code:
// 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://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (AssuredWorkloadsServiceClient assuredWorkloadsServiceClient = AssuredWorkloadsServiceClient.create()) { GetWorkloadRequest request = GetWorkloadRequest.newBuilder() .setName(WorkloadName.of("[ORGANIZATION]", "[LOCATION]", "[WORKLOAD]").toString()) .build(); ApiFuture<Workload> future = assuredWorkloadsServiceClient.getWorkloadCallable().futureCall(request); // Do something. Workload response = future.get(); } -
listWorkloads
public final AssuredWorkloadsServiceClient.ListWorkloadsPagedResponse listWorkloads(LocationName parent) Lists Assured Workloads under a CRM Node.Sample code:
// 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://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (AssuredWorkloadsServiceClient assuredWorkloadsServiceClient = AssuredWorkloadsServiceClient.create()) { LocationName parent = LocationName.of("[ORGANIZATION]", "[LOCATION]"); for (Workload element : assuredWorkloadsServiceClient.listWorkloads(parent).iterateAll()) { // doThingsWith(element); } }- Parameters:
parent- Required. Parent Resource to list workloads from. Must be of the form `organizations/{org_id}/locations/{location}`.- Throws:
ApiException- if the remote call fails
-
listWorkloads
Lists Assured Workloads under a CRM Node.Sample code:
// 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://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (AssuredWorkloadsServiceClient assuredWorkloadsServiceClient = AssuredWorkloadsServiceClient.create()) { String parent = LocationName.of("[ORGANIZATION]", "[LOCATION]").toString(); for (Workload element : assuredWorkloadsServiceClient.listWorkloads(parent).iterateAll()) { // doThingsWith(element); } }- Parameters:
parent- Required. Parent Resource to list workloads from. Must be of the form `organizations/{org_id}/locations/{location}`.- Throws:
ApiException- if the remote call fails
-
listWorkloads
public final AssuredWorkloadsServiceClient.ListWorkloadsPagedResponse listWorkloads(ListWorkloadsRequest request) Lists Assured Workloads under a CRM Node.Sample code:
// 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://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (AssuredWorkloadsServiceClient assuredWorkloadsServiceClient = AssuredWorkloadsServiceClient.create()) { ListWorkloadsRequest request = ListWorkloadsRequest.newBuilder() .setParent(LocationName.of("[ORGANIZATION]", "[LOCATION]").toString()) .setPageSize(883849137) .setPageToken("pageToken873572522") .setFilter("filter-1274492040") .build(); for (Workload element : assuredWorkloadsServiceClient.listWorkloads(request).iterateAll()) { // doThingsWith(element); } }- Parameters:
request- The request object containing all of the parameters for the API call.- Throws:
ApiException- if the remote call fails
-
listWorkloadsPagedCallable
public final UnaryCallable<ListWorkloadsRequest,AssuredWorkloadsServiceClient.ListWorkloadsPagedResponse> listWorkloadsPagedCallable()Lists Assured Workloads under a CRM Node.Sample code:
// 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://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (AssuredWorkloadsServiceClient assuredWorkloadsServiceClient = AssuredWorkloadsServiceClient.create()) { ListWorkloadsRequest request = ListWorkloadsRequest.newBuilder() .setParent(LocationName.of("[ORGANIZATION]", "[LOCATION]").toString()) .setPageSize(883849137) .setPageToken("pageToken873572522") .setFilter("filter-1274492040") .build(); ApiFuture<Workload> future = assuredWorkloadsServiceClient.listWorkloadsPagedCallable().futureCall(request); // Do something. for (Workload element : future.get().iterateAll()) { // doThingsWith(element); } } -
listWorkloadsCallable
Lists Assured Workloads under a CRM Node.Sample code:
// 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://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (AssuredWorkloadsServiceClient assuredWorkloadsServiceClient = AssuredWorkloadsServiceClient.create()) { ListWorkloadsRequest request = ListWorkloadsRequest.newBuilder() .setParent(LocationName.of("[ORGANIZATION]", "[LOCATION]").toString()) .setPageSize(883849137) .setPageToken("pageToken873572522") .setFilter("filter-1274492040") .build(); while (true) { ListWorkloadsResponse response = assuredWorkloadsServiceClient.listWorkloadsCallable().call(request); for (Workload element : response.getWorkloadsList()) { // doThingsWith(element); } String nextPageToken = response.getNextPageToken(); if (!Strings.isNullOrEmpty(nextPageToken)) { request = request.toBuilder().setPageToken(nextPageToken).build(); } else { break; } } } -
listViolations
public final AssuredWorkloadsServiceClient.ListViolationsPagedResponse listViolations(WorkloadName parent) Lists the Violations in the AssuredWorkload Environment. Callers may also choose to read across multiple Workloads as per [AIP-159](https://google.aip.dev/159) by using '-' (the hyphen or dash character) as a wildcard character instead of workload-id in the parent. Format `organizations/{org_id}/locations/{location}/workloads/-`Sample code:
// 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://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (AssuredWorkloadsServiceClient assuredWorkloadsServiceClient = AssuredWorkloadsServiceClient.create()) { WorkloadName parent = WorkloadName.of("[ORGANIZATION]", "[LOCATION]", "[WORKLOAD]"); for (Violation element : assuredWorkloadsServiceClient.listViolations(parent).iterateAll()) { // doThingsWith(element); } }- Parameters:
parent- Required. The Workload name. Format `organizations/{org_id}/locations/{location}/workloads/{workload}`.- Throws:
ApiException- if the remote call fails
-
listViolations
public final AssuredWorkloadsServiceClient.ListViolationsPagedResponse listViolations(String parent) Lists the Violations in the AssuredWorkload Environment. Callers may also choose to read across multiple Workloads as per [AIP-159](https://google.aip.dev/159) by using '-' (the hyphen or dash character) as a wildcard character instead of workload-id in the parent. Format `organizations/{org_id}/locations/{location}/workloads/-`Sample code:
// 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://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (AssuredWorkloadsServiceClient assuredWorkloadsServiceClient = AssuredWorkloadsServiceClient.create()) { String parent = WorkloadName.of("[ORGANIZATION]", "[LOCATION]", "[WORKLOAD]").toString(); for (Violation element : assuredWorkloadsServiceClient.listViolations(parent).iterateAll()) { // doThingsWith(element); } }- Parameters:
parent- Required. The Workload name. Format `organizations/{org_id}/locations/{location}/workloads/{workload}`.- Throws:
ApiException- if the remote call fails
-
listViolations
public final AssuredWorkloadsServiceClient.ListViolationsPagedResponse listViolations(ListViolationsRequest request) Lists the Violations in the AssuredWorkload Environment. Callers may also choose to read across multiple Workloads as per [AIP-159](https://google.aip.dev/159) by using '-' (the hyphen or dash character) as a wildcard character instead of workload-id in the parent. Format `organizations/{org_id}/locations/{location}/workloads/-`Sample code:
// 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://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (AssuredWorkloadsServiceClient assuredWorkloadsServiceClient = AssuredWorkloadsServiceClient.create()) { ListViolationsRequest request = ListViolationsRequest.newBuilder() .setParent(WorkloadName.of("[ORGANIZATION]", "[LOCATION]", "[WORKLOAD]").toString()) .setInterval(TimeWindow.newBuilder().build()) .setPageSize(883849137) .setPageToken("pageToken873572522") .setFilter("filter-1274492040") .build(); for (Violation element : assuredWorkloadsServiceClient.listViolations(request).iterateAll()) { // doThingsWith(element); } }- Parameters:
request- The request object containing all of the parameters for the API call.- Throws:
ApiException- if the remote call fails
-
listViolationsPagedCallable
public final UnaryCallable<ListViolationsRequest,AssuredWorkloadsServiceClient.ListViolationsPagedResponse> listViolationsPagedCallable()Lists the Violations in the AssuredWorkload Environment. Callers may also choose to read across multiple Workloads as per [AIP-159](https://google.aip.dev/159) by using '-' (the hyphen or dash character) as a wildcard character instead of workload-id in the parent. Format `organizations/{org_id}/locations/{location}/workloads/-`Sample code:
// 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://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (AssuredWorkloadsServiceClient assuredWorkloadsServiceClient = AssuredWorkloadsServiceClient.create()) { ListViolationsRequest request = ListViolationsRequest.newBuilder() .setParent(WorkloadName.of("[ORGANIZATION]", "[LOCATION]", "[WORKLOAD]").toString()) .setInterval(TimeWindow.newBuilder().build()) .setPageSize(883849137) .setPageToken("pageToken873572522") .setFilter("filter-1274492040") .build(); ApiFuture<Violation> future = assuredWorkloadsServiceClient.listViolationsPagedCallable().futureCall(request); // Do something. for (Violation element : future.get().iterateAll()) { // doThingsWith(element); } } -
listViolationsCallable
Lists the Violations in the AssuredWorkload Environment. Callers may also choose to read across multiple Workloads as per [AIP-159](https://google.aip.dev/159) by using '-' (the hyphen or dash character) as a wildcard character instead of workload-id in the parent. Format `organizations/{org_id}/locations/{location}/workloads/-`Sample code:
// 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://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (AssuredWorkloadsServiceClient assuredWorkloadsServiceClient = AssuredWorkloadsServiceClient.create()) { ListViolationsRequest request = ListViolationsRequest.newBuilder() .setParent(WorkloadName.of("[ORGANIZATION]", "[LOCATION]", "[WORKLOAD]").toString()) .setInterval(TimeWindow.newBuilder().build()) .setPageSize(883849137) .setPageToken("pageToken873572522") .setFilter("filter-1274492040") .build(); while (true) { ListViolationsResponse response = assuredWorkloadsServiceClient.listViolationsCallable().call(request); for (Violation element : response.getViolationsList()) { // doThingsWith(element); } String nextPageToken = response.getNextPageToken(); if (!Strings.isNullOrEmpty(nextPageToken)) { request = request.toBuilder().setPageToken(nextPageToken).build(); } else { break; } } } -
getViolation
Retrieves Assured Workload Violation based on ID.Sample code:
// 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://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (AssuredWorkloadsServiceClient assuredWorkloadsServiceClient = AssuredWorkloadsServiceClient.create()) { ViolationName name = ViolationName.of("[ORGANIZATION]", "[LOCATION]", "[WORKLOAD]", "[VIOLATION]"); Violation response = assuredWorkloadsServiceClient.getViolation(name); }- Parameters:
name- Required. The resource name of the Violation to fetch (ie. Violation.name). Format: organizations/{organization}/locations/{location}/workloads/{workload}/violations/{violation}- Throws:
ApiException- if the remote call fails
-
getViolation
Retrieves Assured Workload Violation based on ID.Sample code:
// 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://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (AssuredWorkloadsServiceClient assuredWorkloadsServiceClient = AssuredWorkloadsServiceClient.create()) { String name = ViolationName.of("[ORGANIZATION]", "[LOCATION]", "[WORKLOAD]", "[VIOLATION]").toString(); Violation response = assuredWorkloadsServiceClient.getViolation(name); }- Parameters:
name- Required. The resource name of the Violation to fetch (ie. Violation.name). Format: organizations/{organization}/locations/{location}/workloads/{workload}/violations/{violation}- Throws:
ApiException- if the remote call fails
-
getViolation
Retrieves Assured Workload Violation based on ID.Sample code:
// 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://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (AssuredWorkloadsServiceClient assuredWorkloadsServiceClient = AssuredWorkloadsServiceClient.create()) { GetViolationRequest request = GetViolationRequest.newBuilder() .setName( ViolationName.of("[ORGANIZATION]", "[LOCATION]", "[WORKLOAD]", "[VIOLATION]") .toString()) .build(); Violation response = assuredWorkloadsServiceClient.getViolation(request); }- Parameters:
request- The request object containing all of the parameters for the API call.- Throws:
ApiException- if the remote call fails
-
getViolationCallable
Retrieves Assured Workload Violation based on ID.Sample code:
// 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://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (AssuredWorkloadsServiceClient assuredWorkloadsServiceClient = AssuredWorkloadsServiceClient.create()) { GetViolationRequest request = GetViolationRequest.newBuilder() .setName( ViolationName.of("[ORGANIZATION]", "[LOCATION]", "[WORKLOAD]", "[VIOLATION]") .toString()) .build(); ApiFuture<Violation> future = assuredWorkloadsServiceClient.getViolationCallable().futureCall(request); // Do something. Violation response = future.get(); } -
acknowledgeViolation
Acknowledges an existing violation. By acknowledging a violation, users acknowledge the existence of a compliance violation in their workload and decide to ignore it due to a valid business justification. Acknowledgement is a permanent operation and it cannot be reverted.Sample code:
// 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://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (AssuredWorkloadsServiceClient assuredWorkloadsServiceClient = AssuredWorkloadsServiceClient.create()) { AcknowledgeViolationRequest request = AcknowledgeViolationRequest.newBuilder() .setName("name3373707") .setComment("comment950398559") .setNonCompliantOrgPolicy("nonCompliantOrgPolicy-1928466552") .build(); AcknowledgeViolationResponse response = assuredWorkloadsServiceClient.acknowledgeViolation(request); }- Parameters:
request- The request object containing all of the parameters for the API call.- Throws:
ApiException- if the remote call fails
-
acknowledgeViolationCallable
public final UnaryCallable<AcknowledgeViolationRequest,AcknowledgeViolationResponse> acknowledgeViolationCallable()Acknowledges an existing violation. By acknowledging a violation, users acknowledge the existence of a compliance violation in their workload and decide to ignore it due to a valid business justification. Acknowledgement is a permanent operation and it cannot be reverted.Sample code:
// 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://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (AssuredWorkloadsServiceClient assuredWorkloadsServiceClient = AssuredWorkloadsServiceClient.create()) { AcknowledgeViolationRequest request = AcknowledgeViolationRequest.newBuilder() .setName("name3373707") .setComment("comment950398559") .setNonCompliantOrgPolicy("nonCompliantOrgPolicy-1928466552") .build(); ApiFuture<AcknowledgeViolationResponse> future = assuredWorkloadsServiceClient.acknowledgeViolationCallable().futureCall(request); // Do something. AcknowledgeViolationResponse response = future.get(); } -
close
public final void close()- Specified by:
closein interfaceAutoCloseable
-
shutdown
public void shutdown()- Specified by:
shutdownin interfaceBackgroundResource
-
isShutdown
public boolean isShutdown()- Specified by:
isShutdownin interfaceBackgroundResource
-
isTerminated
public boolean isTerminated()- Specified by:
isTerminatedin interfaceBackgroundResource
-
shutdownNow
public void shutdownNow()- Specified by:
shutdownNowin interfaceBackgroundResource
-
awaitTermination
- Specified by:
awaitTerminationin interfaceBackgroundResource- Throws:
InterruptedException
-