Class SecurityPostureClient
- All Implemented Interfaces:
BackgroundResource,AutoCloseable
This class provides the ability to make remote calls to the backing service through method calls that map to API methods. Sample code to get started:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (SecurityPostureClient securityPostureClient = SecurityPostureClient.create()) {
PostureName name = PostureName.of("[ORGANIZATION]", "[LOCATION]", "[POSTURE]");
Posture response = securityPostureClient.getPosture(name);
}
Note: close() needs to be called on the SecurityPostureClient object to clean up resources such as threads. In the example above, try-with-resources is used, which automatically calls close().
| Method | Description | Method Variants |
|---|---|---|
ListPostures |
(-- This option restricts the visibility of the API to only projects that will (-- be labeled as `PREVIEW` or `GOOGLE_INTERNAL` by the service. (-- option (google.api.api_visibility).restriction = "PREVIEW,GOOGLE_INTERNAL"; Postures Lists Postures in a given organization and location. In case a posture has multiple revisions, the latest revision as per UpdateTime will be returned. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
ListPostureRevisions |
Lists revisions of a Posture in a given organization and location. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
GetPosture |
Gets a posture in a given organization and location. User must provide revision_id to retrieve a specific revision of the resource. NOT_FOUND error is returned if the revision_id or the Posture name does not exist. In case revision_id is not provided then the latest Posture revision by UpdateTime is returned. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
CreatePosture |
Creates a new Posture resource. If a Posture with the specified name already exists in the specified organization and location, the long running operation returns a [ALREADY_EXISTS][google.rpc.Code.ALREADY_EXISTS] error. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
Methods that return long-running operations have "Async" method variants that return `OperationFuture`, which is used to track polling of the service.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
UpdatePosture |
Updates an existing Posture. A new revision of the posture will be created if the revision to be updated is currently deployed on a workload. Returns a `google.rpc.Status` with `google.rpc.Code.NOT_FOUND` if the Posture does not exist. Returns a `google.rpc.Status` with `google.rpc.Code.ABORTED` if the etag supplied in the request does not match the persisted etag of the Posture. Updatable fields are state, description and policy_sets. State update operation cannot be clubbed with update of description and policy_sets. An ACTIVE posture can be updated to both DRAFT or DEPRECATED states. Postures in DRAFT or DEPRECATED states can only be updated to ACTIVE state. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
Methods that return long-running operations have "Async" method variants that return `OperationFuture`, which is used to track polling of the service.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
DeletePosture |
Deletes all the revisions of a resource. A posture can only be deleted when none of the revisions are deployed to any workload. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
Methods that return long-running operations have "Async" method variants that return `OperationFuture`, which is used to track polling of the service.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
ExtractPosture |
Extracts existing policies on a workload as a posture. If a Posture on the given workload already exists, the long running operation returns a [ALREADY_EXISTS][google.rpc.Code.ALREADY_EXISTS] error. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
Methods that return long-running operations have "Async" method variants that return `OperationFuture`, which is used to track polling of the service.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
ListPostureDeployments |
PostureDeployments Lists PostureDeployments in a given project and location. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
GetPostureDeployment |
Gets details of a single PostureDeployment. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
CreatePostureDeployment |
Creates a new PostureDeployment in a given project and location. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
Methods that return long-running operations have "Async" method variants that return `OperationFuture`, which is used to track polling of the service.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
UpdatePostureDeployment |
Updates the parameters of a single PostureDeployment. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
Methods that return long-running operations have "Async" method variants that return `OperationFuture`, which is used to track polling of the service.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
DeletePostureDeployment |
Deletes a single PostureDeployment. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
Methods that return long-running operations have "Async" method variants that return `OperationFuture`, which is used to track polling of the service.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
ListPostureTemplates |
PostureTemplates Lists all the PostureTemplates available to the user. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
GetPostureTemplate |
Gets a PostureTemplate. User must provide revision_id to retrieve a specific revision of the resource. NOT_FOUND error is returned if the revision_id or the PostureTemplate name does not exist. In case revision_id is not provided then the PostureTemplate with latest revision_id is returned. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
ListLocations |
Lists information about the supported locations for this service. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
GetLocation |
Gets information about a location. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
See the individual methods for example code.
Many parameters require resource names to be formatted in a particular way. To assist with these names, this class includes a format method for each type of name, and additionally a parse method to extract the individual identifiers contained within names that are returned.
This class can be customized by passing in a custom instance of SecurityPostureSettings 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
SecurityPostureSettings securityPostureSettings =
SecurityPostureSettings.newBuilder()
.setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
.build();
SecurityPostureClient securityPostureClient =
SecurityPostureClient.create(securityPostureSettings);
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
SecurityPostureSettings securityPostureSettings =
SecurityPostureSettings.newBuilder().setEndpoint(myEndpoint).build();
SecurityPostureClient securityPostureClient =
SecurityPostureClient.create(securityPostureSettings);
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
SecurityPostureSettings securityPostureSettings =
SecurityPostureSettings.newHttpJsonBuilder().build();
SecurityPostureClient securityPostureClient =
SecurityPostureClient.create(securityPostureSettings);
Please refer to the GitHub repository's samples for more quickstart code snippets.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classstatic classstatic classstatic classstatic classstatic classstatic classstatic classstatic classstatic classstatic classstatic classstatic classstatic classstatic class -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedSecurityPostureClient(SecurityPostureSettings settings) Constructs an instance of SecurityPostureClient, using the given settings.protected -
Method Summary
Modifier and TypeMethodDescriptionbooleanawaitTermination(long duration, TimeUnit unit) final voidclose()static final SecurityPostureClientcreate()Constructs an instance of SecurityPostureClient with default settings.static final SecurityPostureClientcreate(SecurityPostureSettings settings) Constructs an instance of SecurityPostureClient, using the given settings.static final SecurityPostureClientcreate(SecurityPostureStub stub) Constructs an instance of SecurityPostureClient, using the given stub for making calls.createPostureAsync(CreatePostureRequest request) Creates a new Posture resource.createPostureAsync(OrganizationName parent, Posture posture, String postureId) Creates a new Posture resource.createPostureAsync(String parent, Posture posture, String postureId) Creates a new Posture resource.Creates a new Posture resource.Creates a new PostureDeployment in a given project and location.createPostureDeploymentAsync(OrganizationName parent, PostureDeployment postureDeployment, String postureDeploymentId) Creates a new PostureDeployment in a given project and location.createPostureDeploymentAsync(String parent, PostureDeployment postureDeployment, String postureDeploymentId) Creates a new PostureDeployment in a given project and location.Creates a new PostureDeployment in a given project and location.Creates a new PostureDeployment in a given project and location.Creates a new Posture resource.final OperationFuture<com.google.protobuf.Empty,OperationMetadata> deletePostureAsync(DeletePostureRequest request) Deletes all the revisions of a resource.final OperationFuture<com.google.protobuf.Empty,OperationMetadata> Deletes all the revisions of a resource.final OperationFuture<com.google.protobuf.Empty,OperationMetadata> deletePostureAsync(String name) Deletes all the revisions of a resource.Deletes all the revisions of a resource.final OperationFuture<com.google.protobuf.Empty,OperationMetadata> Deletes a single PostureDeployment.final OperationFuture<com.google.protobuf.Empty,OperationMetadata> Deletes a single PostureDeployment.final OperationFuture<com.google.protobuf.Empty,OperationMetadata> Deletes a single PostureDeployment.Deletes a single PostureDeployment.final OperationCallable<DeletePostureDeploymentRequest,com.google.protobuf.Empty, OperationMetadata> Deletes a single PostureDeployment.final OperationCallable<DeletePostureRequest,com.google.protobuf.Empty, OperationMetadata> Deletes all the revisions of a resource.extractPostureAsync(ExtractPostureRequest request) Extracts existing policies on a workload as a posture.extractPostureAsync(OrganizationName parent, String postureId, String workload) Extracts existing policies on a workload as a posture.extractPostureAsync(String parent, String postureId, String workload) Extracts existing policies on a workload as a posture.Extracts existing policies on a workload as a posture.Extracts existing policies on a workload as a posture.final OperationsClientReturns the OperationsClient that can be used to query the status of a long-running operation returned by another API method call.final LocationgetLocation(GetLocationRequest request) Gets information about a location.Gets information about a location.final OperationsClientReturns the OperationsClient that can be used to query the status of a long-running operation returned by another API method call.final PosturegetPosture(GetPostureRequest request) Gets a posture in a given organization and location.final PosturegetPosture(PostureName name) Gets a posture in a given organization and location.final PosturegetPosture(String name) Gets a posture in a given organization and location.Gets a posture in a given organization and location.final PostureDeploymentGets details of a single PostureDeployment.final PostureDeploymentGets details of a single PostureDeployment.final PostureDeploymentgetPostureDeployment(String name) Gets details of a single PostureDeployment.Gets details of a single PostureDeployment.final PostureTemplateGets a PostureTemplate.final PostureTemplateGets a PostureTemplate.final PostureTemplategetPostureTemplate(String name) Gets a PostureTemplate.Gets a PostureTemplate.final SecurityPostureSettingsgetStub()booleanbooleanlistLocations(ListLocationsRequest request) Lists information about the supported locations for this service.Lists information about the supported locations for this service.Lists information about the supported locations for this service.PostureDeployments Lists PostureDeployments in a given project and location.PostureDeployments Lists PostureDeployments in a given project and location.listPostureDeployments(String parent) PostureDeployments Lists PostureDeployments in a given project and location.PostureDeployments Lists PostureDeployments in a given project and location.final UnaryCallable<ListPostureDeploymentsRequest,SecurityPostureClient.ListPostureDeploymentsPagedResponse> PostureDeployments Lists PostureDeployments in a given project and location.Lists revisions of a Posture in a given organization and location.Lists revisions of a Posture in a given organization and location.final UnaryCallable<ListPostureRevisionsRequest,SecurityPostureClient.ListPostureRevisionsPagedResponse> Lists revisions of a Posture in a given organization and location.listPostures(ListPosturesRequest request) (-- This option restricts the visibility of the API to only projects that will (-- be labeled as `PREVIEW` or `GOOGLE_INTERNAL` by the service. (-- option (google.api.api_visibility).restriction = "PREVIEW,GOOGLE_INTERNAL"; Postures Lists Postures in a given organization and location.listPostures(OrganizationName parent) (-- This option restricts the visibility of the API to only projects that will (-- be labeled as `PREVIEW` or `GOOGLE_INTERNAL` by the service. (-- option (google.api.api_visibility).restriction = "PREVIEW,GOOGLE_INTERNAL"; Postures Lists Postures in a given organization and location.listPostures(String parent) (-- This option restricts the visibility of the API to only projects that will (-- be labeled as `PREVIEW` or `GOOGLE_INTERNAL` by the service. (-- option (google.api.api_visibility).restriction = "PREVIEW,GOOGLE_INTERNAL"; Postures Lists Postures in a given organization and location.(-- This option restricts the visibility of the API to only projects that will (-- be labeled as `PREVIEW` or `GOOGLE_INTERNAL` by the service. (-- option (google.api.api_visibility).restriction = "PREVIEW,GOOGLE_INTERNAL"; Postures Lists Postures in a given organization and location.(-- This option restricts the visibility of the API to only projects that will (-- be labeled as `PREVIEW` or `GOOGLE_INTERNAL` by the service. (-- option (google.api.api_visibility).restriction = "PREVIEW,GOOGLE_INTERNAL"; Postures Lists Postures in a given organization and location.PostureTemplates Lists all the PostureTemplates available to the user.listPostureTemplates(OrganizationName parent) PostureTemplates Lists all the PostureTemplates available to the user.listPostureTemplates(String parent) PostureTemplates Lists all the PostureTemplates available to the user.PostureTemplates Lists all the PostureTemplates available to the user.final UnaryCallable<ListPostureTemplatesRequest,SecurityPostureClient.ListPostureTemplatesPagedResponse> PostureTemplates Lists all the PostureTemplates available to the user.voidshutdown()voidupdatePostureAsync(Posture posture, com.google.protobuf.FieldMask updateMask) Updates an existing Posture.updatePostureAsync(UpdatePostureRequest request) Updates an existing Posture.Updates an existing Posture.updatePostureDeploymentAsync(PostureDeployment postureDeployment, com.google.protobuf.FieldMask updateMask) Updates the parameters of a single PostureDeployment.Updates the parameters of a single PostureDeployment.Updates the parameters of a single PostureDeployment.Updates the parameters of a single PostureDeployment.Updates an existing Posture.
-
Constructor Details
-
SecurityPostureClient
Constructs an instance of SecurityPostureClient, using the given settings. This is protected so that it is easy to make a subclass, but otherwise, the static factory methods should be preferred.- Throws:
IOException
-
SecurityPostureClient
-
-
Method Details
-
create
Constructs an instance of SecurityPostureClient with default settings.- Throws:
IOException
-
create
public static final SecurityPostureClient create(SecurityPostureSettings settings) throws IOException Constructs an instance of SecurityPostureClient, using the given settings. The channels are created based on the settings passed in, or defaults for any settings that are not set.- Throws:
IOException
-
create
Constructs an instance of SecurityPostureClient, using the given stub for making calls. This is for advanced usage - prefer using create(SecurityPostureSettings). -
getSettings
-
getStub
-
getOperationsClient
Returns the OperationsClient that can be used to query the status of a long-running operation returned by another API method call. -
getHttpJsonOperationsClient
Returns the OperationsClient that can be used to query the status of a long-running operation returned by another API method call. -
listPostures
(-- This option restricts the visibility of the API to only projects that will (-- be labeled as `PREVIEW` or `GOOGLE_INTERNAL` by the service. (-- option (google.api.api_visibility).restriction = "PREVIEW,GOOGLE_INTERNAL"; Postures Lists Postures in a given organization and location. In case a posture has multiple revisions, the latest revision as per UpdateTime will be 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 (SecurityPostureClient securityPostureClient = SecurityPostureClient.create()) { OrganizationName parent = OrganizationName.of("[ORGANIZATION]", "[LOCATION]"); for (Posture element : securityPostureClient.listPostures(parent).iterateAll()) { // doThingsWith(element); } }- Parameters:
parent- Required. Parent value for ListPosturesRequest.- Throws:
ApiException- if the remote call fails
-
listPostures
(-- This option restricts the visibility of the API to only projects that will (-- be labeled as `PREVIEW` or `GOOGLE_INTERNAL` by the service. (-- option (google.api.api_visibility).restriction = "PREVIEW,GOOGLE_INTERNAL"; Postures Lists Postures in a given organization and location. In case a posture has multiple revisions, the latest revision as per UpdateTime will be 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 (SecurityPostureClient securityPostureClient = SecurityPostureClient.create()) { String parent = OrganizationName.of("[ORGANIZATION]", "[LOCATION]").toString(); for (Posture element : securityPostureClient.listPostures(parent).iterateAll()) { // doThingsWith(element); } }- Parameters:
parent- Required. Parent value for ListPosturesRequest.- Throws:
ApiException- if the remote call fails
-
listPostures
public final SecurityPostureClient.ListPosturesPagedResponse listPostures(ListPosturesRequest request) (-- This option restricts the visibility of the API to only projects that will (-- be labeled as `PREVIEW` or `GOOGLE_INTERNAL` by the service. (-- option (google.api.api_visibility).restriction = "PREVIEW,GOOGLE_INTERNAL"; Postures Lists Postures in a given organization and location. In case a posture has multiple revisions, the latest revision as per UpdateTime will be 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 (SecurityPostureClient securityPostureClient = SecurityPostureClient.create()) { ListPosturesRequest request = ListPosturesRequest.newBuilder() .setParent(OrganizationName.of("[ORGANIZATION]", "[LOCATION]").toString()) .setPageSize(883849137) .setPageToken("pageToken873572522") .build(); for (Posture element : securityPostureClient.listPostures(request).iterateAll()) { // doThingsWith(element); } }- Parameters:
request- The request object containing all of the parameters for the API call.- Throws:
ApiException- if the remote call fails
-
listPosturesPagedCallable
public final UnaryCallable<ListPosturesRequest,SecurityPostureClient.ListPosturesPagedResponse> listPosturesPagedCallable()(-- This option restricts the visibility of the API to only projects that will (-- be labeled as `PREVIEW` or `GOOGLE_INTERNAL` by the service. (-- option (google.api.api_visibility).restriction = "PREVIEW,GOOGLE_INTERNAL"; Postures Lists Postures in a given organization and location. In case a posture has multiple revisions, the latest revision as per UpdateTime will be 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 (SecurityPostureClient securityPostureClient = SecurityPostureClient.create()) { ListPosturesRequest request = ListPosturesRequest.newBuilder() .setParent(OrganizationName.of("[ORGANIZATION]", "[LOCATION]").toString()) .setPageSize(883849137) .setPageToken("pageToken873572522") .build(); ApiFuture<Posture> future = securityPostureClient.listPosturesPagedCallable().futureCall(request); // Do something. for (Posture element : future.get().iterateAll()) { // doThingsWith(element); } } -
listPosturesCallable
(-- This option restricts the visibility of the API to only projects that will (-- be labeled as `PREVIEW` or `GOOGLE_INTERNAL` by the service. (-- option (google.api.api_visibility).restriction = "PREVIEW,GOOGLE_INTERNAL"; Postures Lists Postures in a given organization and location. In case a posture has multiple revisions, the latest revision as per UpdateTime will be 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 (SecurityPostureClient securityPostureClient = SecurityPostureClient.create()) { ListPosturesRequest request = ListPosturesRequest.newBuilder() .setParent(OrganizationName.of("[ORGANIZATION]", "[LOCATION]").toString()) .setPageSize(883849137) .setPageToken("pageToken873572522") .build(); while (true) { ListPosturesResponse response = securityPostureClient.listPosturesCallable().call(request); for (Posture element : response.getPosturesList()) { // doThingsWith(element); } String nextPageToken = response.getNextPageToken(); if (!Strings.isNullOrEmpty(nextPageToken)) { request = request.toBuilder().setPageToken(nextPageToken).build(); } else { break; } } } -
listPostureRevisions
public final SecurityPostureClient.ListPostureRevisionsPagedResponse listPostureRevisions(ListPostureRevisionsRequest request) Lists revisions of a Posture in a given organization and location.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 (SecurityPostureClient securityPostureClient = SecurityPostureClient.create()) { ListPostureRevisionsRequest request = ListPostureRevisionsRequest.newBuilder() .setName(PostureName.of("[ORGANIZATION]", "[LOCATION]", "[POSTURE]").toString()) .setPageSize(883849137) .setPageToken("pageToken873572522") .build(); for (Posture element : securityPostureClient.listPostureRevisions(request).iterateAll()) { // doThingsWith(element); } }- Parameters:
request- The request object containing all of the parameters for the API call.- Throws:
ApiException- if the remote call fails
-
listPostureRevisionsPagedCallable
public final UnaryCallable<ListPostureRevisionsRequest,SecurityPostureClient.ListPostureRevisionsPagedResponse> listPostureRevisionsPagedCallable()Lists revisions of a Posture in a given organization and location.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 (SecurityPostureClient securityPostureClient = SecurityPostureClient.create()) { ListPostureRevisionsRequest request = ListPostureRevisionsRequest.newBuilder() .setName(PostureName.of("[ORGANIZATION]", "[LOCATION]", "[POSTURE]").toString()) .setPageSize(883849137) .setPageToken("pageToken873572522") .build(); ApiFuture<Posture> future = securityPostureClient.listPostureRevisionsPagedCallable().futureCall(request); // Do something. for (Posture element : future.get().iterateAll()) { // doThingsWith(element); } } -
listPostureRevisionsCallable
public final UnaryCallable<ListPostureRevisionsRequest,ListPostureRevisionsResponse> listPostureRevisionsCallable()Lists revisions of a Posture in a given organization and location.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 (SecurityPostureClient securityPostureClient = SecurityPostureClient.create()) { ListPostureRevisionsRequest request = ListPostureRevisionsRequest.newBuilder() .setName(PostureName.of("[ORGANIZATION]", "[LOCATION]", "[POSTURE]").toString()) .setPageSize(883849137) .setPageToken("pageToken873572522") .build(); while (true) { ListPostureRevisionsResponse response = securityPostureClient.listPostureRevisionsCallable().call(request); for (Posture element : response.getRevisionsList()) { // doThingsWith(element); } String nextPageToken = response.getNextPageToken(); if (!Strings.isNullOrEmpty(nextPageToken)) { request = request.toBuilder().setPageToken(nextPageToken).build(); } else { break; } } } -
getPosture
Gets a posture in a given organization and location. User must provide revision_id to retrieve a specific revision of the resource. NOT_FOUND error is returned if the revision_id or the Posture name does not exist. In case revision_id is not provided then the latest Posture revision by UpdateTime 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 (SecurityPostureClient securityPostureClient = SecurityPostureClient.create()) { PostureName name = PostureName.of("[ORGANIZATION]", "[LOCATION]", "[POSTURE]"); Posture response = securityPostureClient.getPosture(name); }- Parameters:
name- Required. Name of the resource.- Throws:
ApiException- if the remote call fails
-
getPosture
Gets a posture in a given organization and location. User must provide revision_id to retrieve a specific revision of the resource. NOT_FOUND error is returned if the revision_id or the Posture name does not exist. In case revision_id is not provided then the latest Posture revision by UpdateTime 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 (SecurityPostureClient securityPostureClient = SecurityPostureClient.create()) { String name = PostureName.of("[ORGANIZATION]", "[LOCATION]", "[POSTURE]").toString(); Posture response = securityPostureClient.getPosture(name); }- Parameters:
name- Required. Name of the resource.- Throws:
ApiException- if the remote call fails
-
getPosture
Gets a posture in a given organization and location. User must provide revision_id to retrieve a specific revision of the resource. NOT_FOUND error is returned if the revision_id or the Posture name does not exist. In case revision_id is not provided then the latest Posture revision by UpdateTime 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 (SecurityPostureClient securityPostureClient = SecurityPostureClient.create()) { GetPostureRequest request = GetPostureRequest.newBuilder() .setName(PostureName.of("[ORGANIZATION]", "[LOCATION]", "[POSTURE]").toString()) .setRevisionId("revisionId-1507445162") .build(); Posture response = securityPostureClient.getPosture(request); }- Parameters:
request- The request object containing all of the parameters for the API call.- Throws:
ApiException- if the remote call fails
-
getPostureCallable
Gets a posture in a given organization and location. User must provide revision_id to retrieve a specific revision of the resource. NOT_FOUND error is returned if the revision_id or the Posture name does not exist. In case revision_id is not provided then the latest Posture revision by UpdateTime 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 (SecurityPostureClient securityPostureClient = SecurityPostureClient.create()) { GetPostureRequest request = GetPostureRequest.newBuilder() .setName(PostureName.of("[ORGANIZATION]", "[LOCATION]", "[POSTURE]").toString()) .setRevisionId("revisionId-1507445162") .build(); ApiFuture<Posture> future = securityPostureClient.getPostureCallable().futureCall(request); // Do something. Posture response = future.get(); } -
createPostureAsync
public final OperationFuture<Posture,OperationMetadata> createPostureAsync(OrganizationName parent, Posture posture, String postureId) Creates a new Posture resource. If a Posture with the specified name already exists in the specified organization and location, the long running operation returns a [ALREADY_EXISTS][google.rpc.Code.ALREADY_EXISTS] error.Sample code:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (SecurityPostureClient securityPostureClient = SecurityPostureClient.create()) { OrganizationName parent = OrganizationName.of("[ORGANIZATION]", "[LOCATION]"); Posture posture = Posture.newBuilder().build(); String postureId = "postureId2023219203"; Posture response = securityPostureClient.createPostureAsync(parent, posture, postureId).get(); }- Parameters:
parent- Required. Value for parent.posture- Required. The resource being created.postureId- Required. User provided identifier. It should be unique in scope of an Organization and location.- Throws:
ApiException- if the remote call fails
-
createPostureAsync
public final OperationFuture<Posture,OperationMetadata> createPostureAsync(String parent, Posture posture, String postureId) Creates a new Posture resource. If a Posture with the specified name already exists in the specified organization and location, the long running operation returns a [ALREADY_EXISTS][google.rpc.Code.ALREADY_EXISTS] error.Sample code:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (SecurityPostureClient securityPostureClient = SecurityPostureClient.create()) { String parent = OrganizationName.of("[ORGANIZATION]", "[LOCATION]").toString(); Posture posture = Posture.newBuilder().build(); String postureId = "postureId2023219203"; Posture response = securityPostureClient.createPostureAsync(parent, posture, postureId).get(); }- Parameters:
parent- Required. Value for parent.posture- Required. The resource being created.postureId- Required. User provided identifier. It should be unique in scope of an Organization and location.- Throws:
ApiException- if the remote call fails
-
createPostureAsync
public final OperationFuture<Posture,OperationMetadata> createPostureAsync(CreatePostureRequest request) Creates a new Posture resource. If a Posture with the specified name already exists in the specified organization and location, the long running operation returns a [ALREADY_EXISTS][google.rpc.Code.ALREADY_EXISTS] error.Sample code:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (SecurityPostureClient securityPostureClient = SecurityPostureClient.create()) { CreatePostureRequest request = CreatePostureRequest.newBuilder() .setParent(OrganizationName.of("[ORGANIZATION]", "[LOCATION]").toString()) .setPostureId("postureId2023219203") .setPosture(Posture.newBuilder().build()) .build(); Posture response = securityPostureClient.createPostureAsync(request).get(); }- Parameters:
request- The request object containing all of the parameters for the API call.- Throws:
ApiException- if the remote call fails
-
createPostureOperationCallable
public final OperationCallable<CreatePostureRequest,Posture, createPostureOperationCallable()OperationMetadata> Creates a new Posture resource. If a Posture with the specified name already exists in the specified organization and location, the long running operation returns a [ALREADY_EXISTS][google.rpc.Code.ALREADY_EXISTS] error.Sample code:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (SecurityPostureClient securityPostureClient = SecurityPostureClient.create()) { CreatePostureRequest request = CreatePostureRequest.newBuilder() .setParent(OrganizationName.of("[ORGANIZATION]", "[LOCATION]").toString()) .setPostureId("postureId2023219203") .setPosture(Posture.newBuilder().build()) .build(); OperationFuture<Posture, OperationMetadata> future = securityPostureClient.createPostureOperationCallable().futureCall(request); // Do something. Posture response = future.get(); } -
createPostureCallable
Creates a new Posture resource. If a Posture with the specified name already exists in the specified organization and location, the long running operation returns a [ALREADY_EXISTS][google.rpc.Code.ALREADY_EXISTS] error.Sample code:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (SecurityPostureClient securityPostureClient = SecurityPostureClient.create()) { CreatePostureRequest request = CreatePostureRequest.newBuilder() .setParent(OrganizationName.of("[ORGANIZATION]", "[LOCATION]").toString()) .setPostureId("postureId2023219203") .setPosture(Posture.newBuilder().build()) .build(); ApiFuture<Operation> future = securityPostureClient.createPostureCallable().futureCall(request); // Do something. Operation response = future.get(); } -
updatePostureAsync
public final OperationFuture<Posture,OperationMetadata> updatePostureAsync(Posture posture, com.google.protobuf.FieldMask updateMask) Updates an existing Posture. A new revision of the posture will be created if the revision to be updated is currently deployed on a workload. Returns a `google.rpc.Status` with `google.rpc.Code.NOT_FOUND` if the Posture does not exist. Returns a `google.rpc.Status` with `google.rpc.Code.ABORTED` if the etag supplied in the request does not match the persisted etag of the Posture. Updatable fields are state, description and policy_sets. State update operation cannot be clubbed with update of description and policy_sets. An ACTIVE posture can be updated to both DRAFT or DEPRECATED states. Postures in DRAFT or DEPRECATED states can only be updated to ACTIVE state.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 (SecurityPostureClient securityPostureClient = SecurityPostureClient.create()) { Posture posture = Posture.newBuilder().build(); FieldMask updateMask = FieldMask.newBuilder().build(); Posture response = securityPostureClient.updatePostureAsync(posture, updateMask).get(); }- Parameters:
posture- Required. The resource being updated.updateMask- Required. Field mask is used to specify the fields to be overwritten in the Posture resource by the update. The fields specified in the update_mask are relative to the resource, not the full request. A field will be overwritten if it is in the mask. If the user does not provide a mask then all fields will be overwritten.- Throws:
ApiException- if the remote call fails
-
updatePostureAsync
public final OperationFuture<Posture,OperationMetadata> updatePostureAsync(UpdatePostureRequest request) Updates an existing Posture. A new revision of the posture will be created if the revision to be updated is currently deployed on a workload. Returns a `google.rpc.Status` with `google.rpc.Code.NOT_FOUND` if the Posture does not exist. Returns a `google.rpc.Status` with `google.rpc.Code.ABORTED` if the etag supplied in the request does not match the persisted etag of the Posture. Updatable fields are state, description and policy_sets. State update operation cannot be clubbed with update of description and policy_sets. An ACTIVE posture can be updated to both DRAFT or DEPRECATED states. Postures in DRAFT or DEPRECATED states can only be updated to ACTIVE state.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 (SecurityPostureClient securityPostureClient = SecurityPostureClient.create()) { UpdatePostureRequest request = UpdatePostureRequest.newBuilder() .setUpdateMask(FieldMask.newBuilder().build()) .setPosture(Posture.newBuilder().build()) .setRevisionId("revisionId-1507445162") .build(); Posture response = securityPostureClient.updatePostureAsync(request).get(); }- Parameters:
request- The request object containing all of the parameters for the API call.- Throws:
ApiException- if the remote call fails
-
updatePostureOperationCallable
public final OperationCallable<UpdatePostureRequest,Posture, updatePostureOperationCallable()OperationMetadata> Updates an existing Posture. A new revision of the posture will be created if the revision to be updated is currently deployed on a workload. Returns a `google.rpc.Status` with `google.rpc.Code.NOT_FOUND` if the Posture does not exist. Returns a `google.rpc.Status` with `google.rpc.Code.ABORTED` if the etag supplied in the request does not match the persisted etag of the Posture. Updatable fields are state, description and policy_sets. State update operation cannot be clubbed with update of description and policy_sets. An ACTIVE posture can be updated to both DRAFT or DEPRECATED states. Postures in DRAFT or DEPRECATED states can only be updated to ACTIVE state.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 (SecurityPostureClient securityPostureClient = SecurityPostureClient.create()) { UpdatePostureRequest request = UpdatePostureRequest.newBuilder() .setUpdateMask(FieldMask.newBuilder().build()) .setPosture(Posture.newBuilder().build()) .setRevisionId("revisionId-1507445162") .build(); OperationFuture<Posture, OperationMetadata> future = securityPostureClient.updatePostureOperationCallable().futureCall(request); // Do something. Posture response = future.get(); } -
updatePostureCallable
Updates an existing Posture. A new revision of the posture will be created if the revision to be updated is currently deployed on a workload. Returns a `google.rpc.Status` with `google.rpc.Code.NOT_FOUND` if the Posture does not exist. Returns a `google.rpc.Status` with `google.rpc.Code.ABORTED` if the etag supplied in the request does not match the persisted etag of the Posture. Updatable fields are state, description and policy_sets. State update operation cannot be clubbed with update of description and policy_sets. An ACTIVE posture can be updated to both DRAFT or DEPRECATED states. Postures in DRAFT or DEPRECATED states can only be updated to ACTIVE state.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 (SecurityPostureClient securityPostureClient = SecurityPostureClient.create()) { UpdatePostureRequest request = UpdatePostureRequest.newBuilder() .setUpdateMask(FieldMask.newBuilder().build()) .setPosture(Posture.newBuilder().build()) .setRevisionId("revisionId-1507445162") .build(); ApiFuture<Operation> future = securityPostureClient.updatePostureCallable().futureCall(request); // Do something. Operation response = future.get(); } -
deletePostureAsync
public final OperationFuture<com.google.protobuf.Empty,OperationMetadata> deletePostureAsync(PostureName name) Deletes all the revisions of a resource. A posture can only be deleted when none of the revisions are deployed to any workload.Sample code:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (SecurityPostureClient securityPostureClient = SecurityPostureClient.create()) { PostureName name = PostureName.of("[ORGANIZATION]", "[LOCATION]", "[POSTURE]"); securityPostureClient.deletePostureAsync(name).get(); }- Parameters:
name- Required. Name of the resource.- Throws:
ApiException- if the remote call fails
-
deletePostureAsync
public final OperationFuture<com.google.protobuf.Empty,OperationMetadata> deletePostureAsync(String name) Deletes all the revisions of a resource. A posture can only be deleted when none of the revisions are deployed to any workload.Sample code:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (SecurityPostureClient securityPostureClient = SecurityPostureClient.create()) { String name = PostureName.of("[ORGANIZATION]", "[LOCATION]", "[POSTURE]").toString(); securityPostureClient.deletePostureAsync(name).get(); }- Parameters:
name- Required. Name of the resource.- Throws:
ApiException- if the remote call fails
-
deletePostureAsync
public final OperationFuture<com.google.protobuf.Empty,OperationMetadata> deletePostureAsync(DeletePostureRequest request) Deletes all the revisions of a resource. A posture can only be deleted when none of the revisions are deployed to any workload.Sample code:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (SecurityPostureClient securityPostureClient = SecurityPostureClient.create()) { DeletePostureRequest request = DeletePostureRequest.newBuilder() .setName(PostureName.of("[ORGANIZATION]", "[LOCATION]", "[POSTURE]").toString()) .setEtag("etag3123477") .build(); securityPostureClient.deletePostureAsync(request).get(); }- Parameters:
request- The request object containing all of the parameters for the API call.- Throws:
ApiException- if the remote call fails
-
deletePostureOperationCallable
public final OperationCallable<DeletePostureRequest,com.google.protobuf.Empty, deletePostureOperationCallable()OperationMetadata> Deletes all the revisions of a resource. A posture can only be deleted when none of the revisions are deployed to any workload.Sample code:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (SecurityPostureClient securityPostureClient = SecurityPostureClient.create()) { DeletePostureRequest request = DeletePostureRequest.newBuilder() .setName(PostureName.of("[ORGANIZATION]", "[LOCATION]", "[POSTURE]").toString()) .setEtag("etag3123477") .build(); OperationFuture<Empty, OperationMetadata> future = securityPostureClient.deletePostureOperationCallable().futureCall(request); // Do something. future.get(); } -
deletePostureCallable
Deletes all the revisions of a resource. A posture can only be deleted when none of the revisions are deployed to any workload.Sample code:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (SecurityPostureClient securityPostureClient = SecurityPostureClient.create()) { DeletePostureRequest request = DeletePostureRequest.newBuilder() .setName(PostureName.of("[ORGANIZATION]", "[LOCATION]", "[POSTURE]").toString()) .setEtag("etag3123477") .build(); ApiFuture<Operation> future = securityPostureClient.deletePostureCallable().futureCall(request); // Do something. future.get(); } -
extractPostureAsync
public final OperationFuture<Posture,OperationMetadata> extractPostureAsync(OrganizationName parent, String postureId, String workload) Extracts existing policies on a workload as a posture. If a Posture on the given workload already exists, the long running operation returns a [ALREADY_EXISTS][google.rpc.Code.ALREADY_EXISTS] error.Sample code:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (SecurityPostureClient securityPostureClient = SecurityPostureClient.create()) { OrganizationName parent = OrganizationName.of("[ORGANIZATION]", "[LOCATION]"); String postureId = "postureId2023219203"; String workload = "workload35560311"; Posture response = securityPostureClient.extractPostureAsync(parent, postureId, workload).get(); }- Parameters:
parent- Required. The parent resource name. The format of this value is as follows: `organizations/{organization}/locations/{location}`postureId- Required. User provided identifier. It should be unique in scope of an Organization and location.workload- Required. Workload from which the policies are to be extracted, it should belong to the same organization defined in parent. The format of this value varies depending on the scope of the request: - `folder/folderNumber` - `project/projectNumber` - `organization/organizationNumber`- Throws:
ApiException- if the remote call fails
-
extractPostureAsync
public final OperationFuture<Posture,OperationMetadata> extractPostureAsync(String parent, String postureId, String workload) Extracts existing policies on a workload as a posture. If a Posture on the given workload already exists, the long running operation returns a [ALREADY_EXISTS][google.rpc.Code.ALREADY_EXISTS] error.Sample code:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (SecurityPostureClient securityPostureClient = SecurityPostureClient.create()) { String parent = OrganizationName.of("[ORGANIZATION]", "[LOCATION]").toString(); String postureId = "postureId2023219203"; String workload = "workload35560311"; Posture response = securityPostureClient.extractPostureAsync(parent, postureId, workload).get(); }- Parameters:
parent- Required. The parent resource name. The format of this value is as follows: `organizations/{organization}/locations/{location}`postureId- Required. User provided identifier. It should be unique in scope of an Organization and location.workload- Required. Workload from which the policies are to be extracted, it should belong to the same organization defined in parent. The format of this value varies depending on the scope of the request: - `folder/folderNumber` - `project/projectNumber` - `organization/organizationNumber`- Throws:
ApiException- if the remote call fails
-
extractPostureAsync
public final OperationFuture<Posture,OperationMetadata> extractPostureAsync(ExtractPostureRequest request) Extracts existing policies on a workload as a posture. If a Posture on the given workload already exists, the long running operation returns a [ALREADY_EXISTS][google.rpc.Code.ALREADY_EXISTS] error.Sample code:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (SecurityPostureClient securityPostureClient = SecurityPostureClient.create()) { ExtractPostureRequest request = ExtractPostureRequest.newBuilder() .setParent(OrganizationName.of("[ORGANIZATION]", "[LOCATION]").toString()) .setPostureId("postureId2023219203") .setWorkload("workload35560311") .build(); Posture response = securityPostureClient.extractPostureAsync(request).get(); }- Parameters:
request- The request object containing all of the parameters for the API call.- Throws:
ApiException- if the remote call fails
-
extractPostureOperationCallable
public final OperationCallable<ExtractPostureRequest,Posture, extractPostureOperationCallable()OperationMetadata> Extracts existing policies on a workload as a posture. If a Posture on the given workload already exists, the long running operation returns a [ALREADY_EXISTS][google.rpc.Code.ALREADY_EXISTS] error.Sample code:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (SecurityPostureClient securityPostureClient = SecurityPostureClient.create()) { ExtractPostureRequest request = ExtractPostureRequest.newBuilder() .setParent(OrganizationName.of("[ORGANIZATION]", "[LOCATION]").toString()) .setPostureId("postureId2023219203") .setWorkload("workload35560311") .build(); OperationFuture<Posture, OperationMetadata> future = securityPostureClient.extractPostureOperationCallable().futureCall(request); // Do something. Posture response = future.get(); } -
extractPostureCallable
Extracts existing policies on a workload as a posture. If a Posture on the given workload already exists, the long running operation returns a [ALREADY_EXISTS][google.rpc.Code.ALREADY_EXISTS] error.Sample code:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (SecurityPostureClient securityPostureClient = SecurityPostureClient.create()) { ExtractPostureRequest request = ExtractPostureRequest.newBuilder() .setParent(OrganizationName.of("[ORGANIZATION]", "[LOCATION]").toString()) .setPostureId("postureId2023219203") .setWorkload("workload35560311") .build(); ApiFuture<Operation> future = securityPostureClient.extractPostureCallable().futureCall(request); // Do something. Operation response = future.get(); } -
listPostureDeployments
public final SecurityPostureClient.ListPostureDeploymentsPagedResponse listPostureDeployments(OrganizationName parent) PostureDeployments Lists PostureDeployments in a given project and location.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 (SecurityPostureClient securityPostureClient = SecurityPostureClient.create()) { OrganizationName parent = OrganizationName.of("[ORGANIZATION]", "[LOCATION]"); for (PostureDeployment element : securityPostureClient.listPostureDeployments(parent).iterateAll()) { // doThingsWith(element); } }- Parameters:
parent- Required. Parent value for ListPostureDeploymentsRequest.- Throws:
ApiException- if the remote call fails
-
listPostureDeployments
public final SecurityPostureClient.ListPostureDeploymentsPagedResponse listPostureDeployments(String parent) PostureDeployments Lists PostureDeployments in a given project and location.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 (SecurityPostureClient securityPostureClient = SecurityPostureClient.create()) { String parent = OrganizationName.of("[ORGANIZATION]", "[LOCATION]").toString(); for (PostureDeployment element : securityPostureClient.listPostureDeployments(parent).iterateAll()) { // doThingsWith(element); } }- Parameters:
parent- Required. Parent value for ListPostureDeploymentsRequest.- Throws:
ApiException- if the remote call fails
-
listPostureDeployments
public final SecurityPostureClient.ListPostureDeploymentsPagedResponse listPostureDeployments(ListPostureDeploymentsRequest request) PostureDeployments Lists PostureDeployments in a given project and location.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 (SecurityPostureClient securityPostureClient = SecurityPostureClient.create()) { ListPostureDeploymentsRequest request = ListPostureDeploymentsRequest.newBuilder() .setParent(OrganizationName.of("[ORGANIZATION]", "[LOCATION]").toString()) .setPageSize(883849137) .setPageToken("pageToken873572522") .setFilter("filter-1274492040") .build(); for (PostureDeployment element : securityPostureClient.listPostureDeployments(request).iterateAll()) { // doThingsWith(element); } }- Parameters:
request- The request object containing all of the parameters for the API call.- Throws:
ApiException- if the remote call fails
-
listPostureDeploymentsPagedCallable
public final UnaryCallable<ListPostureDeploymentsRequest,SecurityPostureClient.ListPostureDeploymentsPagedResponse> listPostureDeploymentsPagedCallable()PostureDeployments Lists PostureDeployments in a given project and location.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 (SecurityPostureClient securityPostureClient = SecurityPostureClient.create()) { ListPostureDeploymentsRequest request = ListPostureDeploymentsRequest.newBuilder() .setParent(OrganizationName.of("[ORGANIZATION]", "[LOCATION]").toString()) .setPageSize(883849137) .setPageToken("pageToken873572522") .setFilter("filter-1274492040") .build(); ApiFuture<PostureDeployment> future = securityPostureClient.listPostureDeploymentsPagedCallable().futureCall(request); // Do something. for (PostureDeployment element : future.get().iterateAll()) { // doThingsWith(element); } } -
listPostureDeploymentsCallable
public final UnaryCallable<ListPostureDeploymentsRequest,ListPostureDeploymentsResponse> listPostureDeploymentsCallable()PostureDeployments Lists PostureDeployments in a given project and location.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 (SecurityPostureClient securityPostureClient = SecurityPostureClient.create()) { ListPostureDeploymentsRequest request = ListPostureDeploymentsRequest.newBuilder() .setParent(OrganizationName.of("[ORGANIZATION]", "[LOCATION]").toString()) .setPageSize(883849137) .setPageToken("pageToken873572522") .setFilter("filter-1274492040") .build(); while (true) { ListPostureDeploymentsResponse response = securityPostureClient.listPostureDeploymentsCallable().call(request); for (PostureDeployment element : response.getPostureDeploymentsList()) { // doThingsWith(element); } String nextPageToken = response.getNextPageToken(); if (!Strings.isNullOrEmpty(nextPageToken)) { request = request.toBuilder().setPageToken(nextPageToken).build(); } else { break; } } } -
getPostureDeployment
Gets details of a single PostureDeployment.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 (SecurityPostureClient securityPostureClient = SecurityPostureClient.create()) { PostureDeploymentName name = PostureDeploymentName.of("[ORGANIZATION]", "[LOCATION]", "[POSTURE_DEPLOYMENT]"); PostureDeployment response = securityPostureClient.getPostureDeployment(name); }- Parameters:
name- Required. Name of the resource.- Throws:
ApiException- if the remote call fails
-
getPostureDeployment
Gets details of a single PostureDeployment.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 (SecurityPostureClient securityPostureClient = SecurityPostureClient.create()) { String name = PostureDeploymentName.of("[ORGANIZATION]", "[LOCATION]", "[POSTURE_DEPLOYMENT]") .toString(); PostureDeployment response = securityPostureClient.getPostureDeployment(name); }- Parameters:
name- Required. Name of the resource.- Throws:
ApiException- if the remote call fails
-
getPostureDeployment
Gets details of a single PostureDeployment.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 (SecurityPostureClient securityPostureClient = SecurityPostureClient.create()) { GetPostureDeploymentRequest request = GetPostureDeploymentRequest.newBuilder() .setName( PostureDeploymentName.of("[ORGANIZATION]", "[LOCATION]", "[POSTURE_DEPLOYMENT]") .toString()) .build(); PostureDeployment response = securityPostureClient.getPostureDeployment(request); }- Parameters:
request- The request object containing all of the parameters for the API call.- Throws:
ApiException- if the remote call fails
-
getPostureDeploymentCallable
public final UnaryCallable<GetPostureDeploymentRequest,PostureDeployment> getPostureDeploymentCallable()Gets details of a single PostureDeployment.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 (SecurityPostureClient securityPostureClient = SecurityPostureClient.create()) { GetPostureDeploymentRequest request = GetPostureDeploymentRequest.newBuilder() .setName( PostureDeploymentName.of("[ORGANIZATION]", "[LOCATION]", "[POSTURE_DEPLOYMENT]") .toString()) .build(); ApiFuture<PostureDeployment> future = securityPostureClient.getPostureDeploymentCallable().futureCall(request); // Do something. PostureDeployment response = future.get(); } -
createPostureDeploymentAsync
public final OperationFuture<PostureDeployment,OperationMetadata> createPostureDeploymentAsync(OrganizationName parent, PostureDeployment postureDeployment, String postureDeploymentId) Creates a new PostureDeployment in a given project and location.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 (SecurityPostureClient securityPostureClient = SecurityPostureClient.create()) { OrganizationName parent = OrganizationName.of("[ORGANIZATION]", "[LOCATION]"); PostureDeployment postureDeployment = PostureDeployment.newBuilder().build(); String postureDeploymentId = "postureDeploymentId1771206568"; PostureDeployment response = securityPostureClient .createPostureDeploymentAsync(parent, postureDeployment, postureDeploymentId) .get(); }- Parameters:
parent- Required. Value for parent. Format: organizations/{org_id}/locations/{location}postureDeployment- Required. The resource being created.postureDeploymentId- Required. User provided identifier. It should be unique in scope of an Organization and location.- Throws:
ApiException- if the remote call fails
-
createPostureDeploymentAsync
public final OperationFuture<PostureDeployment,OperationMetadata> createPostureDeploymentAsync(String parent, PostureDeployment postureDeployment, String postureDeploymentId) Creates a new PostureDeployment in a given project and location.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 (SecurityPostureClient securityPostureClient = SecurityPostureClient.create()) { String parent = OrganizationName.of("[ORGANIZATION]", "[LOCATION]").toString(); PostureDeployment postureDeployment = PostureDeployment.newBuilder().build(); String postureDeploymentId = "postureDeploymentId1771206568"; PostureDeployment response = securityPostureClient .createPostureDeploymentAsync(parent, postureDeployment, postureDeploymentId) .get(); }- Parameters:
parent- Required. Value for parent. Format: organizations/{org_id}/locations/{location}postureDeployment- Required. The resource being created.postureDeploymentId- Required. User provided identifier. It should be unique in scope of an Organization and location.- Throws:
ApiException- if the remote call fails
-
createPostureDeploymentAsync
public final OperationFuture<PostureDeployment,OperationMetadata> createPostureDeploymentAsync(CreatePostureDeploymentRequest request) Creates a new PostureDeployment in a given project and location.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 (SecurityPostureClient securityPostureClient = SecurityPostureClient.create()) { CreatePostureDeploymentRequest request = CreatePostureDeploymentRequest.newBuilder() .setParent(OrganizationName.of("[ORGANIZATION]", "[LOCATION]").toString()) .setPostureDeploymentId("postureDeploymentId1771206568") .setPostureDeployment(PostureDeployment.newBuilder().build()) .build(); PostureDeployment response = securityPostureClient.createPostureDeploymentAsync(request).get(); }- Parameters:
request- The request object containing all of the parameters for the API call.- Throws:
ApiException- if the remote call fails
-
createPostureDeploymentOperationCallable
public final OperationCallable<CreatePostureDeploymentRequest,PostureDeployment, createPostureDeploymentOperationCallable()OperationMetadata> Creates a new PostureDeployment in a given project and location.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 (SecurityPostureClient securityPostureClient = SecurityPostureClient.create()) { CreatePostureDeploymentRequest request = CreatePostureDeploymentRequest.newBuilder() .setParent(OrganizationName.of("[ORGANIZATION]", "[LOCATION]").toString()) .setPostureDeploymentId("postureDeploymentId1771206568") .setPostureDeployment(PostureDeployment.newBuilder().build()) .build(); OperationFuture<PostureDeployment, OperationMetadata> future = securityPostureClient.createPostureDeploymentOperationCallable().futureCall(request); // Do something. PostureDeployment response = future.get(); } -
createPostureDeploymentCallable
public final UnaryCallable<CreatePostureDeploymentRequest,Operation> createPostureDeploymentCallable()Creates a new PostureDeployment in a given project and location.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 (SecurityPostureClient securityPostureClient = SecurityPostureClient.create()) { CreatePostureDeploymentRequest request = CreatePostureDeploymentRequest.newBuilder() .setParent(OrganizationName.of("[ORGANIZATION]", "[LOCATION]").toString()) .setPostureDeploymentId("postureDeploymentId1771206568") .setPostureDeployment(PostureDeployment.newBuilder().build()) .build(); ApiFuture<Operation> future = securityPostureClient.createPostureDeploymentCallable().futureCall(request); // Do something. Operation response = future.get(); } -
updatePostureDeploymentAsync
public final OperationFuture<PostureDeployment,OperationMetadata> updatePostureDeploymentAsync(PostureDeployment postureDeployment, com.google.protobuf.FieldMask updateMask) Updates the parameters of a single PostureDeployment.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 (SecurityPostureClient securityPostureClient = SecurityPostureClient.create()) { PostureDeployment postureDeployment = PostureDeployment.newBuilder().build(); FieldMask updateMask = FieldMask.newBuilder().build(); PostureDeployment response = securityPostureClient.updatePostureDeploymentAsync(postureDeployment, updateMask).get(); }- Parameters:
postureDeployment- Required. The resource being updated.updateMask- Required. Field mask is used to specify the fields to be overwritten in the PostureDeployment resource by the update. The fields specified in the update_mask are relative to the resource, not the full request. A field will be overwritten if it is in the mask. If the user does not provide a mask then all fields will be overwritten.- Throws:
ApiException- if the remote call fails
-
updatePostureDeploymentAsync
public final OperationFuture<PostureDeployment,OperationMetadata> updatePostureDeploymentAsync(UpdatePostureDeploymentRequest request) Updates the parameters of a single PostureDeployment.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 (SecurityPostureClient securityPostureClient = SecurityPostureClient.create()) { UpdatePostureDeploymentRequest request = UpdatePostureDeploymentRequest.newBuilder() .setUpdateMask(FieldMask.newBuilder().build()) .setPostureDeployment(PostureDeployment.newBuilder().build()) .build(); PostureDeployment response = securityPostureClient.updatePostureDeploymentAsync(request).get(); }- Parameters:
request- The request object containing all of the parameters for the API call.- Throws:
ApiException- if the remote call fails
-
updatePostureDeploymentOperationCallable
public final OperationCallable<UpdatePostureDeploymentRequest,PostureDeployment, updatePostureDeploymentOperationCallable()OperationMetadata> Updates the parameters of a single PostureDeployment.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 (SecurityPostureClient securityPostureClient = SecurityPostureClient.create()) { UpdatePostureDeploymentRequest request = UpdatePostureDeploymentRequest.newBuilder() .setUpdateMask(FieldMask.newBuilder().build()) .setPostureDeployment(PostureDeployment.newBuilder().build()) .build(); OperationFuture<PostureDeployment, OperationMetadata> future = securityPostureClient.updatePostureDeploymentOperationCallable().futureCall(request); // Do something. PostureDeployment response = future.get(); } -
updatePostureDeploymentCallable
public final UnaryCallable<UpdatePostureDeploymentRequest,Operation> updatePostureDeploymentCallable()Updates the parameters of a single PostureDeployment.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 (SecurityPostureClient securityPostureClient = SecurityPostureClient.create()) { UpdatePostureDeploymentRequest request = UpdatePostureDeploymentRequest.newBuilder() .setUpdateMask(FieldMask.newBuilder().build()) .setPostureDeployment(PostureDeployment.newBuilder().build()) .build(); ApiFuture<Operation> future = securityPostureClient.updatePostureDeploymentCallable().futureCall(request); // Do something. Operation response = future.get(); } -
deletePostureDeploymentAsync
public final OperationFuture<com.google.protobuf.Empty,OperationMetadata> deletePostureDeploymentAsync(PostureDeploymentName name) Deletes a single PostureDeployment.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 (SecurityPostureClient securityPostureClient = SecurityPostureClient.create()) { PostureDeploymentName name = PostureDeploymentName.of("[ORGANIZATION]", "[LOCATION]", "[POSTURE_DEPLOYMENT]"); securityPostureClient.deletePostureDeploymentAsync(name).get(); }- Parameters:
name- Required. Name of the resource.- Throws:
ApiException- if the remote call fails
-
deletePostureDeploymentAsync
public final OperationFuture<com.google.protobuf.Empty,OperationMetadata> deletePostureDeploymentAsync(String name) Deletes a single PostureDeployment.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 (SecurityPostureClient securityPostureClient = SecurityPostureClient.create()) { String name = PostureDeploymentName.of("[ORGANIZATION]", "[LOCATION]", "[POSTURE_DEPLOYMENT]") .toString(); securityPostureClient.deletePostureDeploymentAsync(name).get(); }- Parameters:
name- Required. Name of the resource.- Throws:
ApiException- if the remote call fails
-
deletePostureDeploymentAsync
public final OperationFuture<com.google.protobuf.Empty,OperationMetadata> deletePostureDeploymentAsync(DeletePostureDeploymentRequest request) Deletes a single PostureDeployment.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 (SecurityPostureClient securityPostureClient = SecurityPostureClient.create()) { DeletePostureDeploymentRequest request = DeletePostureDeploymentRequest.newBuilder() .setName( PostureDeploymentName.of("[ORGANIZATION]", "[LOCATION]", "[POSTURE_DEPLOYMENT]") .toString()) .setEtag("etag3123477") .build(); securityPostureClient.deletePostureDeploymentAsync(request).get(); }- Parameters:
request- The request object containing all of the parameters for the API call.- Throws:
ApiException- if the remote call fails
-
deletePostureDeploymentOperationCallable
public final OperationCallable<DeletePostureDeploymentRequest,com.google.protobuf.Empty, deletePostureDeploymentOperationCallable()OperationMetadata> Deletes a single PostureDeployment.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 (SecurityPostureClient securityPostureClient = SecurityPostureClient.create()) { DeletePostureDeploymentRequest request = DeletePostureDeploymentRequest.newBuilder() .setName( PostureDeploymentName.of("[ORGANIZATION]", "[LOCATION]", "[POSTURE_DEPLOYMENT]") .toString()) .setEtag("etag3123477") .build(); OperationFuture<Empty, OperationMetadata> future = securityPostureClient.deletePostureDeploymentOperationCallable().futureCall(request); // Do something. future.get(); } -
deletePostureDeploymentCallable
public final UnaryCallable<DeletePostureDeploymentRequest,Operation> deletePostureDeploymentCallable()Deletes a single PostureDeployment.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 (SecurityPostureClient securityPostureClient = SecurityPostureClient.create()) { DeletePostureDeploymentRequest request = DeletePostureDeploymentRequest.newBuilder() .setName( PostureDeploymentName.of("[ORGANIZATION]", "[LOCATION]", "[POSTURE_DEPLOYMENT]") .toString()) .setEtag("etag3123477") .build(); ApiFuture<Operation> future = securityPostureClient.deletePostureDeploymentCallable().futureCall(request); // Do something. future.get(); } -
listPostureTemplates
public final SecurityPostureClient.ListPostureTemplatesPagedResponse listPostureTemplates(OrganizationName parent) PostureTemplates Lists all the PostureTemplates available to the user.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 (SecurityPostureClient securityPostureClient = SecurityPostureClient.create()) { OrganizationName parent = OrganizationName.of("[ORGANIZATION]", "[LOCATION]"); for (PostureTemplate element : securityPostureClient.listPostureTemplates(parent).iterateAll()) { // doThingsWith(element); } }- Parameters:
parent- Required. Parent value for ListPostureTemplatesRequest.- Throws:
ApiException- if the remote call fails
-
listPostureTemplates
public final SecurityPostureClient.ListPostureTemplatesPagedResponse listPostureTemplates(String parent) PostureTemplates Lists all the PostureTemplates available to the user.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 (SecurityPostureClient securityPostureClient = SecurityPostureClient.create()) { String parent = OrganizationName.of("[ORGANIZATION]", "[LOCATION]").toString(); for (PostureTemplate element : securityPostureClient.listPostureTemplates(parent).iterateAll()) { // doThingsWith(element); } }- Parameters:
parent- Required. Parent value for ListPostureTemplatesRequest.- Throws:
ApiException- if the remote call fails
-
listPostureTemplates
public final SecurityPostureClient.ListPostureTemplatesPagedResponse listPostureTemplates(ListPostureTemplatesRequest request) PostureTemplates Lists all the PostureTemplates available to the user.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 (SecurityPostureClient securityPostureClient = SecurityPostureClient.create()) { ListPostureTemplatesRequest request = ListPostureTemplatesRequest.newBuilder() .setParent(OrganizationName.of("[ORGANIZATION]", "[LOCATION]").toString()) .setPageSize(883849137) .setPageToken("pageToken873572522") .setFilter("filter-1274492040") .build(); for (PostureTemplate element : securityPostureClient.listPostureTemplates(request).iterateAll()) { // doThingsWith(element); } }- Parameters:
request- The request object containing all of the parameters for the API call.- Throws:
ApiException- if the remote call fails
-
listPostureTemplatesPagedCallable
public final UnaryCallable<ListPostureTemplatesRequest,SecurityPostureClient.ListPostureTemplatesPagedResponse> listPostureTemplatesPagedCallable()PostureTemplates Lists all the PostureTemplates available to the user.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 (SecurityPostureClient securityPostureClient = SecurityPostureClient.create()) { ListPostureTemplatesRequest request = ListPostureTemplatesRequest.newBuilder() .setParent(OrganizationName.of("[ORGANIZATION]", "[LOCATION]").toString()) .setPageSize(883849137) .setPageToken("pageToken873572522") .setFilter("filter-1274492040") .build(); ApiFuture<PostureTemplate> future = securityPostureClient.listPostureTemplatesPagedCallable().futureCall(request); // Do something. for (PostureTemplate element : future.get().iterateAll()) { // doThingsWith(element); } } -
listPostureTemplatesCallable
public final UnaryCallable<ListPostureTemplatesRequest,ListPostureTemplatesResponse> listPostureTemplatesCallable()PostureTemplates Lists all the PostureTemplates available to the user.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 (SecurityPostureClient securityPostureClient = SecurityPostureClient.create()) { ListPostureTemplatesRequest request = ListPostureTemplatesRequest.newBuilder() .setParent(OrganizationName.of("[ORGANIZATION]", "[LOCATION]").toString()) .setPageSize(883849137) .setPageToken("pageToken873572522") .setFilter("filter-1274492040") .build(); while (true) { ListPostureTemplatesResponse response = securityPostureClient.listPostureTemplatesCallable().call(request); for (PostureTemplate element : response.getPostureTemplatesList()) { // doThingsWith(element); } String nextPageToken = response.getNextPageToken(); if (!Strings.isNullOrEmpty(nextPageToken)) { request = request.toBuilder().setPageToken(nextPageToken).build(); } else { break; } } } -
getPostureTemplate
Gets a PostureTemplate. User must provide revision_id to retrieve a specific revision of the resource. NOT_FOUND error is returned if the revision_id or the PostureTemplate name does not exist. In case revision_id is not provided then the PostureTemplate with latest revision_id 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 (SecurityPostureClient securityPostureClient = SecurityPostureClient.create()) { PostureTemplateName name = PostureTemplateName.of("[ORGANIZATION]", "[LOCATION]", "[POSTURE_TEMPLATE]"); PostureTemplate response = securityPostureClient.getPostureTemplate(name); }- Parameters:
name- Required. Name of the resource.- Throws:
ApiException- if the remote call fails
-
getPostureTemplate
Gets a PostureTemplate. User must provide revision_id to retrieve a specific revision of the resource. NOT_FOUND error is returned if the revision_id or the PostureTemplate name does not exist. In case revision_id is not provided then the PostureTemplate with latest revision_id 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 (SecurityPostureClient securityPostureClient = SecurityPostureClient.create()) { String name = PostureTemplateName.of("[ORGANIZATION]", "[LOCATION]", "[POSTURE_TEMPLATE]").toString(); PostureTemplate response = securityPostureClient.getPostureTemplate(name); }- Parameters:
name- Required. Name of the resource.- Throws:
ApiException- if the remote call fails
-
getPostureTemplate
Gets a PostureTemplate. User must provide revision_id to retrieve a specific revision of the resource. NOT_FOUND error is returned if the revision_id or the PostureTemplate name does not exist. In case revision_id is not provided then the PostureTemplate with latest revision_id 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 (SecurityPostureClient securityPostureClient = SecurityPostureClient.create()) { GetPostureTemplateRequest request = GetPostureTemplateRequest.newBuilder() .setName( PostureTemplateName.of("[ORGANIZATION]", "[LOCATION]", "[POSTURE_TEMPLATE]") .toString()) .setRevisionId("revisionId-1507445162") .build(); PostureTemplate response = securityPostureClient.getPostureTemplate(request); }- Parameters:
request- The request object containing all of the parameters for the API call.- Throws:
ApiException- if the remote call fails
-
getPostureTemplateCallable
Gets a PostureTemplate. User must provide revision_id to retrieve a specific revision of the resource. NOT_FOUND error is returned if the revision_id or the PostureTemplate name does not exist. In case revision_id is not provided then the PostureTemplate with latest revision_id 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 (SecurityPostureClient securityPostureClient = SecurityPostureClient.create()) { GetPostureTemplateRequest request = GetPostureTemplateRequest.newBuilder() .setName( PostureTemplateName.of("[ORGANIZATION]", "[LOCATION]", "[POSTURE_TEMPLATE]") .toString()) .setRevisionId("revisionId-1507445162") .build(); ApiFuture<PostureTemplate> future = securityPostureClient.getPostureTemplateCallable().futureCall(request); // Do something. PostureTemplate response = future.get(); } -
listLocations
public final SecurityPostureClient.ListLocationsPagedResponse listLocations(ListLocationsRequest request) Lists information about the supported locations for this service.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 (SecurityPostureClient securityPostureClient = SecurityPostureClient.create()) { ListLocationsRequest request = ListLocationsRequest.newBuilder() .setName("name3373707") .setFilter("filter-1274492040") .setPageSize(883849137) .setPageToken("pageToken873572522") .build(); for (Location element : securityPostureClient.listLocations(request).iterateAll()) { // doThingsWith(element); } }- Parameters:
request- The request object containing all of the parameters for the API call.- Throws:
ApiException- if the remote call fails
-
listLocationsPagedCallable
public final UnaryCallable<ListLocationsRequest,SecurityPostureClient.ListLocationsPagedResponse> listLocationsPagedCallable()Lists information about the supported locations for this service.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 (SecurityPostureClient securityPostureClient = SecurityPostureClient.create()) { ListLocationsRequest request = ListLocationsRequest.newBuilder() .setName("name3373707") .setFilter("filter-1274492040") .setPageSize(883849137) .setPageToken("pageToken873572522") .build(); ApiFuture<Location> future = securityPostureClient.listLocationsPagedCallable().futureCall(request); // Do something. for (Location element : future.get().iterateAll()) { // doThingsWith(element); } } -
listLocationsCallable
Lists information about the supported locations for this service.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 (SecurityPostureClient securityPostureClient = SecurityPostureClient.create()) { ListLocationsRequest request = ListLocationsRequest.newBuilder() .setName("name3373707") .setFilter("filter-1274492040") .setPageSize(883849137) .setPageToken("pageToken873572522") .build(); while (true) { ListLocationsResponse response = securityPostureClient.listLocationsCallable().call(request); for (Location element : response.getLocationsList()) { // doThingsWith(element); } String nextPageToken = response.getNextPageToken(); if (!Strings.isNullOrEmpty(nextPageToken)) { request = request.toBuilder().setPageToken(nextPageToken).build(); } else { break; } } } -
getLocation
Gets information about a location.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 (SecurityPostureClient securityPostureClient = SecurityPostureClient.create()) { GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build(); Location response = securityPostureClient.getLocation(request); }- Parameters:
request- The request object containing all of the parameters for the API call.- Throws:
ApiException- if the remote call fails
-
getLocationCallable
Gets information about a location.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 (SecurityPostureClient securityPostureClient = SecurityPostureClient.create()) { GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build(); ApiFuture<Location> future = securityPostureClient.getLocationCallable().futureCall(request); // Do something. Location response = future.get(); } -
close
public final void close()- Specified by:
closein interfaceAutoCloseable
-
shutdown
public void shutdown()- Specified by:
shutdownin interfaceBackgroundResource
-
isShutdown
public boolean isShutdown()- Specified by:
isShutdownin interfaceBackgroundResource
-
isTerminated
public boolean isTerminated()- Specified by:
isTerminatedin interfaceBackgroundResource
-
shutdownNow
public void shutdownNow()- Specified by:
shutdownNowin interfaceBackgroundResource
-
awaitTermination
- Specified by:
awaitTerminationin interfaceBackgroundResource- Throws:
InterruptedException
-