@Generated(value="by gapic-generator-java") public class AssuredWorkloadsServiceClient extends Object implements com.google.api.gax.core.BackgroundResource
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().
The surface of this class includes several types of Java methods for each of the API's methods:
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.
| Modifier and Type | Class and Description |
|---|---|
static class |
AssuredWorkloadsServiceClient.ListViolationsFixedSizeCollection |
static class |
AssuredWorkloadsServiceClient.ListViolationsPage |
static class |
AssuredWorkloadsServiceClient.ListViolationsPagedResponse |
static class |
AssuredWorkloadsServiceClient.ListWorkloadsFixedSizeCollection |
static class |
AssuredWorkloadsServiceClient.ListWorkloadsPage |
static class |
AssuredWorkloadsServiceClient.ListWorkloadsPagedResponse |
| Modifier | Constructor and Description |
|---|---|
protected |
AssuredWorkloadsServiceClient(AssuredWorkloadsServiceSettings settings)
Constructs an instance of AssuredWorkloadsServiceClient, using the given settings.
|
protected |
AssuredWorkloadsServiceClient(AssuredWorkloadsServiceStub stub) |
| Modifier and Type | Method and Description |
|---|---|
AcknowledgeViolationResponse |
acknowledgeViolation(AcknowledgeViolationRequest request)
Acknowledges an existing violation.
|
com.google.api.gax.rpc.UnaryCallable<AcknowledgeViolationRequest,AcknowledgeViolationResponse> |
acknowledgeViolationCallable()
Acknowledges an existing violation.
|
boolean |
awaitTermination(long duration,
TimeUnit unit) |
void |
close() |
static AssuredWorkloadsServiceClient |
create()
Constructs an instance of AssuredWorkloadsServiceClient with default settings.
|
static AssuredWorkloadsServiceClient |
create(AssuredWorkloadsServiceSettings settings)
Constructs an instance of AssuredWorkloadsServiceClient, using the given settings.
|
static AssuredWorkloadsServiceClient |
create(AssuredWorkloadsServiceStub stub)
Constructs an instance of AssuredWorkloadsServiceClient, using the given stub for making calls.
|
com.google.api.gax.longrunning.OperationFuture<Workload,CreateWorkloadOperationMetadata> |
createWorkloadAsync(CreateWorkloadRequest request)
Creates Assured Workload.
|
com.google.api.gax.longrunning.OperationFuture<Workload,CreateWorkloadOperationMetadata> |
createWorkloadAsync(LocationName parent,
Workload workload)
Creates Assured Workload.
|
com.google.api.gax.longrunning.OperationFuture<Workload,CreateWorkloadOperationMetadata> |
createWorkloadAsync(String parent,
Workload workload)
Creates Assured Workload.
|
com.google.api.gax.rpc.UnaryCallable<CreateWorkloadRequest,com.google.longrunning.Operation> |
createWorkloadCallable()
Creates Assured Workload.
|
com.google.api.gax.rpc.OperationCallable<CreateWorkloadRequest,Workload,CreateWorkloadOperationMetadata> |
createWorkloadOperationCallable()
Creates Assured Workload.
|
void |
deleteWorkload(DeleteWorkloadRequest request)
Deletes the workload.
|
void |
deleteWorkload(String name)
Deletes the workload.
|
void |
deleteWorkload(WorkloadName name)
Deletes the workload.
|
com.google.api.gax.rpc.UnaryCallable<DeleteWorkloadRequest,com.google.protobuf.Empty> |
deleteWorkloadCallable()
Deletes the workload.
|
com.google.api.gax.httpjson.longrunning.OperationsClient |
getHttpJsonOperationsClient()
Returns the OperationsClient that can be used to query the status of a long-running operation
returned by another API method call.
|
com.google.longrunning.OperationsClient |
getOperationsClient()
Returns the OperationsClient that can be used to query the status of a long-running operation
returned by another API method call.
|
AssuredWorkloadsServiceSettings |
getSettings() |
AssuredWorkloadsServiceStub |
getStub() |
Violation |
getViolation(GetViolationRequest request)
Retrieves Assured Workload Violation based on ID.
|
Violation |
getViolation(String name)
Retrieves Assured Workload Violation based on ID.
|
Violation |
getViolation(ViolationName name)
Retrieves Assured Workload Violation based on ID.
|
com.google.api.gax.rpc.UnaryCallable<GetViolationRequest,Violation> |
getViolationCallable()
Retrieves Assured Workload Violation based on ID.
|
Workload |
getWorkload(GetWorkloadRequest request)
Gets Assured Workload associated with a CRM Node
|
Workload |
getWorkload(String name)
Gets Assured Workload associated with a CRM Node
|
Workload |
getWorkload(WorkloadName name)
Gets Assured Workload associated with a CRM Node
|
com.google.api.gax.rpc.UnaryCallable<GetWorkloadRequest,Workload> |
getWorkloadCallable()
Gets Assured Workload associated with a CRM Node
|
boolean |
isShutdown() |
boolean |
isTerminated() |
AssuredWorkloadsServiceClient.ListViolationsPagedResponse |
listViolations(ListViolationsRequest request)
Lists the Violations in the AssuredWorkload Environment.
|
AssuredWorkloadsServiceClient.ListViolationsPagedResponse |
listViolations(String parent)
Lists the Violations in the AssuredWorkload Environment.
|
AssuredWorkloadsServiceClient.ListViolationsPagedResponse |
listViolations(WorkloadName parent)
Lists the Violations in the AssuredWorkload Environment.
|
com.google.api.gax.rpc.UnaryCallable<ListViolationsRequest,ListViolationsResponse> |
listViolationsCallable()
Lists the Violations in the AssuredWorkload Environment.
|
com.google.api.gax.rpc.UnaryCallable<ListViolationsRequest,AssuredWorkloadsServiceClient.ListViolationsPagedResponse> |
listViolationsPagedCallable()
Lists the Violations in the AssuredWorkload Environment.
|
AssuredWorkloadsServiceClient.ListWorkloadsPagedResponse |
listWorkloads(ListWorkloadsRequest request)
Lists Assured Workloads under a CRM Node.
|
AssuredWorkloadsServiceClient.ListWorkloadsPagedResponse |
listWorkloads(LocationName parent)
Lists Assured Workloads under a CRM Node.
|
AssuredWorkloadsServiceClient.ListWorkloadsPagedResponse |
listWorkloads(String parent)
Lists Assured Workloads under a CRM Node.
|
com.google.api.gax.rpc.UnaryCallable<ListWorkloadsRequest,ListWorkloadsResponse> |
listWorkloadsCallable()
Lists Assured Workloads under a CRM Node.
|
com.google.api.gax.rpc.UnaryCallable<ListWorkloadsRequest,AssuredWorkloadsServiceClient.ListWorkloadsPagedResponse> |
listWorkloadsPagedCallable()
Lists Assured Workloads under a CRM Node.
|
RestrictAllowedResourcesResponse |
restrictAllowedResources(RestrictAllowedResourcesRequest request)
Restrict the list of resources allowed in the Workload environment.
|
com.google.api.gax.rpc.UnaryCallable<RestrictAllowedResourcesRequest,RestrictAllowedResourcesResponse> |
restrictAllowedResourcesCallable()
Restrict the list of resources allowed in the Workload environment.
|
void |
shutdown() |
void |
shutdownNow() |
Workload |
updateWorkload(UpdateWorkloadRequest request)
Updates an existing workload.
|
Workload |
updateWorkload(Workload workload,
com.google.protobuf.FieldMask updateMask)
Updates an existing workload.
|
com.google.api.gax.rpc.UnaryCallable<UpdateWorkloadRequest,Workload> |
updateWorkloadCallable()
Updates an existing workload.
|
protected AssuredWorkloadsServiceClient(AssuredWorkloadsServiceSettings settings) throws IOException
IOExceptionprotected AssuredWorkloadsServiceClient(AssuredWorkloadsServiceStub stub)
public static final AssuredWorkloadsServiceClient create() throws IOException
IOExceptionpublic static final AssuredWorkloadsServiceClient create(AssuredWorkloadsServiceSettings settings) throws IOException
IOExceptionpublic static final AssuredWorkloadsServiceClient create(AssuredWorkloadsServiceStub stub)
public final AssuredWorkloadsServiceSettings getSettings()
public AssuredWorkloadsServiceStub getStub()
public final com.google.longrunning.OperationsClient getOperationsClient()
@BetaApi public final com.google.api.gax.httpjson.longrunning.OperationsClient getHttpJsonOperationsClient()
public final com.google.api.gax.longrunning.OperationFuture<Workload,CreateWorkloadOperationMetadata> createWorkloadAsync(LocationName parent, Workload 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();
}
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 createcom.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.longrunning.OperationFuture<Workload,CreateWorkloadOperationMetadata> createWorkloadAsync(String parent, Workload 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();
}
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 createcom.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.longrunning.OperationFuture<Workload,CreateWorkloadOperationMetadata> createWorkloadAsync(CreateWorkloadRequest request)
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();
}
request - The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.rpc.OperationCallable<CreateWorkloadRequest,Workload,CreateWorkloadOperationMetadata> createWorkloadOperationCallable()
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();
}
public final com.google.api.gax.rpc.UnaryCallable<CreateWorkloadRequest,com.google.longrunning.Operation> createWorkloadCallable()
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();
}
public final Workload updateWorkload(Workload workload, com.google.protobuf.FieldMask updateMask)
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);
}
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.com.google.api.gax.rpc.ApiException - if the remote call failspublic final Workload updateWorkload(UpdateWorkloadRequest request)
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);
}
request - The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.rpc.UnaryCallable<UpdateWorkloadRequest,Workload> updateWorkloadCallable()
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();
}
public final RestrictAllowedResourcesResponse restrictAllowedResources(RestrictAllowedResourcesRequest request)
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);
}
request - The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.rpc.UnaryCallable<RestrictAllowedResourcesRequest,RestrictAllowedResourcesResponse> restrictAllowedResourcesCallable()
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();
}
public final void deleteWorkload(WorkloadName name)
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);
}
name - Required. The `name` field is used to identify the workload. Format:
organizations/{org_id}/locations/{location_id}/workloads/{workload_id}com.google.api.gax.rpc.ApiException - if the remote call failspublic final void deleteWorkload(String name)
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);
}
name - Required. The `name` field is used to identify the workload. Format:
organizations/{org_id}/locations/{location_id}/workloads/{workload_id}com.google.api.gax.rpc.ApiException - if the remote call failspublic final void deleteWorkload(DeleteWorkloadRequest request)
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);
}
request - The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.rpc.UnaryCallable<DeleteWorkloadRequest,com.google.protobuf.Empty> deleteWorkloadCallable()
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();
}
public final Workload getWorkload(WorkloadName name)
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]");
Workload response = assuredWorkloadsServiceClient.getWorkload(name);
}
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".com.google.api.gax.rpc.ApiException - if the remote call failspublic final Workload getWorkload(String name)
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();
Workload response = assuredWorkloadsServiceClient.getWorkload(name);
}
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".com.google.api.gax.rpc.ApiException - if the remote call failspublic final Workload getWorkload(GetWorkloadRequest request)
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()) {
GetWorkloadRequest request =
GetWorkloadRequest.newBuilder()
.setName(WorkloadName.of("[ORGANIZATION]", "[LOCATION]", "[WORKLOAD]").toString())
.build();
Workload response = assuredWorkloadsServiceClient.getWorkload(request);
}
request - The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.rpc.UnaryCallable<GetWorkloadRequest,Workload> getWorkloadCallable()
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()) {
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();
}
public final AssuredWorkloadsServiceClient.ListWorkloadsPagedResponse listWorkloads(LocationName parent)
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);
}
}
parent - Required. Parent Resource to list workloads from. Must be of the form
`organizations/{org_id}/locations/{location}`.com.google.api.gax.rpc.ApiException - if the remote call failspublic final AssuredWorkloadsServiceClient.ListWorkloadsPagedResponse listWorkloads(String parent)
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);
}
}
parent - Required. Parent Resource to list workloads from. Must be of the form
`organizations/{org_id}/locations/{location}`.com.google.api.gax.rpc.ApiException - if the remote call failspublic final AssuredWorkloadsServiceClient.ListWorkloadsPagedResponse listWorkloads(ListWorkloadsRequest request)
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);
}
}
request - The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.rpc.UnaryCallable<ListWorkloadsRequest,AssuredWorkloadsServiceClient.ListWorkloadsPagedResponse> listWorkloadsPagedCallable()
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);
}
}
public final com.google.api.gax.rpc.UnaryCallable<ListWorkloadsRequest,ListWorkloadsResponse> listWorkloadsCallable()
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;
}
}
}
public final AssuredWorkloadsServiceClient.ListViolationsPagedResponse listViolations(WorkloadName parent)
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);
}
}
parent - Required. The Workload name. Format
`organizations/{org_id}/locations/{location}/workloads/{workload}`.com.google.api.gax.rpc.ApiException - if the remote call failspublic final AssuredWorkloadsServiceClient.ListViolationsPagedResponse listViolations(String parent)
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);
}
}
parent - Required. The Workload name. Format
`organizations/{org_id}/locations/{location}/workloads/{workload}`.com.google.api.gax.rpc.ApiException - if the remote call failspublic final AssuredWorkloadsServiceClient.ListViolationsPagedResponse listViolations(ListViolationsRequest request)
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);
}
}
request - The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.rpc.UnaryCallable<ListViolationsRequest,AssuredWorkloadsServiceClient.ListViolationsPagedResponse> listViolationsPagedCallable()
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);
}
}
public final com.google.api.gax.rpc.UnaryCallable<ListViolationsRequest,ListViolationsResponse> listViolationsCallable()
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;
}
}
}
public final Violation getViolation(ViolationName name)
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);
}
name - Required. The resource name of the Violation to fetch (ie. Violation.name). Format:
organizations/{organization}/locations/{location}/workloads/{workload}/violations/{violation}com.google.api.gax.rpc.ApiException - if the remote call failspublic final Violation getViolation(String name)
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);
}
name - Required. The resource name of the Violation to fetch (ie. Violation.name). Format:
organizations/{organization}/locations/{location}/workloads/{workload}/violations/{violation}com.google.api.gax.rpc.ApiException - if the remote call failspublic final Violation getViolation(GetViolationRequest request)
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);
}
request - The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.rpc.UnaryCallable<GetViolationRequest,Violation> getViolationCallable()
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();
}
public final AcknowledgeViolationResponse acknowledgeViolation(AcknowledgeViolationRequest request)
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);
}
request - The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.rpc.UnaryCallable<AcknowledgeViolationRequest,AcknowledgeViolationResponse> acknowledgeViolationCallable()
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();
}
public final void close()
close in interface AutoCloseablepublic void shutdown()
shutdown in interface com.google.api.gax.core.BackgroundResourcepublic boolean isShutdown()
isShutdown in interface com.google.api.gax.core.BackgroundResourcepublic boolean isTerminated()
isTerminated in interface com.google.api.gax.core.BackgroundResourcepublic void shutdownNow()
shutdownNow in interface com.google.api.gax.core.BackgroundResourcepublic boolean awaitTermination(long duration,
TimeUnit unit)
throws InterruptedException
awaitTermination in interface com.google.api.gax.core.BackgroundResourceInterruptedExceptionCopyright © 2022 Google LLC. All rights reserved.