- 2.56.0 (latest)
- 2.55.0
- 2.54.0
- 2.53.0
- 2.51.0
- 2.50.0
- 2.49.0
- 2.48.0
- 2.47.0
- 2.46.0
- 2.45.0
- 2.44.0
- 2.43.0
- 2.42.0
- 2.41.0
- 2.39.0
- 2.38.0
- 2.37.0
- 2.36.0
- 2.35.0
- 2.34.0
- 2.33.0
- 2.32.0
- 2.31.0
- 2.30.0
- 2.29.0
- 2.26.0
- 2.25.0
- 2.24.0
- 2.23.0
- 2.22.0
- 2.21.0
- 2.20.0
- 2.19.0
- 2.18.0
- 2.17.0
- 2.16.0
- 2.15.0
- 2.14.0
- 2.13.0
- 2.11.0
- 2.10.0
- 2.9.0
- 2.8.0
- 2.7.0
- 2.6.0
- 2.5.6
- 2.4.3
- 2.3.2
public class OsConfigZonalServiceClient implements BackgroundResource
Service Description: Zonal OS Config API
The OS Config service is the server-side component that allows users to manage package installations and patch jobs for Compute Engine VM instances.
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 (OsConfigZonalServiceClient osConfigZonalServiceClient =
OsConfigZonalServiceClient.create()) {
OSPolicyAssignmentName name =
OSPolicyAssignmentName.of("[PROJECT]", "[LOCATION]", "[OS_POLICY_ASSIGNMENT]");
OSPolicyAssignment response = osConfigZonalServiceClient.getOSPolicyAssignment(name);
}
Note: close() needs to be called on the OsConfigZonalServiceClient 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:
- A "flattened" method. With this type of method, the fields of the request type have been converted into function parameters. It may be the case that not all fields are available as parameters, and not every API method will have a flattened method entry point.
- A "request object" method. This type of method only takes one parameter, a request object, which must be constructed before the call. Not every API method will have a request object method.
- A "callable" method. This type of method takes no parameters and returns 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 OsConfigZonalServiceSettings 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
OsConfigZonalServiceSettings osConfigZonalServiceSettings =
OsConfigZonalServiceSettings.newBuilder()
.setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
.build();
OsConfigZonalServiceClient osConfigZonalServiceClient =
OsConfigZonalServiceClient.create(osConfigZonalServiceSettings);
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
OsConfigZonalServiceSettings osConfigZonalServiceSettings =
OsConfigZonalServiceSettings.newBuilder().setEndpoint(myEndpoint).build();
OsConfigZonalServiceClient osConfigZonalServiceClient =
OsConfigZonalServiceClient.create(osConfigZonalServiceSettings);
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
OsConfigZonalServiceSettings osConfigZonalServiceSettings =
OsConfigZonalServiceSettings.newHttpJsonBuilder().build();
OsConfigZonalServiceClient osConfigZonalServiceClient =
OsConfigZonalServiceClient.create(osConfigZonalServiceSettings);
Please refer to the GitHub repository's samples for more quickstart code snippets.
Implements
BackgroundResourceStatic Methods
create()
public static final OsConfigZonalServiceClient create()
Constructs an instance of OsConfigZonalServiceClient with default settings.
Returns | |
---|---|
Type | Description |
OsConfigZonalServiceClient |
Exceptions | |
---|---|
Type | Description |
IOException |
create(OsConfigZonalServiceSettings settings)
public static final OsConfigZonalServiceClient create(OsConfigZonalServiceSettings settings)
Constructs an instance of OsConfigZonalServiceClient, using the given settings. The channels are created based on the settings passed in, or defaults for any settings that are not set.
Parameter | |
---|---|
Name | Description |
settings | OsConfigZonalServiceSettings |
Returns | |
---|---|
Type | Description |
OsConfigZonalServiceClient |
Exceptions | |
---|---|
Type | Description |
IOException |
create(OsConfigZonalServiceStub stub)
public static final OsConfigZonalServiceClient create(OsConfigZonalServiceStub stub)
Constructs an instance of OsConfigZonalServiceClient, using the given stub for making calls. This is for advanced usage - prefer using create(OsConfigZonalServiceSettings).
Parameter | |
---|---|
Name | Description |
stub | OsConfigZonalServiceStub |
Returns | |
---|---|
Type | Description |
OsConfigZonalServiceClient |
Constructors
OsConfigZonalServiceClient(OsConfigZonalServiceSettings settings)
protected OsConfigZonalServiceClient(OsConfigZonalServiceSettings settings)
Constructs an instance of OsConfigZonalServiceClient, 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.
Parameter | |
---|---|
Name | Description |
settings | OsConfigZonalServiceSettings |
OsConfigZonalServiceClient(OsConfigZonalServiceStub stub)
protected OsConfigZonalServiceClient(OsConfigZonalServiceStub stub)
Parameter | |
---|---|
Name | Description |
stub | OsConfigZonalServiceStub |
Methods
awaitTermination(long duration, TimeUnit unit)
public boolean awaitTermination(long duration, TimeUnit unit)
Parameters | |
---|---|
Name | Description |
duration | long |
unit | TimeUnit |
Returns | |
---|---|
Type | Description |
boolean |
Exceptions | |
---|---|
Type | Description |
InterruptedException |
close()
public final void close()
createOSPolicyAssignmentAsync(CreateOSPolicyAssignmentRequest request)
public final OperationFuture<OSPolicyAssignment,OSPolicyAssignmentOperationMetadata> createOSPolicyAssignmentAsync(CreateOSPolicyAssignmentRequest request)
Create an OS policy assignment.
This method also creates the first revision of the OS policy assignment.
This method returns a long running operation (LRO) that contains the rollout details. The rollout can be cancelled by cancelling the LRO.
For more information, see Method: projects.locations.osPolicyAssignments.operations.cancel.
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 (OsConfigZonalServiceClient osConfigZonalServiceClient =
OsConfigZonalServiceClient.create()) {
CreateOSPolicyAssignmentRequest request =
CreateOSPolicyAssignmentRequest.newBuilder()
.setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
.setOsPolicyAssignment(OSPolicyAssignment.newBuilder().build())
.setOsPolicyAssignmentId("osPolicyAssignmentId-44079074")
.build();
OSPolicyAssignment response =
osConfigZonalServiceClient.createOSPolicyAssignmentAsync(request).get();
}
Parameter | |
---|---|
Name | Description |
request | CreateOSPolicyAssignmentRequest The request object containing all of the parameters for the API call. |
Returns | |
---|---|
Type | Description |
OperationFuture<OSPolicyAssignment,OSPolicyAssignmentOperationMetadata> |
createOSPolicyAssignmentAsync(LocationName parent, OSPolicyAssignment osPolicyAssignment, String osPolicyAssignmentId)
public final OperationFuture<OSPolicyAssignment,OSPolicyAssignmentOperationMetadata> createOSPolicyAssignmentAsync(LocationName parent, OSPolicyAssignment osPolicyAssignment, String osPolicyAssignmentId)
Create an OS policy assignment.
This method also creates the first revision of the OS policy assignment.
This method returns a long running operation (LRO) that contains the rollout details. The rollout can be cancelled by cancelling the LRO.
For more information, see Method: projects.locations.osPolicyAssignments.operations.cancel.
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 (OsConfigZonalServiceClient osConfigZonalServiceClient =
OsConfigZonalServiceClient.create()) {
LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
OSPolicyAssignment osPolicyAssignment = OSPolicyAssignment.newBuilder().build();
String osPolicyAssignmentId = "osPolicyAssignmentId-44079074";
OSPolicyAssignment response =
osConfigZonalServiceClient
.createOSPolicyAssignmentAsync(parent, osPolicyAssignment, osPolicyAssignmentId)
.get();
}
Parameters | |
---|---|
Name | Description |
parent | LocationName Required. The parent resource name in the form: projects/{project}/locations/{location} |
osPolicyAssignment | OSPolicyAssignment Required. The OS policy assignment to be created. |
osPolicyAssignmentId | String Required. The logical name of the OS policy assignment in the project with the following restrictions:
|
Returns | |
---|---|
Type | Description |
OperationFuture<OSPolicyAssignment,OSPolicyAssignmentOperationMetadata> |
createOSPolicyAssignmentAsync(String parent, OSPolicyAssignment osPolicyAssignment, String osPolicyAssignmentId)
public final OperationFuture<OSPolicyAssignment,OSPolicyAssignmentOperationMetadata> createOSPolicyAssignmentAsync(String parent, OSPolicyAssignment osPolicyAssignment, String osPolicyAssignmentId)
Create an OS policy assignment.
This method also creates the first revision of the OS policy assignment.
This method returns a long running operation (LRO) that contains the rollout details. The rollout can be cancelled by cancelling the LRO.
For more information, see Method: projects.locations.osPolicyAssignments.operations.cancel.
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 (OsConfigZonalServiceClient osConfigZonalServiceClient =
OsConfigZonalServiceClient.create()) {
String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString();
OSPolicyAssignment osPolicyAssignment = OSPolicyAssignment.newBuilder().build();
String osPolicyAssignmentId = "osPolicyAssignmentId-44079074";
OSPolicyAssignment response =
osConfigZonalServiceClient
.createOSPolicyAssignmentAsync(parent, osPolicyAssignment, osPolicyAssignmentId)
.get();
}
Parameters | |
---|---|
Name | Description |
parent | String Required. The parent resource name in the form: projects/{project}/locations/{location} |
osPolicyAssignment | OSPolicyAssignment Required. The OS policy assignment to be created. |
osPolicyAssignmentId | String Required. The logical name of the OS policy assignment in the project with the following restrictions:
|
Returns | |
---|---|
Type | Description |
OperationFuture<OSPolicyAssignment,OSPolicyAssignmentOperationMetadata> |
createOSPolicyAssignmentCallable()
public final UnaryCallable<CreateOSPolicyAssignmentRequest,Operation> createOSPolicyAssignmentCallable()
Create an OS policy assignment.
This method also creates the first revision of the OS policy assignment.
This method returns a long running operation (LRO) that contains the rollout details. The rollout can be cancelled by cancelling the LRO.
For more information, see Method: projects.locations.osPolicyAssignments.operations.cancel.
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 (OsConfigZonalServiceClient osConfigZonalServiceClient =
OsConfigZonalServiceClient.create()) {
CreateOSPolicyAssignmentRequest request =
CreateOSPolicyAssignmentRequest.newBuilder()
.setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
.setOsPolicyAssignment(OSPolicyAssignment.newBuilder().build())
.setOsPolicyAssignmentId("osPolicyAssignmentId-44079074")
.build();
ApiFuture<Operation> future =
osConfigZonalServiceClient.createOSPolicyAssignmentCallable().futureCall(request);
// Do something.
Operation response = future.get();
}
Returns | |
---|---|
Type | Description |
UnaryCallable<CreateOSPolicyAssignmentRequest,Operation> |
createOSPolicyAssignmentOperationCallable()
public final OperationCallable<CreateOSPolicyAssignmentRequest,OSPolicyAssignment,OSPolicyAssignmentOperationMetadata> createOSPolicyAssignmentOperationCallable()
Create an OS policy assignment.
This method also creates the first revision of the OS policy assignment.
This method returns a long running operation (LRO) that contains the rollout details. The rollout can be cancelled by cancelling the LRO.
For more information, see Method: projects.locations.osPolicyAssignments.operations.cancel.
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 (OsConfigZonalServiceClient osConfigZonalServiceClient =
OsConfigZonalServiceClient.create()) {
CreateOSPolicyAssignmentRequest request =
CreateOSPolicyAssignmentRequest.newBuilder()
.setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
.setOsPolicyAssignment(OSPolicyAssignment.newBuilder().build())
.setOsPolicyAssignmentId("osPolicyAssignmentId-44079074")
.build();
OperationFuture<OSPolicyAssignment, OSPolicyAssignmentOperationMetadata> future =
osConfigZonalServiceClient
.createOSPolicyAssignmentOperationCallable()
.futureCall(request);
// Do something.
OSPolicyAssignment response = future.get();
}
Returns | |
---|---|
Type | Description |
OperationCallable<CreateOSPolicyAssignmentRequest,OSPolicyAssignment,OSPolicyAssignmentOperationMetadata> |
deleteOSPolicyAssignmentAsync(DeleteOSPolicyAssignmentRequest request)
public final OperationFuture<Empty,OSPolicyAssignmentOperationMetadata> deleteOSPolicyAssignmentAsync(DeleteOSPolicyAssignmentRequest request)
Delete the OS policy assignment.
This method creates a new revision of the OS policy assignment.
This method returns a long running operation (LRO) that contains the rollout details. The rollout can be cancelled by cancelling the LRO.
If the LRO completes and is not cancelled, all revisions associated with the OS policy assignment are deleted.
For more information, see Method: projects.locations.osPolicyAssignments.operations.cancel.
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 (OsConfigZonalServiceClient osConfigZonalServiceClient =
OsConfigZonalServiceClient.create()) {
DeleteOSPolicyAssignmentRequest request =
DeleteOSPolicyAssignmentRequest.newBuilder()
.setName(
OSPolicyAssignmentName.of("[PROJECT]", "[LOCATION]", "[OS_POLICY_ASSIGNMENT]")
.toString())
.build();
osConfigZonalServiceClient.deleteOSPolicyAssignmentAsync(request).get();
}
Parameter | |
---|---|
Name | Description |
request | DeleteOSPolicyAssignmentRequest The request object containing all of the parameters for the API call. |
Returns | |
---|---|
Type | Description |
OperationFuture<Empty,OSPolicyAssignmentOperationMetadata> |
deleteOSPolicyAssignmentAsync(OSPolicyAssignmentName name)
public final OperationFuture<Empty,OSPolicyAssignmentOperationMetadata> deleteOSPolicyAssignmentAsync(OSPolicyAssignmentName name)
Delete the OS policy assignment.
This method creates a new revision of the OS policy assignment.
This method returns a long running operation (LRO) that contains the rollout details. The rollout can be cancelled by cancelling the LRO.
If the LRO completes and is not cancelled, all revisions associated with the OS policy assignment are deleted.
For more information, see Method: projects.locations.osPolicyAssignments.operations.cancel.
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 (OsConfigZonalServiceClient osConfigZonalServiceClient =
OsConfigZonalServiceClient.create()) {
OSPolicyAssignmentName name =
OSPolicyAssignmentName.of("[PROJECT]", "[LOCATION]", "[OS_POLICY_ASSIGNMENT]");
osConfigZonalServiceClient.deleteOSPolicyAssignmentAsync(name).get();
}
Parameter | |
---|---|
Name | Description |
name | OSPolicyAssignmentName Required. The name of the OS policy assignment to be deleted |
Returns | |
---|---|
Type | Description |
OperationFuture<Empty,OSPolicyAssignmentOperationMetadata> |
deleteOSPolicyAssignmentAsync(String name)
public final OperationFuture<Empty,OSPolicyAssignmentOperationMetadata> deleteOSPolicyAssignmentAsync(String name)
Delete the OS policy assignment.
This method creates a new revision of the OS policy assignment.
This method returns a long running operation (LRO) that contains the rollout details. The rollout can be cancelled by cancelling the LRO.
If the LRO completes and is not cancelled, all revisions associated with the OS policy assignment are deleted.
For more information, see Method: projects.locations.osPolicyAssignments.operations.cancel.
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 (OsConfigZonalServiceClient osConfigZonalServiceClient =
OsConfigZonalServiceClient.create()) {
String name =
OSPolicyAssignmentName.of("[PROJECT]", "[LOCATION]", "[OS_POLICY_ASSIGNMENT]").toString();
osConfigZonalServiceClient.deleteOSPolicyAssignmentAsync(name).get();
}
Parameter | |
---|---|
Name | Description |
name | String Required. The name of the OS policy assignment to be deleted |
Returns | |
---|---|
Type | Description |
OperationFuture<Empty,OSPolicyAssignmentOperationMetadata> |
deleteOSPolicyAssignmentCallable()
public final UnaryCallable<DeleteOSPolicyAssignmentRequest,Operation> deleteOSPolicyAssignmentCallable()
Delete the OS policy assignment.
This method creates a new revision of the OS policy assignment.
This method returns a long running operation (LRO) that contains the rollout details. The rollout can be cancelled by cancelling the LRO.
If the LRO completes and is not cancelled, all revisions associated with the OS policy assignment are deleted.
For more information, see Method: projects.locations.osPolicyAssignments.operations.cancel.
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 (OsConfigZonalServiceClient osConfigZonalServiceClient =
OsConfigZonalServiceClient.create()) {
DeleteOSPolicyAssignmentRequest request =
DeleteOSPolicyAssignmentRequest.newBuilder()
.setName(
OSPolicyAssignmentName.of("[PROJECT]", "[LOCATION]", "[OS_POLICY_ASSIGNMENT]")
.toString())
.build();
ApiFuture<Operation> future =
osConfigZonalServiceClient.deleteOSPolicyAssignmentCallable().futureCall(request);
// Do something.
future.get();
}
Returns | |
---|---|
Type | Description |
UnaryCallable<DeleteOSPolicyAssignmentRequest,Operation> |
deleteOSPolicyAssignmentOperationCallable()
public final OperationCallable<DeleteOSPolicyAssignmentRequest,Empty,OSPolicyAssignmentOperationMetadata> deleteOSPolicyAssignmentOperationCallable()
Delete the OS policy assignment.
This method creates a new revision of the OS policy assignment.
This method returns a long running operation (LRO) that contains the rollout details. The rollout can be cancelled by cancelling the LRO.
If the LRO completes and is not cancelled, all revisions associated with the OS policy assignment are deleted.
For more information, see Method: projects.locations.osPolicyAssignments.operations.cancel.
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 (OsConfigZonalServiceClient osConfigZonalServiceClient =
OsConfigZonalServiceClient.create()) {
DeleteOSPolicyAssignmentRequest request =
DeleteOSPolicyAssignmentRequest.newBuilder()
.setName(
OSPolicyAssignmentName.of("[PROJECT]", "[LOCATION]", "[OS_POLICY_ASSIGNMENT]")
.toString())
.build();
OperationFuture<Empty, OSPolicyAssignmentOperationMetadata> future =
osConfigZonalServiceClient
.deleteOSPolicyAssignmentOperationCallable()
.futureCall(request);
// Do something.
future.get();
}
Returns | |
---|---|
Type | Description |
OperationCallable<DeleteOSPolicyAssignmentRequest,Empty,OSPolicyAssignmentOperationMetadata> |
getHttpJsonOperationsClient()
public final OperationsClient getHttpJsonOperationsClient()
Returns the OperationsClient that can be used to query the status of a long-running operation returned by another API method call.
Returns | |
---|---|
Type | Description |
OperationsClient |
getInstanceOSPoliciesCompliance(GetInstanceOSPoliciesComplianceRequest request) (deprecated)
public final InstanceOSPoliciesCompliance getInstanceOSPoliciesCompliance(GetInstanceOSPoliciesComplianceRequest request)
Deprecated. This method is deprecated and will be removed in the next major version update.
Get OS policies compliance data for the specified Compute Engine VM instance.
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 (OsConfigZonalServiceClient osConfigZonalServiceClient =
OsConfigZonalServiceClient.create()) {
GetInstanceOSPoliciesComplianceRequest request =
GetInstanceOSPoliciesComplianceRequest.newBuilder()
.setName(
InstanceOSPoliciesComplianceName.of("[PROJECT]", "[LOCATION]", "[INSTANCE]")
.toString())
.build();
InstanceOSPoliciesCompliance response =
osConfigZonalServiceClient.getInstanceOSPoliciesCompliance(request);
}
Parameter | |
---|---|
Name | Description |
request | GetInstanceOSPoliciesComplianceRequest The request object containing all of the parameters for the API call. |
Returns | |
---|---|
Type | Description |
InstanceOSPoliciesCompliance |
getInstanceOSPoliciesCompliance(InstanceOSPoliciesComplianceName name) (deprecated)
public final InstanceOSPoliciesCompliance getInstanceOSPoliciesCompliance(InstanceOSPoliciesComplianceName name)
Deprecated. This method is deprecated and will be removed in the next major version update.
Get OS policies compliance data for the specified Compute Engine VM instance.
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 (OsConfigZonalServiceClient osConfigZonalServiceClient =
OsConfigZonalServiceClient.create()) {
InstanceOSPoliciesComplianceName name =
InstanceOSPoliciesComplianceName.of("[PROJECT]", "[LOCATION]", "[INSTANCE]");
InstanceOSPoliciesCompliance response =
osConfigZonalServiceClient.getInstanceOSPoliciesCompliance(name);
}
Parameter | |
---|---|
Name | Description |
name | InstanceOSPoliciesComplianceName Required. API resource name for instance OS policies compliance resource. Format:
For |
Returns | |
---|---|
Type | Description |
InstanceOSPoliciesCompliance |
getInstanceOSPoliciesCompliance(String name) (deprecated)
public final InstanceOSPoliciesCompliance getInstanceOSPoliciesCompliance(String name)
Deprecated. This method is deprecated and will be removed in the next major version update.
Get OS policies compliance data for the specified Compute Engine VM instance.
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 (OsConfigZonalServiceClient osConfigZonalServiceClient =
OsConfigZonalServiceClient.create()) {
String name =
InstanceOSPoliciesComplianceName.of("[PROJECT]", "[LOCATION]", "[INSTANCE]").toString();
InstanceOSPoliciesCompliance response =
osConfigZonalServiceClient.getInstanceOSPoliciesCompliance(name);
}
Parameter | |
---|---|
Name | Description |
name | String Required. API resource name for instance OS policies compliance resource. Format:
For |
Returns | |
---|---|
Type | Description |
InstanceOSPoliciesCompliance |
getInstanceOSPoliciesComplianceCallable() (deprecated)
public final UnaryCallable<GetInstanceOSPoliciesComplianceRequest,InstanceOSPoliciesCompliance> getInstanceOSPoliciesComplianceCallable()
Deprecated. This method is deprecated and will be removed in the next major version update.
Get OS policies compliance data for the specified Compute Engine VM instance.
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 (OsConfigZonalServiceClient osConfigZonalServiceClient =
OsConfigZonalServiceClient.create()) {
GetInstanceOSPoliciesComplianceRequest request =
GetInstanceOSPoliciesComplianceRequest.newBuilder()
.setName(
InstanceOSPoliciesComplianceName.of("[PROJECT]", "[LOCATION]", "[INSTANCE]")
.toString())
.build();
ApiFuture<InstanceOSPoliciesCompliance> future =
osConfigZonalServiceClient.getInstanceOSPoliciesComplianceCallable().futureCall(request);
// Do something.
InstanceOSPoliciesCompliance response = future.get();
}
Returns | |
---|---|
Type | Description |
UnaryCallable<GetInstanceOSPoliciesComplianceRequest,InstanceOSPoliciesCompliance> |
getInventory(GetInventoryRequest request)
public final Inventory getInventory(GetInventoryRequest request)
Get inventory data for the specified VM instance. If the VM has no associated inventory, the
message NOT_FOUND
is returned.
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 (OsConfigZonalServiceClient osConfigZonalServiceClient =
OsConfigZonalServiceClient.create()) {
GetInventoryRequest request =
GetInventoryRequest.newBuilder()
.setName(InventoryName.of("[PROJECT]", "[LOCATION]", "[INSTANCE]").toString())
.setView(InventoryView.forNumber(0))
.build();
Inventory response = osConfigZonalServiceClient.getInventory(request);
}
Parameter | |
---|---|
Name | Description |
request | GetInventoryRequest The request object containing all of the parameters for the API call. |
Returns | |
---|---|
Type | Description |
Inventory |
getInventory(InventoryName name)
public final Inventory getInventory(InventoryName name)
Get inventory data for the specified VM instance. If the VM has no associated inventory, the
message NOT_FOUND
is returned.
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 (OsConfigZonalServiceClient osConfigZonalServiceClient =
OsConfigZonalServiceClient.create()) {
InventoryName name = InventoryName.of("[PROJECT]", "[LOCATION]", "[INSTANCE]");
Inventory response = osConfigZonalServiceClient.getInventory(name);
}
Parameter | |
---|---|
Name | Description |
name | InventoryName Required. API resource name for inventory resource. Format: For |
Returns | |
---|---|
Type | Description |
Inventory |
getInventory(String name)
public final Inventory getInventory(String name)
Get inventory data for the specified VM instance. If the VM has no associated inventory, the
message NOT_FOUND
is returned.
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 (OsConfigZonalServiceClient osConfigZonalServiceClient =
OsConfigZonalServiceClient.create()) {
String name = InventoryName.of("[PROJECT]", "[LOCATION]", "[INSTANCE]").toString();
Inventory response = osConfigZonalServiceClient.getInventory(name);
}
Parameter | |
---|---|
Name | Description |
name | String Required. API resource name for inventory resource. Format: For |
Returns | |
---|---|
Type | Description |
Inventory |
getInventoryCallable()
public final UnaryCallable<GetInventoryRequest,Inventory> getInventoryCallable()
Get inventory data for the specified VM instance. If the VM has no associated inventory, the
message NOT_FOUND
is returned.
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 (OsConfigZonalServiceClient osConfigZonalServiceClient =
OsConfigZonalServiceClient.create()) {
GetInventoryRequest request =
GetInventoryRequest.newBuilder()
.setName(InventoryName.of("[PROJECT]", "[LOCATION]", "[INSTANCE]").toString())
.setView(InventoryView.forNumber(0))
.build();
ApiFuture<Inventory> future =
osConfigZonalServiceClient.getInventoryCallable().futureCall(request);
// Do something.
Inventory response = future.get();
}
Returns | |
---|---|
Type | Description |
UnaryCallable<GetInventoryRequest,Inventory> |
getOSPolicyAssignment(GetOSPolicyAssignmentRequest request)
public final OSPolicyAssignment getOSPolicyAssignment(GetOSPolicyAssignmentRequest request)
Retrieve an existing OS policy assignment.
This method always returns the latest revision. In order to retrieve a previous revision of
the assignment, also provide the revision ID in the name
parameter.
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 (OsConfigZonalServiceClient osConfigZonalServiceClient =
OsConfigZonalServiceClient.create()) {
GetOSPolicyAssignmentRequest request =
GetOSPolicyAssignmentRequest.newBuilder()
.setName(
OSPolicyAssignmentName.of("[PROJECT]", "[LOCATION]", "[OS_POLICY_ASSIGNMENT]")
.toString())
.build();
OSPolicyAssignment response = osConfigZonalServiceClient.getOSPolicyAssignment(request);
}
Parameter | |
---|---|
Name | Description |
request | GetOSPolicyAssignmentRequest The request object containing all of the parameters for the API call. |
Returns | |
---|---|
Type | Description |
OSPolicyAssignment |
getOSPolicyAssignment(OSPolicyAssignmentName name)
public final OSPolicyAssignment getOSPolicyAssignment(OSPolicyAssignmentName name)
Retrieve an existing OS policy assignment.
This method always returns the latest revision. In order to retrieve a previous revision of
the assignment, also provide the revision ID in the name
parameter.
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 (OsConfigZonalServiceClient osConfigZonalServiceClient =
OsConfigZonalServiceClient.create()) {
OSPolicyAssignmentName name =
OSPolicyAssignmentName.of("[PROJECT]", "[LOCATION]", "[OS_POLICY_ASSIGNMENT]");
OSPolicyAssignment response = osConfigZonalServiceClient.getOSPolicyAssignment(name);
}
Parameter | |
---|---|
Name | Description |
name | OSPolicyAssignmentName Required. The resource name of OS policy assignment. Format:
|
Returns | |
---|---|
Type | Description |
OSPolicyAssignment |
getOSPolicyAssignment(String name)
public final OSPolicyAssignment getOSPolicyAssignment(String name)
Retrieve an existing OS policy assignment.
This method always returns the latest revision. In order to retrieve a previous revision of
the assignment, also provide the revision ID in the name
parameter.
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 (OsConfigZonalServiceClient osConfigZonalServiceClient =
OsConfigZonalServiceClient.create()) {
String name =
OSPolicyAssignmentName.of("[PROJECT]", "[LOCATION]", "[OS_POLICY_ASSIGNMENT]").toString();
OSPolicyAssignment response = osConfigZonalServiceClient.getOSPolicyAssignment(name);
}
Parameter | |
---|---|
Name | Description |
name | String Required. The resource name of OS policy assignment. Format:
|
Returns | |
---|---|
Type | Description |
OSPolicyAssignment |
getOSPolicyAssignmentCallable()
public final UnaryCallable<GetOSPolicyAssignmentRequest,OSPolicyAssignment> getOSPolicyAssignmentCallable()
Retrieve an existing OS policy assignment.
This method always returns the latest revision. In order to retrieve a previous revision of
the assignment, also provide the revision ID in the name
parameter.
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 (OsConfigZonalServiceClient osConfigZonalServiceClient =
OsConfigZonalServiceClient.create()) {
GetOSPolicyAssignmentRequest request =
GetOSPolicyAssignmentRequest.newBuilder()
.setName(
OSPolicyAssignmentName.of("[PROJECT]", "[LOCATION]", "[OS_POLICY_ASSIGNMENT]")
.toString())
.build();
ApiFuture<OSPolicyAssignment> future =
osConfigZonalServiceClient.getOSPolicyAssignmentCallable().futureCall(request);
// Do something.
OSPolicyAssignment response = future.get();
}
Returns | |
---|---|
Type | Description |
UnaryCallable<GetOSPolicyAssignmentRequest,OSPolicyAssignment> |
getOSPolicyAssignmentReport(GetOSPolicyAssignmentReportRequest request)
public final OSPolicyAssignmentReport getOSPolicyAssignmentReport(GetOSPolicyAssignmentReportRequest request)
Get the OS policy asssignment report for the specified Compute Engine VM instance.
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 (OsConfigZonalServiceClient osConfigZonalServiceClient =
OsConfigZonalServiceClient.create()) {
GetOSPolicyAssignmentReportRequest request =
GetOSPolicyAssignmentReportRequest.newBuilder()
.setName(
OSPolicyAssignmentReportName.of(
"[PROJECT]", "[LOCATION]", "[INSTANCE]", "[ASSIGNMENT]")
.toString())
.build();
OSPolicyAssignmentReport response =
osConfigZonalServiceClient.getOSPolicyAssignmentReport(request);
}
Parameter | |
---|---|
Name | Description |
request | GetOSPolicyAssignmentReportRequest The request object containing all of the parameters for the API call. |
Returns | |
---|---|
Type | Description |
OSPolicyAssignmentReport |
getOSPolicyAssignmentReport(OSPolicyAssignmentReportName name)
public final OSPolicyAssignmentReport getOSPolicyAssignmentReport(OSPolicyAssignmentReportName name)
Get the OS policy asssignment report for the specified Compute Engine VM instance.
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 (OsConfigZonalServiceClient osConfigZonalServiceClient =
OsConfigZonalServiceClient.create()) {
OSPolicyAssignmentReportName name =
OSPolicyAssignmentReportName.of("[PROJECT]", "[LOCATION]", "[INSTANCE]", "[ASSIGNMENT]");
OSPolicyAssignmentReport response =
osConfigZonalServiceClient.getOSPolicyAssignmentReport(name);
}
Parameter | |
---|---|
Name | Description |
name | OSPolicyAssignmentReportName Required. API resource name for OS policy assignment report. Format:
For |
Returns | |
---|---|
Type | Description |
OSPolicyAssignmentReport |
getOSPolicyAssignmentReport(String name)
public final OSPolicyAssignmentReport getOSPolicyAssignmentReport(String name)
Get the OS policy asssignment report for the specified Compute Engine VM instance.
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 (OsConfigZonalServiceClient osConfigZonalServiceClient =
OsConfigZonalServiceClient.create()) {
String name =
OSPolicyAssignmentReportName.of("[PROJECT]", "[LOCATION]", "[INSTANCE]", "[ASSIGNMENT]")
.toString();
OSPolicyAssignmentReport response =
osConfigZonalServiceClient.getOSPolicyAssignmentReport(name);
}
Parameter | |
---|---|
Name | Description |
name | String Required. API resource name for OS policy assignment report. Format:
For |
Returns | |
---|---|
Type | Description |
OSPolicyAssignmentReport |
getOSPolicyAssignmentReportCallable()
public final UnaryCallable<GetOSPolicyAssignmentReportRequest,OSPolicyAssignmentReport> getOSPolicyAssignmentReportCallable()
Get the OS policy asssignment report for the specified Compute Engine VM instance.
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 (OsConfigZonalServiceClient osConfigZonalServiceClient =
OsConfigZonalServiceClient.create()) {
GetOSPolicyAssignmentReportRequest request =
GetOSPolicyAssignmentReportRequest.newBuilder()
.setName(
OSPolicyAssignmentReportName.of(
"[PROJECT]", "[LOCATION]", "[INSTANCE]", "[ASSIGNMENT]")
.toString())
.build();
ApiFuture<OSPolicyAssignmentReport> future =
osConfigZonalServiceClient.getOSPolicyAssignmentReportCallable().futureCall(request);
// Do something.
OSPolicyAssignmentReport response = future.get();
}
Returns | |
---|---|
Type | Description |
UnaryCallable<GetOSPolicyAssignmentReportRequest,OSPolicyAssignmentReport> |
getOperationsClient()
public final OperationsClient getOperationsClient()
Returns the OperationsClient that can be used to query the status of a long-running operation returned by another API method call.
Returns | |
---|---|
Type | Description |
OperationsClient |
getSettings()
public final OsConfigZonalServiceSettings getSettings()
Returns | |
---|---|
Type | Description |
OsConfigZonalServiceSettings |
getStub()
public OsConfigZonalServiceStub getStub()
Returns | |
---|---|
Type | Description |
OsConfigZonalServiceStub |
getVulnerabilityReport(GetVulnerabilityReportRequest request)
public final VulnerabilityReport getVulnerabilityReport(GetVulnerabilityReportRequest request)
Gets the vulnerability report for the specified VM instance. Only VMs with inventory data have vulnerability reports associated with them.
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 (OsConfigZonalServiceClient osConfigZonalServiceClient =
OsConfigZonalServiceClient.create()) {
GetVulnerabilityReportRequest request =
GetVulnerabilityReportRequest.newBuilder()
.setName(
VulnerabilityReportName.of("[PROJECT]", "[LOCATION]", "[INSTANCE]").toString())
.build();
VulnerabilityReport response = osConfigZonalServiceClient.getVulnerabilityReport(request);
}
Parameter | |
---|---|
Name | Description |
request | GetVulnerabilityReportRequest The request object containing all of the parameters for the API call. |
Returns | |
---|---|
Type | Description |
VulnerabilityReport |
getVulnerabilityReport(VulnerabilityReportName name)
public final VulnerabilityReport getVulnerabilityReport(VulnerabilityReportName name)
Gets the vulnerability report for the specified VM instance. Only VMs with inventory data have vulnerability reports associated with them.
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 (OsConfigZonalServiceClient osConfigZonalServiceClient =
OsConfigZonalServiceClient.create()) {
VulnerabilityReportName name =
VulnerabilityReportName.of("[PROJECT]", "[LOCATION]", "[INSTANCE]");
VulnerabilityReport response = osConfigZonalServiceClient.getVulnerabilityReport(name);
}
Parameter | |
---|---|
Name | Description |
name | VulnerabilityReportName Required. API resource name for vulnerability resource. Format:
For |
Returns | |
---|---|
Type | Description |
VulnerabilityReport |
getVulnerabilityReport(String name)
public final VulnerabilityReport getVulnerabilityReport(String name)
Gets the vulnerability report for the specified VM instance. Only VMs with inventory data have vulnerability reports associated with them.
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 (OsConfigZonalServiceClient osConfigZonalServiceClient =
OsConfigZonalServiceClient.create()) {
String name = VulnerabilityReportName.of("[PROJECT]", "[LOCATION]", "[INSTANCE]").toString();
VulnerabilityReport response = osConfigZonalServiceClient.getVulnerabilityReport(name);
}
Parameter | |
---|---|
Name | Description |
name | String Required. API resource name for vulnerability resource. Format:
For |
Returns | |
---|---|
Type | Description |
VulnerabilityReport |
getVulnerabilityReportCallable()
public final UnaryCallable<GetVulnerabilityReportRequest,VulnerabilityReport> getVulnerabilityReportCallable()
Gets the vulnerability report for the specified VM instance. Only VMs with inventory data have vulnerability reports associated with them.
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 (OsConfigZonalServiceClient osConfigZonalServiceClient =
OsConfigZonalServiceClient.create()) {
GetVulnerabilityReportRequest request =
GetVulnerabilityReportRequest.newBuilder()
.setName(
VulnerabilityReportName.of("[PROJECT]", "[LOCATION]", "[INSTANCE]").toString())
.build();
ApiFuture<VulnerabilityReport> future =
osConfigZonalServiceClient.getVulnerabilityReportCallable().futureCall(request);
// Do something.
VulnerabilityReport response = future.get();
}
Returns | |
---|---|
Type | Description |
UnaryCallable<GetVulnerabilityReportRequest,VulnerabilityReport> |
isShutdown()
public boolean isShutdown()
Returns | |
---|---|
Type | Description |
boolean |
isTerminated()
public boolean isTerminated()
Returns | |
---|---|
Type | Description |
boolean |
listInstanceOSPoliciesCompliances(ListInstanceOSPoliciesCompliancesRequest request) (deprecated)
public final OsConfigZonalServiceClient.ListInstanceOSPoliciesCompliancesPagedResponse listInstanceOSPoliciesCompliances(ListInstanceOSPoliciesCompliancesRequest request)
Deprecated. This method is deprecated and will be removed in the next major version update.
List OS policies compliance data for all Compute Engine VM instances in the specified zone.
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 (OsConfigZonalServiceClient osConfigZonalServiceClient =
OsConfigZonalServiceClient.create()) {
ListInstanceOSPoliciesCompliancesRequest request =
ListInstanceOSPoliciesCompliancesRequest.newBuilder()
.setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
.setPageSize(883849137)
.setPageToken("pageToken873572522")
.setFilter("filter-1274492040")
.build();
for (InstanceOSPoliciesCompliance element :
osConfigZonalServiceClient.listInstanceOSPoliciesCompliances(request).iterateAll()) {
// doThingsWith(element);
}
}
Parameter | |
---|---|
Name | Description |
request | ListInstanceOSPoliciesCompliancesRequest The request object containing all of the parameters for the API call. |
Returns | |
---|---|
Type | Description |
OsConfigZonalServiceClient.ListInstanceOSPoliciesCompliancesPagedResponse |
listInstanceOSPoliciesCompliances(LocationName parent) (deprecated)
public final OsConfigZonalServiceClient.ListInstanceOSPoliciesCompliancesPagedResponse listInstanceOSPoliciesCompliances(LocationName parent)
Deprecated. This method is deprecated and will be removed in the next major version update.
List OS policies compliance data for all Compute Engine VM instances in the specified zone.
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 (OsConfigZonalServiceClient osConfigZonalServiceClient =
OsConfigZonalServiceClient.create()) {
LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
for (InstanceOSPoliciesCompliance element :
osConfigZonalServiceClient.listInstanceOSPoliciesCompliances(parent).iterateAll()) {
// doThingsWith(element);
}
}
Parameter | |
---|---|
Name | Description |
parent | LocationName Required. The parent resource name. Format: For |
Returns | |
---|---|
Type | Description |
OsConfigZonalServiceClient.ListInstanceOSPoliciesCompliancesPagedResponse |
listInstanceOSPoliciesCompliances(String parent) (deprecated)
public final OsConfigZonalServiceClient.ListInstanceOSPoliciesCompliancesPagedResponse listInstanceOSPoliciesCompliances(String parent)
Deprecated. This method is deprecated and will be removed in the next major version update.
List OS policies compliance data for all Compute Engine VM instances in the specified zone.
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 (OsConfigZonalServiceClient osConfigZonalServiceClient =
OsConfigZonalServiceClient.create()) {
String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString();
for (InstanceOSPoliciesCompliance element :
osConfigZonalServiceClient.listInstanceOSPoliciesCompliances(parent).iterateAll()) {
// doThingsWith(element);
}
}
Parameter | |
---|---|
Name | Description |
parent | String Required. The parent resource name. Format: For |
Returns | |
---|---|
Type | Description |
OsConfigZonalServiceClient.ListInstanceOSPoliciesCompliancesPagedResponse |
listInstanceOSPoliciesCompliancesCallable() (deprecated)
public final UnaryCallable<ListInstanceOSPoliciesCompliancesRequest,ListInstanceOSPoliciesCompliancesResponse> listInstanceOSPoliciesCompliancesCallable()
Deprecated. This method is deprecated and will be removed in the next major version update.
List OS policies compliance data for all Compute Engine VM instances in the specified zone.
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 (OsConfigZonalServiceClient osConfigZonalServiceClient =
OsConfigZonalServiceClient.create()) {
ListInstanceOSPoliciesCompliancesRequest request =
ListInstanceOSPoliciesCompliancesRequest.newBuilder()
.setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
.setPageSize(883849137)
.setPageToken("pageToken873572522")
.setFilter("filter-1274492040")
.build();
while (true) {
ListInstanceOSPoliciesCompliancesResponse response =
osConfigZonalServiceClient.listInstanceOSPoliciesCompliancesCallable().call(request);
for (InstanceOSPoliciesCompliance element :
response.getInstanceOsPoliciesCompliancesList()) {
// doThingsWith(element);
}
String nextPageToken = response.getNextPageToken();
if (!Strings.isNullOrEmpty(nextPageToken)) {
request = request.toBuilder().setPageToken(nextPageToken).build();
} else {
break;
}
}
}
Returns | |
---|---|
Type | Description |
UnaryCallable<ListInstanceOSPoliciesCompliancesRequest,ListInstanceOSPoliciesCompliancesResponse> |
listInstanceOSPoliciesCompliancesPagedCallable() (deprecated)
public final UnaryCallable<ListInstanceOSPoliciesCompliancesRequest,OsConfigZonalServiceClient.ListInstanceOSPoliciesCompliancesPagedResponse> listInstanceOSPoliciesCompliancesPagedCallable()
Deprecated. This method is deprecated and will be removed in the next major version update.
List OS policies compliance data for all Compute Engine VM instances in the specified zone.
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 (OsConfigZonalServiceClient osConfigZonalServiceClient =
OsConfigZonalServiceClient.create()) {
ListInstanceOSPoliciesCompliancesRequest request =
ListInstanceOSPoliciesCompliancesRequest.newBuilder()
.setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
.setPageSize(883849137)
.setPageToken("pageToken873572522")
.setFilter("filter-1274492040")
.build();
ApiFuture<InstanceOSPoliciesCompliance> future =
osConfigZonalServiceClient
.listInstanceOSPoliciesCompliancesPagedCallable()
.futureCall(request);
// Do something.
for (InstanceOSPoliciesCompliance element : future.get().iterateAll()) {
// doThingsWith(element);
}
}
Returns | |
---|---|
Type | Description |
UnaryCallable<ListInstanceOSPoliciesCompliancesRequest,ListInstanceOSPoliciesCompliancesPagedResponse> |
listInventories(InstanceName parent)
public final OsConfigZonalServiceClient.ListInventoriesPagedResponse listInventories(InstanceName parent)
List inventory data for all VM instances in the specified zone.
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 (OsConfigZonalServiceClient osConfigZonalServiceClient =
OsConfigZonalServiceClient.create()) {
InstanceName parent = InstanceName.of("[PROJECT]", "[LOCATION]", "[INSTANCE]");
for (Inventory element : osConfigZonalServiceClient.listInventories(parent).iterateAll()) {
// doThingsWith(element);
}
}
Parameter | |
---|---|
Name | Description |
parent | InstanceName Required. The parent resource name. Format: For |
Returns | |
---|---|
Type | Description |
OsConfigZonalServiceClient.ListInventoriesPagedResponse |
listInventories(ListInventoriesRequest request)
public final OsConfigZonalServiceClient.ListInventoriesPagedResponse listInventories(ListInventoriesRequest request)
List inventory data for all VM instances in the specified zone.
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 (OsConfigZonalServiceClient osConfigZonalServiceClient =
OsConfigZonalServiceClient.create()) {
ListInventoriesRequest request =
ListInventoriesRequest.newBuilder()
.setParent(InstanceName.of("[PROJECT]", "[LOCATION]", "[INSTANCE]").toString())
.setView(InventoryView.forNumber(0))
.setPageSize(883849137)
.setPageToken("pageToken873572522")
.setFilter("filter-1274492040")
.build();
for (Inventory element : osConfigZonalServiceClient.listInventories(request).iterateAll()) {
// doThingsWith(element);
}
}
Parameter | |
---|---|
Name | Description |
request | ListInventoriesRequest The request object containing all of the parameters for the API call. |
Returns | |
---|---|
Type | Description |
OsConfigZonalServiceClient.ListInventoriesPagedResponse |
listInventories(String parent)
public final OsConfigZonalServiceClient.ListInventoriesPagedResponse listInventories(String parent)
List inventory data for all VM instances in the specified zone.
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 (OsConfigZonalServiceClient osConfigZonalServiceClient =
OsConfigZonalServiceClient.create()) {
String parent = InstanceName.of("[PROJECT]", "[LOCATION]", "[INSTANCE]").toString();
for (Inventory element : osConfigZonalServiceClient.listInventories(parent).iterateAll()) {
// doThingsWith(element);
}
}
Parameter | |
---|---|
Name | Description |
parent | String Required. The parent resource name. Format: For |
Returns | |
---|---|
Type | Description |
OsConfigZonalServiceClient.ListInventoriesPagedResponse |
listInventoriesCallable()
public final UnaryCallable<ListInventoriesRequest,ListInventoriesResponse> listInventoriesCallable()
List inventory data for all VM instances in the specified zone.
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 (OsConfigZonalServiceClient osConfigZonalServiceClient =
OsConfigZonalServiceClient.create()) {
ListInventoriesRequest request =
ListInventoriesRequest.newBuilder()
.setParent(InstanceName.of("[PROJECT]", "[LOCATION]", "[INSTANCE]").toString())
.setView(InventoryView.forNumber(0))
.setPageSize(883849137)
.setPageToken("pageToken873572522")
.setFilter("filter-1274492040")
.build();
while (true) {
ListInventoriesResponse response =
osConfigZonalServiceClient.listInventoriesCallable().call(request);
for (Inventory element : response.getInventoriesList()) {
// doThingsWith(element);
}
String nextPageToken = response.getNextPageToken();
if (!Strings.isNullOrEmpty(nextPageToken)) {
request = request.toBuilder().setPageToken(nextPageToken).build();
} else {
break;
}
}
}
Returns | |
---|---|
Type | Description |
UnaryCallable<ListInventoriesRequest,ListInventoriesResponse> |
listInventoriesPagedCallable()
public final UnaryCallable<ListInventoriesRequest,OsConfigZonalServiceClient.ListInventoriesPagedResponse> listInventoriesPagedCallable()
List inventory data for all VM instances in the specified zone.
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 (OsConfigZonalServiceClient osConfigZonalServiceClient =
OsConfigZonalServiceClient.create()) {
ListInventoriesRequest request =
ListInventoriesRequest.newBuilder()
.setParent(InstanceName.of("[PROJECT]", "[LOCATION]", "[INSTANCE]").toString())
.setView(InventoryView.forNumber(0))
.setPageSize(883849137)
.setPageToken("pageToken873572522")
.setFilter("filter-1274492040")
.build();
ApiFuture<Inventory> future =
osConfigZonalServiceClient.listInventoriesPagedCallable().futureCall(request);
// Do something.
for (Inventory element : future.get().iterateAll()) {
// doThingsWith(element);
}
}
Returns | |
---|---|
Type | Description |
UnaryCallable<ListInventoriesRequest,ListInventoriesPagedResponse> |
listOSPolicyAssignmentReports(InstanceOSPolicyAssignmentName parent)
public final OsConfigZonalServiceClient.ListOSPolicyAssignmentReportsPagedResponse listOSPolicyAssignmentReports(InstanceOSPolicyAssignmentName parent)
List OS policy asssignment reports for all Compute Engine VM instances in the specified zone.
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 (OsConfigZonalServiceClient osConfigZonalServiceClient =
OsConfigZonalServiceClient.create()) {
InstanceOSPolicyAssignmentName parent =
InstanceOSPolicyAssignmentName.of(
"[PROJECT]", "[LOCATION]", "[INSTANCE]", "[ASSIGNMENT]");
for (OSPolicyAssignmentReport element :
osConfigZonalServiceClient.listOSPolicyAssignmentReports(parent).iterateAll()) {
// doThingsWith(element);
}
}
Parameter | |
---|---|
Name | Description |
parent | InstanceOSPolicyAssignmentName Required. The parent resource name. Format:
For For example:
|
Returns | |
---|---|
Type | Description |
OsConfigZonalServiceClient.ListOSPolicyAssignmentReportsPagedResponse |
listOSPolicyAssignmentReports(ListOSPolicyAssignmentReportsRequest request)
public final OsConfigZonalServiceClient.ListOSPolicyAssignmentReportsPagedResponse listOSPolicyAssignmentReports(ListOSPolicyAssignmentReportsRequest request)
List OS policy asssignment reports for all Compute Engine VM instances in the specified zone.
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 (OsConfigZonalServiceClient osConfigZonalServiceClient =
OsConfigZonalServiceClient.create()) {
ListOSPolicyAssignmentReportsRequest request =
ListOSPolicyAssignmentReportsRequest.newBuilder()
.setParent(
InstanceOSPolicyAssignmentName.of(
"[PROJECT]", "[LOCATION]", "[INSTANCE]", "[ASSIGNMENT]")
.toString())
.setPageSize(883849137)
.setFilter("filter-1274492040")
.setPageToken("pageToken873572522")
.build();
for (OSPolicyAssignmentReport element :
osConfigZonalServiceClient.listOSPolicyAssignmentReports(request).iterateAll()) {
// doThingsWith(element);
}
}
Parameter | |
---|---|
Name | Description |
request | ListOSPolicyAssignmentReportsRequest The request object containing all of the parameters for the API call. |
Returns | |
---|---|
Type | Description |
OsConfigZonalServiceClient.ListOSPolicyAssignmentReportsPagedResponse |
listOSPolicyAssignmentReports(String parent)
public final OsConfigZonalServiceClient.ListOSPolicyAssignmentReportsPagedResponse listOSPolicyAssignmentReports(String parent)
List OS policy asssignment reports for all Compute Engine VM instances in the specified zone.
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 (OsConfigZonalServiceClient osConfigZonalServiceClient =
OsConfigZonalServiceClient.create()) {
String parent =
InstanceOSPolicyAssignmentName.of("[PROJECT]", "[LOCATION]", "[INSTANCE]", "[ASSIGNMENT]")
.toString();
for (OSPolicyAssignmentReport element :
osConfigZonalServiceClient.listOSPolicyAssignmentReports(parent).iterateAll()) {
// doThingsWith(element);
}
}
Parameter | |
---|---|
Name | Description |
parent | String Required. The parent resource name. Format:
For For example:
|
Returns | |
---|---|
Type | Description |
OsConfigZonalServiceClient.ListOSPolicyAssignmentReportsPagedResponse |
listOSPolicyAssignmentReportsCallable()
public final UnaryCallable<ListOSPolicyAssignmentReportsRequest,ListOSPolicyAssignmentReportsResponse> listOSPolicyAssignmentReportsCallable()
List OS policy asssignment reports for all Compute Engine VM instances in the specified zone.
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 (OsConfigZonalServiceClient osConfigZonalServiceClient =
OsConfigZonalServiceClient.create()) {
ListOSPolicyAssignmentReportsRequest request =
ListOSPolicyAssignmentReportsRequest.newBuilder()
.setParent(
InstanceOSPolicyAssignmentName.of(
"[PROJECT]", "[LOCATION]", "[INSTANCE]", "[ASSIGNMENT]")
.toString())
.setPageSize(883849137)
.setFilter("filter-1274492040")
.setPageToken("pageToken873572522")
.build();
while (true) {
ListOSPolicyAssignmentReportsResponse response =
osConfigZonalServiceClient.listOSPolicyAssignmentReportsCallable().call(request);
for (OSPolicyAssignmentReport element : response.getOsPolicyAssignmentReportsList()) {
// doThingsWith(element);
}
String nextPageToken = response.getNextPageToken();
if (!Strings.isNullOrEmpty(nextPageToken)) {
request = request.toBuilder().setPageToken(nextPageToken).build();
} else {
break;
}
}
}
Returns | |
---|---|
Type | Description |
UnaryCallable<ListOSPolicyAssignmentReportsRequest,ListOSPolicyAssignmentReportsResponse> |
listOSPolicyAssignmentReportsPagedCallable()
public final UnaryCallable<ListOSPolicyAssignmentReportsRequest,OsConfigZonalServiceClient.ListOSPolicyAssignmentReportsPagedResponse> listOSPolicyAssignmentReportsPagedCallable()
List OS policy asssignment reports for all Compute Engine VM instances in the specified zone.
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 (OsConfigZonalServiceClient osConfigZonalServiceClient =
OsConfigZonalServiceClient.create()) {
ListOSPolicyAssignmentReportsRequest request =
ListOSPolicyAssignmentReportsRequest.newBuilder()
.setParent(
InstanceOSPolicyAssignmentName.of(
"[PROJECT]", "[LOCATION]", "[INSTANCE]", "[ASSIGNMENT]")
.toString())
.setPageSize(883849137)
.setFilter("filter-1274492040")
.setPageToken("pageToken873572522")
.build();
ApiFuture<OSPolicyAssignmentReport> future =
osConfigZonalServiceClient
.listOSPolicyAssignmentReportsPagedCallable()
.futureCall(request);
// Do something.
for (OSPolicyAssignmentReport element : future.get().iterateAll()) {
// doThingsWith(element);
}
}
Returns | |
---|---|
Type | Description |
UnaryCallable<ListOSPolicyAssignmentReportsRequest,ListOSPolicyAssignmentReportsPagedResponse> |
listOSPolicyAssignmentRevisions(ListOSPolicyAssignmentRevisionsRequest request)
public final OsConfigZonalServiceClient.ListOSPolicyAssignmentRevisionsPagedResponse listOSPolicyAssignmentRevisions(ListOSPolicyAssignmentRevisionsRequest request)
List the OS policy assignment revisions for a given OS policy assignment.
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 (OsConfigZonalServiceClient osConfigZonalServiceClient =
OsConfigZonalServiceClient.create()) {
ListOSPolicyAssignmentRevisionsRequest request =
ListOSPolicyAssignmentRevisionsRequest.newBuilder()
.setName(
OSPolicyAssignmentName.of("[PROJECT]", "[LOCATION]", "[OS_POLICY_ASSIGNMENT]")
.toString())
.setPageSize(883849137)
.setPageToken("pageToken873572522")
.build();
for (OSPolicyAssignment element :
osConfigZonalServiceClient.listOSPolicyAssignmentRevisions(request).iterateAll()) {
// doThingsWith(element);
}
}
Parameter | |
---|---|
Name | Description |
request | ListOSPolicyAssignmentRevisionsRequest The request object containing all of the parameters for the API call. |
Returns | |
---|---|
Type | Description |
OsConfigZonalServiceClient.ListOSPolicyAssignmentRevisionsPagedResponse |
listOSPolicyAssignmentRevisions(OSPolicyAssignmentName name)
public final OsConfigZonalServiceClient.ListOSPolicyAssignmentRevisionsPagedResponse listOSPolicyAssignmentRevisions(OSPolicyAssignmentName name)
List the OS policy assignment revisions for a given OS policy assignment.
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 (OsConfigZonalServiceClient osConfigZonalServiceClient =
OsConfigZonalServiceClient.create()) {
OSPolicyAssignmentName name =
OSPolicyAssignmentName.of("[PROJECT]", "[LOCATION]", "[OS_POLICY_ASSIGNMENT]");
for (OSPolicyAssignment element :
osConfigZonalServiceClient.listOSPolicyAssignmentRevisions(name).iterateAll()) {
// doThingsWith(element);
}
}
Parameter | |
---|---|
Name | Description |
name | OSPolicyAssignmentName Required. The name of the OS policy assignment to list revisions for. |
Returns | |
---|---|
Type | Description |
OsConfigZonalServiceClient.ListOSPolicyAssignmentRevisionsPagedResponse |
listOSPolicyAssignmentRevisions(String name)
public final OsConfigZonalServiceClient.ListOSPolicyAssignmentRevisionsPagedResponse listOSPolicyAssignmentRevisions(String name)
List the OS policy assignment revisions for a given OS policy assignment.
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 (OsConfigZonalServiceClient osConfigZonalServiceClient =
OsConfigZonalServiceClient.create()) {
String name =
OSPolicyAssignmentName.of("[PROJECT]", "[LOCATION]", "[OS_POLICY_ASSIGNMENT]").toString();
for (OSPolicyAssignment element :
osConfigZonalServiceClient.listOSPolicyAssignmentRevisions(name).iterateAll()) {
// doThingsWith(element);
}
}
Parameter | |
---|---|
Name | Description |
name | String Required. The name of the OS policy assignment to list revisions for. |
Returns | |
---|---|
Type | Description |
OsConfigZonalServiceClient.ListOSPolicyAssignmentRevisionsPagedResponse |
listOSPolicyAssignmentRevisionsCallable()
public final UnaryCallable<ListOSPolicyAssignmentRevisionsRequest,ListOSPolicyAssignmentRevisionsResponse> listOSPolicyAssignmentRevisionsCallable()
List the OS policy assignment revisions for a given OS policy assignment.
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 (OsConfigZonalServiceClient osConfigZonalServiceClient =
OsConfigZonalServiceClient.create()) {
ListOSPolicyAssignmentRevisionsRequest request =
ListOSPolicyAssignmentRevisionsRequest.newBuilder()
.setName(
OSPolicyAssignmentName.of("[PROJECT]", "[LOCATION]", "[OS_POLICY_ASSIGNMENT]")
.toString())
.setPageSize(883849137)
.setPageToken("pageToken873572522")
.build();
while (true) {
ListOSPolicyAssignmentRevisionsResponse response =
osConfigZonalServiceClient.listOSPolicyAssignmentRevisionsCallable().call(request);
for (OSPolicyAssignment element : response.getOsPolicyAssignmentsList()) {
// doThingsWith(element);
}
String nextPageToken = response.getNextPageToken();
if (!Strings.isNullOrEmpty(nextPageToken)) {
request = request.toBuilder().setPageToken(nextPageToken).build();
} else {
break;
}
}
}
Returns | |
---|---|
Type | Description |
UnaryCallable<ListOSPolicyAssignmentRevisionsRequest,ListOSPolicyAssignmentRevisionsResponse> |
listOSPolicyAssignmentRevisionsPagedCallable()
public final UnaryCallable<ListOSPolicyAssignmentRevisionsRequest,OsConfigZonalServiceClient.ListOSPolicyAssignmentRevisionsPagedResponse> listOSPolicyAssignmentRevisionsPagedCallable()
List the OS policy assignment revisions for a given OS policy assignment.
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 (OsConfigZonalServiceClient osConfigZonalServiceClient =
OsConfigZonalServiceClient.create()) {
ListOSPolicyAssignmentRevisionsRequest request =
ListOSPolicyAssignmentRevisionsRequest.newBuilder()
.setName(
OSPolicyAssignmentName.of("[PROJECT]", "[LOCATION]", "[OS_POLICY_ASSIGNMENT]")
.toString())
.setPageSize(883849137)
.setPageToken("pageToken873572522")
.build();
ApiFuture<OSPolicyAssignment> future =
osConfigZonalServiceClient
.listOSPolicyAssignmentRevisionsPagedCallable()
.futureCall(request);
// Do something.
for (OSPolicyAssignment element : future.get().iterateAll()) {
// doThingsWith(element);
}
}
Returns | |
---|---|
Type | Description |
UnaryCallable<ListOSPolicyAssignmentRevisionsRequest,ListOSPolicyAssignmentRevisionsPagedResponse> |
listOSPolicyAssignments(ListOSPolicyAssignmentsRequest request)
public final OsConfigZonalServiceClient.ListOSPolicyAssignmentsPagedResponse listOSPolicyAssignments(ListOSPolicyAssignmentsRequest request)
List the OS policy assignments under the parent resource.
For each OS policy assignment, the latest revision is returned.
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 (OsConfigZonalServiceClient osConfigZonalServiceClient =
OsConfigZonalServiceClient.create()) {
ListOSPolicyAssignmentsRequest request =
ListOSPolicyAssignmentsRequest.newBuilder()
.setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
.setPageSize(883849137)
.setPageToken("pageToken873572522")
.build();
for (OSPolicyAssignment element :
osConfigZonalServiceClient.listOSPolicyAssignments(request).iterateAll()) {
// doThingsWith(element);
}
}
Parameter | |
---|---|
Name | Description |
request | ListOSPolicyAssignmentsRequest The request object containing all of the parameters for the API call. |
Returns | |
---|---|
Type | Description |
OsConfigZonalServiceClient.ListOSPolicyAssignmentsPagedResponse |
listOSPolicyAssignments(LocationName parent)
public final OsConfigZonalServiceClient.ListOSPolicyAssignmentsPagedResponse listOSPolicyAssignments(LocationName parent)
List the OS policy assignments under the parent resource.
For each OS policy assignment, the latest revision is returned.
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 (OsConfigZonalServiceClient osConfigZonalServiceClient =
OsConfigZonalServiceClient.create()) {
LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
for (OSPolicyAssignment element :
osConfigZonalServiceClient.listOSPolicyAssignments(parent).iterateAll()) {
// doThingsWith(element);
}
}
Parameter | |
---|---|
Name | Description |
parent | LocationName Required. The parent resource name. |
Returns | |
---|---|
Type | Description |
OsConfigZonalServiceClient.ListOSPolicyAssignmentsPagedResponse |
listOSPolicyAssignments(String parent)
public final OsConfigZonalServiceClient.ListOSPolicyAssignmentsPagedResponse listOSPolicyAssignments(String parent)
List the OS policy assignments under the parent resource.
For each OS policy assignment, the latest revision is returned.
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 (OsConfigZonalServiceClient osConfigZonalServiceClient =
OsConfigZonalServiceClient.create()) {
String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString();
for (OSPolicyAssignment element :
osConfigZonalServiceClient.listOSPolicyAssignments(parent).iterateAll()) {
// doThingsWith(element);
}
}
Parameter | |
---|---|
Name | Description |
parent | String Required. The parent resource name. |
Returns | |
---|---|
Type | Description |
OsConfigZonalServiceClient.ListOSPolicyAssignmentsPagedResponse |
listOSPolicyAssignmentsCallable()
public final UnaryCallable<ListOSPolicyAssignmentsRequest,ListOSPolicyAssignmentsResponse> listOSPolicyAssignmentsCallable()
List the OS policy assignments under the parent resource.
For each OS policy assignment, the latest revision is returned.
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 (OsConfigZonalServiceClient osConfigZonalServiceClient =
OsConfigZonalServiceClient.create()) {
ListOSPolicyAssignmentsRequest request =
ListOSPolicyAssignmentsRequest.newBuilder()
.setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
.setPageSize(883849137)
.setPageToken("pageToken873572522")
.build();
while (true) {
ListOSPolicyAssignmentsResponse response =
osConfigZonalServiceClient.listOSPolicyAssignmentsCallable().call(request);
for (OSPolicyAssignment element : response.getOsPolicyAssignmentsList()) {
// doThingsWith(element);
}
String nextPageToken = response.getNextPageToken();
if (!Strings.isNullOrEmpty(nextPageToken)) {
request = request.toBuilder().setPageToken(nextPageToken).build();
} else {
break;
}
}
}
Returns | |
---|---|
Type | Description |
UnaryCallable<ListOSPolicyAssignmentsRequest,ListOSPolicyAssignmentsResponse> |
listOSPolicyAssignmentsPagedCallable()
public final UnaryCallable<ListOSPolicyAssignmentsRequest,OsConfigZonalServiceClient.ListOSPolicyAssignmentsPagedResponse> listOSPolicyAssignmentsPagedCallable()
List the OS policy assignments under the parent resource.
For each OS policy assignment, the latest revision is returned.
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 (OsConfigZonalServiceClient osConfigZonalServiceClient =
OsConfigZonalServiceClient.create()) {
ListOSPolicyAssignmentsRequest request =
ListOSPolicyAssignmentsRequest.newBuilder()
.setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
.setPageSize(883849137)
.setPageToken("pageToken873572522")
.build();
ApiFuture<OSPolicyAssignment> future =
osConfigZonalServiceClient.listOSPolicyAssignmentsPagedCallable().futureCall(request);
// Do something.
for (OSPolicyAssignment element : future.get().iterateAll()) {
// doThingsWith(element);
}
}
Returns | |
---|---|
Type | Description |
UnaryCallable<ListOSPolicyAssignmentsRequest,ListOSPolicyAssignmentsPagedResponse> |
listVulnerabilityReports(InstanceName parent)
public final OsConfigZonalServiceClient.ListVulnerabilityReportsPagedResponse listVulnerabilityReports(InstanceName parent)
List vulnerability reports for all VM instances in the specified zone.
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 (OsConfigZonalServiceClient osConfigZonalServiceClient =
OsConfigZonalServiceClient.create()) {
InstanceName parent = InstanceName.of("[PROJECT]", "[LOCATION]", "[INSTANCE]");
for (VulnerabilityReport element :
osConfigZonalServiceClient.listVulnerabilityReports(parent).iterateAll()) {
// doThingsWith(element);
}
}
Parameter | |
---|---|
Name | Description |
parent | InstanceName Required. The parent resource name. Format: For |
Returns | |
---|---|
Type | Description |
OsConfigZonalServiceClient.ListVulnerabilityReportsPagedResponse |
listVulnerabilityReports(ListVulnerabilityReportsRequest request)
public final OsConfigZonalServiceClient.ListVulnerabilityReportsPagedResponse listVulnerabilityReports(ListVulnerabilityReportsRequest request)
List vulnerability reports for all VM instances in the specified zone.
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 (OsConfigZonalServiceClient osConfigZonalServiceClient =
OsConfigZonalServiceClient.create()) {
ListVulnerabilityReportsRequest request =
ListVulnerabilityReportsRequest.newBuilder()
.setParent(InstanceName.of("[PROJECT]", "[LOCATION]", "[INSTANCE]").toString())
.setPageSize(883849137)
.setPageToken("pageToken873572522")
.setFilter("filter-1274492040")
.build();
for (VulnerabilityReport element :
osConfigZonalServiceClient.listVulnerabilityReports(request).iterateAll()) {
// doThingsWith(element);
}
}
Parameter | |
---|---|
Name | Description |
request | ListVulnerabilityReportsRequest The request object containing all of the parameters for the API call. |
Returns | |
---|---|
Type | Description |
OsConfigZonalServiceClient.ListVulnerabilityReportsPagedResponse |
listVulnerabilityReports(String parent)
public final OsConfigZonalServiceClient.ListVulnerabilityReportsPagedResponse listVulnerabilityReports(String parent)
List vulnerability reports for all VM instances in the specified zone.
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 (OsConfigZonalServiceClient osConfigZonalServiceClient =
OsConfigZonalServiceClient.create()) {
String parent = InstanceName.of("[PROJECT]", "[LOCATION]", "[INSTANCE]").toString();
for (VulnerabilityReport element :
osConfigZonalServiceClient.listVulnerabilityReports(parent).iterateAll()) {
// doThingsWith(element);
}
}
Parameter | |
---|---|
Name | Description |
parent | String Required. The parent resource name. Format: For |
Returns | |
---|---|
Type | Description |
OsConfigZonalServiceClient.ListVulnerabilityReportsPagedResponse |
listVulnerabilityReportsCallable()
public final UnaryCallable<ListVulnerabilityReportsRequest,ListVulnerabilityReportsResponse> listVulnerabilityReportsCallable()
List vulnerability reports for all VM instances in the specified zone.
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 (OsConfigZonalServiceClient osConfigZonalServiceClient =
OsConfigZonalServiceClient.create()) {
ListVulnerabilityReportsRequest request =
ListVulnerabilityReportsRequest.newBuilder()
.setParent(InstanceName.of("[PROJECT]", "[LOCATION]", "[INSTANCE]").toString())
.setPageSize(883849137)
.setPageToken("pageToken873572522")
.setFilter("filter-1274492040")
.build();
while (true) {
ListVulnerabilityReportsResponse response =
osConfigZonalServiceClient.listVulnerabilityReportsCallable().call(request);
for (VulnerabilityReport element : response.getVulnerabilityReportsList()) {
// doThingsWith(element);
}
String nextPageToken = response.getNextPageToken();
if (!Strings.isNullOrEmpty(nextPageToken)) {
request = request.toBuilder().setPageToken(nextPageToken).build();
} else {
break;
}
}
}
Returns | |
---|---|
Type | Description |
UnaryCallable<ListVulnerabilityReportsRequest,ListVulnerabilityReportsResponse> |
listVulnerabilityReportsPagedCallable()
public final UnaryCallable<ListVulnerabilityReportsRequest,OsConfigZonalServiceClient.ListVulnerabilityReportsPagedResponse> listVulnerabilityReportsPagedCallable()
List vulnerability reports for all VM instances in the specified zone.
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 (OsConfigZonalServiceClient osConfigZonalServiceClient =
OsConfigZonalServiceClient.create()) {
ListVulnerabilityReportsRequest request =
ListVulnerabilityReportsRequest.newBuilder()
.setParent(InstanceName.of("[PROJECT]", "[LOCATION]", "[INSTANCE]").toString())
.setPageSize(883849137)
.setPageToken("pageToken873572522")
.setFilter("filter-1274492040")
.build();
ApiFuture<VulnerabilityReport> future =
osConfigZonalServiceClient.listVulnerabilityReportsPagedCallable().futureCall(request);
// Do something.
for (VulnerabilityReport element : future.get().iterateAll()) {
// doThingsWith(element);
}
}
Returns | |
---|---|
Type | Description |
UnaryCallable<ListVulnerabilityReportsRequest,ListVulnerabilityReportsPagedResponse> |
shutdown()
public void shutdown()
shutdownNow()
public void shutdownNow()
updateOSPolicyAssignmentAsync(OSPolicyAssignment osPolicyAssignment, FieldMask updateMask)
public final OperationFuture<OSPolicyAssignment,OSPolicyAssignmentOperationMetadata> updateOSPolicyAssignmentAsync(OSPolicyAssignment osPolicyAssignment, FieldMask updateMask)
Update an existing OS policy assignment.
This method creates a new revision of the OS policy assignment.
This method returns a long running operation (LRO) that contains the rollout details. The rollout can be cancelled by cancelling the LRO.
For more information, see Method: projects.locations.osPolicyAssignments.operations.cancel.
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 (OsConfigZonalServiceClient osConfigZonalServiceClient =
OsConfigZonalServiceClient.create()) {
OSPolicyAssignment osPolicyAssignment = OSPolicyAssignment.newBuilder().build();
FieldMask updateMask = FieldMask.newBuilder().build();
OSPolicyAssignment response =
osConfigZonalServiceClient
.updateOSPolicyAssignmentAsync(osPolicyAssignment, updateMask)
.get();
}
Parameters | |
---|---|
Name | Description |
osPolicyAssignment | OSPolicyAssignment Required. The updated OS policy assignment. |
updateMask | FieldMask Optional. Field mask that controls which fields of the assignment should be updated. |
Returns | |
---|---|
Type | Description |
OperationFuture<OSPolicyAssignment,OSPolicyAssignmentOperationMetadata> |
updateOSPolicyAssignmentAsync(UpdateOSPolicyAssignmentRequest request)
public final OperationFuture<OSPolicyAssignment,OSPolicyAssignmentOperationMetadata> updateOSPolicyAssignmentAsync(UpdateOSPolicyAssignmentRequest request)
Update an existing OS policy assignment.
This method creates a new revision of the OS policy assignment.
This method returns a long running operation (LRO) that contains the rollout details. The rollout can be cancelled by cancelling the LRO.
For more information, see Method: projects.locations.osPolicyAssignments.operations.cancel.
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 (OsConfigZonalServiceClient osConfigZonalServiceClient =
OsConfigZonalServiceClient.create()) {
UpdateOSPolicyAssignmentRequest request =
UpdateOSPolicyAssignmentRequest.newBuilder()
.setOsPolicyAssignment(OSPolicyAssignment.newBuilder().build())
.setUpdateMask(FieldMask.newBuilder().build())
.build();
OSPolicyAssignment response =
osConfigZonalServiceClient.updateOSPolicyAssignmentAsync(request).get();
}
Parameter | |
---|---|
Name | Description |
request | UpdateOSPolicyAssignmentRequest The request object containing all of the parameters for the API call. |
Returns | |
---|---|
Type | Description |
OperationFuture<OSPolicyAssignment,OSPolicyAssignmentOperationMetadata> |
updateOSPolicyAssignmentCallable()
public final UnaryCallable<UpdateOSPolicyAssignmentRequest,Operation> updateOSPolicyAssignmentCallable()
Update an existing OS policy assignment.
This method creates a new revision of the OS policy assignment.
This method returns a long running operation (LRO) that contains the rollout details. The rollout can be cancelled by cancelling the LRO.
For more information, see Method: projects.locations.osPolicyAssignments.operations.cancel.
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 (OsConfigZonalServiceClient osConfigZonalServiceClient =
OsConfigZonalServiceClient.create()) {
UpdateOSPolicyAssignmentRequest request =
UpdateOSPolicyAssignmentRequest.newBuilder()
.setOsPolicyAssignment(OSPolicyAssignment.newBuilder().build())
.setUpdateMask(FieldMask.newBuilder().build())
.build();
ApiFuture<Operation> future =
osConfigZonalServiceClient.updateOSPolicyAssignmentCallable().futureCall(request);
// Do something.
Operation response = future.get();
}
Returns | |
---|---|
Type | Description |
UnaryCallable<UpdateOSPolicyAssignmentRequest,Operation> |
updateOSPolicyAssignmentOperationCallable()
public final OperationCallable<UpdateOSPolicyAssignmentRequest,OSPolicyAssignment,OSPolicyAssignmentOperationMetadata> updateOSPolicyAssignmentOperationCallable()
Update an existing OS policy assignment.
This method creates a new revision of the OS policy assignment.
This method returns a long running operation (LRO) that contains the rollout details. The rollout can be cancelled by cancelling the LRO.
For more information, see Method: projects.locations.osPolicyAssignments.operations.cancel.
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 (OsConfigZonalServiceClient osConfigZonalServiceClient =
OsConfigZonalServiceClient.create()) {
UpdateOSPolicyAssignmentRequest request =
UpdateOSPolicyAssignmentRequest.newBuilder()
.setOsPolicyAssignment(OSPolicyAssignment.newBuilder().build())
.setUpdateMask(FieldMask.newBuilder().build())
.build();
OperationFuture<OSPolicyAssignment, OSPolicyAssignmentOperationMetadata> future =
osConfigZonalServiceClient
.updateOSPolicyAssignmentOperationCallable()
.futureCall(request);
// Do something.
OSPolicyAssignment response = future.get();
}
Returns | |
---|---|
Type | Description |
OperationCallable<UpdateOSPolicyAssignmentRequest,OSPolicyAssignment,OSPolicyAssignmentOperationMetadata> |