com.google.cloud.securityposture.v1.SecurityPostureClient Maven / Gradle / Ivy
Show all versions of google-cloud-securityposture Show documentation
/*
* Copyright 2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.google.cloud.securityposture.v1;
import com.google.api.core.ApiFuture;
import com.google.api.core.ApiFutures;
import com.google.api.core.BetaApi;
import com.google.api.gax.core.BackgroundResource;
import com.google.api.gax.httpjson.longrunning.OperationsClient;
import com.google.api.gax.longrunning.OperationFuture;
import com.google.api.gax.paging.AbstractFixedSizeCollection;
import com.google.api.gax.paging.AbstractPage;
import com.google.api.gax.paging.AbstractPagedListResponse;
import com.google.api.gax.rpc.OperationCallable;
import com.google.api.gax.rpc.PageContext;
import com.google.api.gax.rpc.UnaryCallable;
import com.google.cloud.location.GetLocationRequest;
import com.google.cloud.location.ListLocationsRequest;
import com.google.cloud.location.ListLocationsResponse;
import com.google.cloud.location.Location;
import com.google.cloud.securityposture.v1.stub.SecurityPostureStub;
import com.google.cloud.securityposture.v1.stub.SecurityPostureStubSettings;
import com.google.common.util.concurrent.MoreExecutors;
import com.google.longrunning.Operation;
import com.google.protobuf.Empty;
import com.google.protobuf.FieldMask;
import java.io.IOException;
import java.util.List;
import java.util.concurrent.TimeUnit;
import javax.annotation.Generated;
// AUTO-GENERATED DOCUMENTATION AND CLASS.
/**
* Service Description: Service describing handlers for resources.
*
* 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:
*
*
{@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);
* }
* }
*
* 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().
*
*
* Methods
*
* 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.
*
* listPostures(ListPosturesRequest request)
*
* "Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.
*
* listPostures(OrganizationName parent)
*
listPostures(String parent)
*
* Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
*
* listPosturesPagedCallable()
*
listPosturesCallable()
*
*
*
*
* 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.
*
* listPostureRevisions(ListPostureRevisionsRequest request)
*
* Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
*
* listPostureRevisionsPagedCallable()
*
listPostureRevisionsCallable()
*
*
*
*
* 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.
*
* getPosture(GetPostureRequest request)
*
* "Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.
*
* getPosture(PostureName name)
*
getPosture(String name)
*
* Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
*
* getPostureCallable()
*
*
*
*
* 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.
*
* createPostureAsync(CreatePostureRequest request)
*
* Methods that return long-running operations have "Async" method variants that return `OperationFuture`, which is used to track polling of the service.
*
* createPostureAsync(OrganizationName parent, Posture posture, String postureId)
*
createPostureAsync(String parent, Posture posture, String postureId)
*
* Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
*
* createPostureOperationCallable()
*
createPostureCallable()
*
*
*
*
* 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.
*
* updatePostureAsync(UpdatePostureRequest request)
*
* Methods that return long-running operations have "Async" method variants that return `OperationFuture`, which is used to track polling of the service.
*
* updatePostureAsync(Posture posture, FieldMask updateMask)
*
* Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
*
* updatePostureOperationCallable()
*
updatePostureCallable()
*
*
*
*
* 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.
*
* deletePostureAsync(DeletePostureRequest request)
*
* Methods that return long-running operations have "Async" method variants that return `OperationFuture`, which is used to track polling of the service.
*
* deletePostureAsync(PostureName name)
*
deletePostureAsync(String name)
*
* Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
*
* deletePostureOperationCallable()
*
deletePostureCallable()
*
*
*
*
* 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.
*
* extractPostureAsync(ExtractPostureRequest request)
*
* Methods that return long-running operations have "Async" method variants that return `OperationFuture`, which is used to track polling of the service.
*
* extractPostureAsync(OrganizationName parent, String postureId, String workload)
*
extractPostureAsync(String parent, String postureId, String workload)
*
* Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
*
* extractPostureOperationCallable()
*
extractPostureCallable()
*
*
*
*
* 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.
*
* listPostureDeployments(ListPostureDeploymentsRequest request)
*
* "Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.
*
* listPostureDeployments(OrganizationName parent)
*
listPostureDeployments(String parent)
*
* Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
*
* listPostureDeploymentsPagedCallable()
*
listPostureDeploymentsCallable()
*
*
*
*
* 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.
*
* getPostureDeployment(GetPostureDeploymentRequest request)
*
* "Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.
*
* getPostureDeployment(PostureDeploymentName name)
*
getPostureDeployment(String name)
*
* Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
*
* getPostureDeploymentCallable()
*
*
*
*
* 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.
*
* createPostureDeploymentAsync(CreatePostureDeploymentRequest request)
*
* Methods that return long-running operations have "Async" method variants that return `OperationFuture`, which is used to track polling of the service.
*
* createPostureDeploymentAsync(OrganizationName parent, PostureDeployment postureDeployment, String postureDeploymentId)
*
createPostureDeploymentAsync(String parent, PostureDeployment postureDeployment, String postureDeploymentId)
*
* Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
*
* createPostureDeploymentOperationCallable()
*
createPostureDeploymentCallable()
*
*
*
*
* 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.
*
* updatePostureDeploymentAsync(UpdatePostureDeploymentRequest request)
*
* Methods that return long-running operations have "Async" method variants that return `OperationFuture`, which is used to track polling of the service.
*
* updatePostureDeploymentAsync(PostureDeployment postureDeployment, FieldMask updateMask)
*
* Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
*
* updatePostureDeploymentOperationCallable()
*
updatePostureDeploymentCallable()
*
*
*
*
* DeletePostureDeployment
* Deletes a single PostureDeployment.
*
* Request object method variants only take one parameter, a request object, which must be constructed before the call.
*
* deletePostureDeploymentAsync(DeletePostureDeploymentRequest request)
*
* Methods that return long-running operations have "Async" method variants that return `OperationFuture`, which is used to track polling of the service.
*
* deletePostureDeploymentAsync(PostureDeploymentName name)
*
deletePostureDeploymentAsync(String name)
*
* Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
*
* deletePostureDeploymentOperationCallable()
*
deletePostureDeploymentCallable()
*
*
*
*
* 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.
*
* listPostureTemplates(ListPostureTemplatesRequest request)
*
* "Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.
*
* listPostureTemplates(OrganizationName parent)
*
listPostureTemplates(String parent)
*
* Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
*
* listPostureTemplatesPagedCallable()
*
listPostureTemplatesCallable()
*
*
*
*
* 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.
*
* getPostureTemplate(GetPostureTemplateRequest request)
*
* "Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.
*
* getPostureTemplate(PostureTemplateName name)
*
getPostureTemplate(String name)
*
* Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
*
* getPostureTemplateCallable()
*
*
*
*
* 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.
*
* listLocations(ListLocationsRequest request)
*
* Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
*
* listLocationsPagedCallable()
*
listLocationsCallable()
*
*
*
*
* GetLocation
* Gets information about a location.
*
* Request object method variants only take one parameter, a request object, which must be constructed before the call.
*
* getLocation(GetLocationRequest request)
*
* Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
*
* getLocationCallable()
*
*
*
*
*
* 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:
*
*
{@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
* SecurityPostureSettings securityPostureSettings =
* SecurityPostureSettings.newBuilder()
* .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
* .build();
* SecurityPostureClient securityPostureClient =
* SecurityPostureClient.create(securityPostureSettings);
* }
*
* To customize the endpoint:
*
*
{@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
* 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:
*
*
{@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
* SecurityPostureSettings securityPostureSettings =
* SecurityPostureSettings.newHttpJsonBuilder().build();
* SecurityPostureClient securityPostureClient =
* SecurityPostureClient.create(securityPostureSettings);
* }
*
* Please refer to the GitHub repository's samples for more quickstart code snippets.
*/
@Generated("by gapic-generator-java")
public class SecurityPostureClient implements BackgroundResource {
private final SecurityPostureSettings settings;
private final SecurityPostureStub stub;
private final OperationsClient httpJsonOperationsClient;
private final com.google.longrunning.OperationsClient operationsClient;
/** Constructs an instance of SecurityPostureClient with default settings. */
public static final SecurityPostureClient create() throws IOException {
return create(SecurityPostureSettings.newBuilder().build());
}
/**
* 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.
*/
public static final SecurityPostureClient create(SecurityPostureSettings settings)
throws IOException {
return new SecurityPostureClient(settings);
}
/**
* Constructs an instance of SecurityPostureClient, using the given stub for making calls. This is
* for advanced usage - prefer using create(SecurityPostureSettings).
*/
public static final SecurityPostureClient create(SecurityPostureStub stub) {
return new SecurityPostureClient(stub);
}
/**
* 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.
*/
protected SecurityPostureClient(SecurityPostureSettings settings) throws IOException {
this.settings = settings;
this.stub = ((SecurityPostureStubSettings) settings.getStubSettings()).createStub();
this.operationsClient =
com.google.longrunning.OperationsClient.create(this.stub.getOperationsStub());
this.httpJsonOperationsClient = OperationsClient.create(this.stub.getHttpJsonOperationsStub());
}
protected SecurityPostureClient(SecurityPostureStub stub) {
this.settings = null;
this.stub = stub;
this.operationsClient =
com.google.longrunning.OperationsClient.create(this.stub.getOperationsStub());
this.httpJsonOperationsClient = OperationsClient.create(this.stub.getHttpJsonOperationsStub());
}
public final SecurityPostureSettings getSettings() {
return settings;
}
public SecurityPostureStub getStub() {
return stub;
}
/**
* Returns the OperationsClient that can be used to query the status of a long-running operation
* returned by another API method call.
*/
public final com.google.longrunning.OperationsClient getOperationsClient() {
return operationsClient;
}
/**
* Returns the OperationsClient that can be used to query the status of a long-running operation
* returned by another API method call.
*/
@BetaApi
public final OperationsClient getHttpJsonOperationsClient() {
return httpJsonOperationsClient;
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* (-- 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:
*
*
{@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);
* }
* }
* }
*
* @param parent Required. Parent value for ListPosturesRequest.
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
public final ListPosturesPagedResponse listPostures(OrganizationName parent) {
ListPosturesRequest request =
ListPosturesRequest.newBuilder()
.setParent(parent == null ? null : parent.toString())
.build();
return listPostures(request);
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* (-- 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:
*
*
{@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);
* }
* }
* }
*
* @param parent Required. Parent value for ListPosturesRequest.
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
public final ListPosturesPagedResponse listPostures(String parent) {
ListPosturesRequest request = ListPosturesRequest.newBuilder().setParent(parent).build();
return listPostures(request);
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* (-- 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:
*
*
{@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);
* }
* }
* }
*
* @param request The request object containing all of the parameters for the API call.
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
public final ListPosturesPagedResponse listPostures(ListPosturesRequest request) {
return listPosturesPagedCallable().call(request);
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* (-- 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:
*
*
{@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 future =
* securityPostureClient.listPosturesPagedCallable().futureCall(request);
* // Do something.
* for (Posture element : future.get().iterateAll()) {
* // doThingsWith(element);
* }
* }
* }
*/
public final UnaryCallable
listPosturesPagedCallable() {
return stub.listPosturesPagedCallable();
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* (-- 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:
*
*
{@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;
* }
* }
* }
* }
*/
public final UnaryCallable listPosturesCallable() {
return stub.listPosturesCallable();
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Lists revisions of a Posture in a given organization and location.
*
* Sample code:
*
*
{@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);
* }
* }
* }
*
* @param request The request object containing all of the parameters for the API call.
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
public final ListPostureRevisionsPagedResponse listPostureRevisions(
ListPostureRevisionsRequest request) {
return listPostureRevisionsPagedCallable().call(request);
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Lists revisions of a Posture in a given organization and location.
*
* Sample code:
*
*
{@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 future =
* securityPostureClient.listPostureRevisionsPagedCallable().futureCall(request);
* // Do something.
* for (Posture element : future.get().iterateAll()) {
* // doThingsWith(element);
* }
* }
* }
*/
public final UnaryCallable
listPostureRevisionsPagedCallable() {
return stub.listPostureRevisionsPagedCallable();
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Lists revisions of a Posture in a given organization and location.
*
* Sample code:
*
*
{@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;
* }
* }
* }
* }
*/
public final UnaryCallable
listPostureRevisionsCallable() {
return stub.listPostureRevisionsCallable();
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* 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:
*
*
{@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);
* }
* }
*
* @param name Required. Name of the resource.
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
public final Posture getPosture(PostureName name) {
GetPostureRequest request =
GetPostureRequest.newBuilder().setName(name == null ? null : name.toString()).build();
return getPosture(request);
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* 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:
*
*
{@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);
* }
* }
*
* @param name Required. Name of the resource.
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
public final Posture getPosture(String name) {
GetPostureRequest request = GetPostureRequest.newBuilder().setName(name).build();
return getPosture(request);
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* 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:
*
*
{@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);
* }
* }
*
* @param request The request object containing all of the parameters for the API call.
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
public final Posture getPosture(GetPostureRequest request) {
return getPostureCallable().call(request);
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* 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:
*
*
{@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 future = securityPostureClient.getPostureCallable().futureCall(request);
* // Do something.
* Posture response = future.get();
* }
* }
*/
public final UnaryCallable getPostureCallable() {
return stub.getPostureCallable();
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* 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:
*
*
{@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();
* }
* }
*
* @param parent Required. Value for parent.
* @param posture Required. The resource being created.
* @param postureId Required. User provided identifier. It should be unique in scope of an
* Organization and location.
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
public final OperationFuture createPostureAsync(
OrganizationName parent, Posture posture, String postureId) {
CreatePostureRequest request =
CreatePostureRequest.newBuilder()
.setParent(parent == null ? null : parent.toString())
.setPosture(posture)
.setPostureId(postureId)
.build();
return createPostureAsync(request);
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* 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:
*
*
{@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();
* }
* }
*
* @param parent Required. Value for parent.
* @param posture Required. The resource being created.
* @param postureId Required. User provided identifier. It should be unique in scope of an
* Organization and location.
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
public final OperationFuture createPostureAsync(
String parent, Posture posture, String postureId) {
CreatePostureRequest request =
CreatePostureRequest.newBuilder()
.setParent(parent)
.setPosture(posture)
.setPostureId(postureId)
.build();
return createPostureAsync(request);
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* 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:
*
*
{@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();
* }
* }
*
* @param request The request object containing all of the parameters for the API call.
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
public final OperationFuture createPostureAsync(
CreatePostureRequest request) {
return createPostureOperationCallable().futureCall(request);
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* 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:
*
*
{@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 future =
* securityPostureClient.createPostureOperationCallable().futureCall(request);
* // Do something.
* Posture response = future.get();
* }
* }
*/
public final OperationCallable
createPostureOperationCallable() {
return stub.createPostureOperationCallable();
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* 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:
*
*
{@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 future =
* securityPostureClient.createPostureCallable().futureCall(request);
* // Do something.
* Operation response = future.get();
* }
* }
*/
public final UnaryCallable createPostureCallable() {
return stub.createPostureCallable();
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* 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:
*
*
{@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();
* }
* }
*
* @param posture Required. The resource being updated.
* @param 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 com.google.api.gax.rpc.ApiException if the remote call fails
*/
public final OperationFuture updatePostureAsync(
Posture posture, FieldMask updateMask) {
UpdatePostureRequest request =
UpdatePostureRequest.newBuilder().setPosture(posture).setUpdateMask(updateMask).build();
return updatePostureAsync(request);
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* 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:
*
*
{@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();
* }
* }
*
* @param request The request object containing all of the parameters for the API call.
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
public final OperationFuture updatePostureAsync(
UpdatePostureRequest request) {
return updatePostureOperationCallable().futureCall(request);
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* 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:
*
*
{@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 future =
* securityPostureClient.updatePostureOperationCallable().futureCall(request);
* // Do something.
* Posture response = future.get();
* }
* }
*/
public final OperationCallable
updatePostureOperationCallable() {
return stub.updatePostureOperationCallable();
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* 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:
*
*
{@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 future =
* securityPostureClient.updatePostureCallable().futureCall(request);
* // Do something.
* Operation response = future.get();
* }
* }
*/
public final UnaryCallable updatePostureCallable() {
return stub.updatePostureCallable();
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* 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:
*
*
{@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();
* }
* }
*
* @param name Required. Name of the resource.
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
public final OperationFuture deletePostureAsync(PostureName name) {
DeletePostureRequest request =
DeletePostureRequest.newBuilder().setName(name == null ? null : name.toString()).build();
return deletePostureAsync(request);
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* 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:
*
*
{@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();
* }
* }
*
* @param name Required. Name of the resource.
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
public final OperationFuture deletePostureAsync(String name) {
DeletePostureRequest request = DeletePostureRequest.newBuilder().setName(name).build();
return deletePostureAsync(request);
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* 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:
*
*
{@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();
* }
* }
*
* @param request The request object containing all of the parameters for the API call.
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
public final OperationFuture deletePostureAsync(
DeletePostureRequest request) {
return deletePostureOperationCallable().futureCall(request);
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* 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:
*
*
{@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 future =
* securityPostureClient.deletePostureOperationCallable().futureCall(request);
* // Do something.
* future.get();
* }
* }
*/
public final OperationCallable
deletePostureOperationCallable() {
return stub.deletePostureOperationCallable();
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* 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:
*
*
{@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 future =
* securityPostureClient.deletePostureCallable().futureCall(request);
* // Do something.
* future.get();
* }
* }
*/
public final UnaryCallable deletePostureCallable() {
return stub.deletePostureCallable();
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* 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:
*
*
{@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();
* }
* }
*
* @param parent Required. The parent resource name. The format of this value is as follows:
* `organizations/{organization}/locations/{location}`
* @param postureId Required. User provided identifier. It should be unique in scope of an
* Organization and location.
* @param 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 com.google.api.gax.rpc.ApiException if the remote call fails
*/
public final OperationFuture extractPostureAsync(
OrganizationName parent, String postureId, String workload) {
ExtractPostureRequest request =
ExtractPostureRequest.newBuilder()
.setParent(parent == null ? null : parent.toString())
.setPostureId(postureId)
.setWorkload(workload)
.build();
return extractPostureAsync(request);
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* 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:
*
*
{@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();
* }
* }
*
* @param parent Required. The parent resource name. The format of this value is as follows:
* `organizations/{organization}/locations/{location}`
* @param postureId Required. User provided identifier. It should be unique in scope of an
* Organization and location.
* @param 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 com.google.api.gax.rpc.ApiException if the remote call fails
*/
public final OperationFuture extractPostureAsync(
String parent, String postureId, String workload) {
ExtractPostureRequest request =
ExtractPostureRequest.newBuilder()
.setParent(parent)
.setPostureId(postureId)
.setWorkload(workload)
.build();
return extractPostureAsync(request);
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* 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:
*
*
{@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();
* }
* }
*
* @param request The request object containing all of the parameters for the API call.
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
public final OperationFuture extractPostureAsync(
ExtractPostureRequest request) {
return extractPostureOperationCallable().futureCall(request);
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* 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:
*
*
{@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 future =
* securityPostureClient.extractPostureOperationCallable().futureCall(request);
* // Do something.
* Posture response = future.get();
* }
* }
*/
public final OperationCallable
extractPostureOperationCallable() {
return stub.extractPostureOperationCallable();
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* 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:
*
*
{@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 future =
* securityPostureClient.extractPostureCallable().futureCall(request);
* // Do something.
* Operation response = future.get();
* }
* }
*/
public final UnaryCallable extractPostureCallable() {
return stub.extractPostureCallable();
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* PostureDeployments Lists PostureDeployments in a given project and location.
*
* Sample code:
*
*
{@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);
* }
* }
* }
*
* @param parent Required. Parent value for ListPostureDeploymentsRequest.
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
public final ListPostureDeploymentsPagedResponse listPostureDeployments(OrganizationName parent) {
ListPostureDeploymentsRequest request =
ListPostureDeploymentsRequest.newBuilder()
.setParent(parent == null ? null : parent.toString())
.build();
return listPostureDeployments(request);
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* PostureDeployments Lists PostureDeployments in a given project and location.
*
* Sample code:
*
*
{@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);
* }
* }
* }
*
* @param parent Required. Parent value for ListPostureDeploymentsRequest.
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
public final ListPostureDeploymentsPagedResponse listPostureDeployments(String parent) {
ListPostureDeploymentsRequest request =
ListPostureDeploymentsRequest.newBuilder().setParent(parent).build();
return listPostureDeployments(request);
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* PostureDeployments Lists PostureDeployments in a given project and location.
*
* Sample code:
*
*
{@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);
* }
* }
* }
*
* @param request The request object containing all of the parameters for the API call.
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
public final ListPostureDeploymentsPagedResponse listPostureDeployments(
ListPostureDeploymentsRequest request) {
return listPostureDeploymentsPagedCallable().call(request);
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* PostureDeployments Lists PostureDeployments in a given project and location.
*
* Sample code:
*
*
{@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 future =
* securityPostureClient.listPostureDeploymentsPagedCallable().futureCall(request);
* // Do something.
* for (PostureDeployment element : future.get().iterateAll()) {
* // doThingsWith(element);
* }
* }
* }
*/
public final UnaryCallable
listPostureDeploymentsPagedCallable() {
return stub.listPostureDeploymentsPagedCallable();
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* PostureDeployments Lists PostureDeployments in a given project and location.
*
* Sample code:
*
*
{@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;
* }
* }
* }
* }
*/
public final UnaryCallable
listPostureDeploymentsCallable() {
return stub.listPostureDeploymentsCallable();
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Gets details of a single PostureDeployment.
*
* Sample code:
*
*
{@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);
* }
* }
*
* @param name Required. Name of the resource.
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
public final PostureDeployment getPostureDeployment(PostureDeploymentName name) {
GetPostureDeploymentRequest request =
GetPostureDeploymentRequest.newBuilder()
.setName(name == null ? null : name.toString())
.build();
return getPostureDeployment(request);
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Gets details of a single PostureDeployment.
*
* Sample code:
*
*
{@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);
* }
* }
*
* @param name Required. Name of the resource.
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
public final PostureDeployment getPostureDeployment(String name) {
GetPostureDeploymentRequest request =
GetPostureDeploymentRequest.newBuilder().setName(name).build();
return getPostureDeployment(request);
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Gets details of a single PostureDeployment.
*
* Sample code:
*
*
{@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);
* }
* }
*
* @param request The request object containing all of the parameters for the API call.
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
public final PostureDeployment getPostureDeployment(GetPostureDeploymentRequest request) {
return getPostureDeploymentCallable().call(request);
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Gets details of a single PostureDeployment.
*
* Sample code:
*
*
{@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 future =
* securityPostureClient.getPostureDeploymentCallable().futureCall(request);
* // Do something.
* PostureDeployment response = future.get();
* }
* }
*/
public final UnaryCallable
getPostureDeploymentCallable() {
return stub.getPostureDeploymentCallable();
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Creates a new PostureDeployment in a given project and location.
*
* Sample code:
*
*
{@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();
* }
* }
*
* @param parent Required. Value for parent. Format: organizations/{org_id}/locations/{location}
* @param postureDeployment Required. The resource being created.
* @param postureDeploymentId Required. User provided identifier. It should be unique in scope of
* an Organization and location.
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
public final OperationFuture createPostureDeploymentAsync(
OrganizationName parent, PostureDeployment postureDeployment, String postureDeploymentId) {
CreatePostureDeploymentRequest request =
CreatePostureDeploymentRequest.newBuilder()
.setParent(parent == null ? null : parent.toString())
.setPostureDeployment(postureDeployment)
.setPostureDeploymentId(postureDeploymentId)
.build();
return createPostureDeploymentAsync(request);
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Creates a new PostureDeployment in a given project and location.
*
* Sample code:
*
*
{@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();
* }
* }
*
* @param parent Required. Value for parent. Format: organizations/{org_id}/locations/{location}
* @param postureDeployment Required. The resource being created.
* @param postureDeploymentId Required. User provided identifier. It should be unique in scope of
* an Organization and location.
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
public final OperationFuture createPostureDeploymentAsync(
String parent, PostureDeployment postureDeployment, String postureDeploymentId) {
CreatePostureDeploymentRequest request =
CreatePostureDeploymentRequest.newBuilder()
.setParent(parent)
.setPostureDeployment(postureDeployment)
.setPostureDeploymentId(postureDeploymentId)
.build();
return createPostureDeploymentAsync(request);
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Creates a new PostureDeployment in a given project and location.
*
* Sample code:
*
*
{@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();
* }
* }
*
* @param request The request object containing all of the parameters for the API call.
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
public final OperationFuture createPostureDeploymentAsync(
CreatePostureDeploymentRequest request) {
return createPostureDeploymentOperationCallable().futureCall(request);
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Creates a new PostureDeployment in a given project and location.
*
* Sample code:
*
*
{@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 future =
* securityPostureClient.createPostureDeploymentOperationCallable().futureCall(request);
* // Do something.
* PostureDeployment response = future.get();
* }
* }
*/
public final OperationCallable<
CreatePostureDeploymentRequest, PostureDeployment, OperationMetadata>
createPostureDeploymentOperationCallable() {
return stub.createPostureDeploymentOperationCallable();
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Creates a new PostureDeployment in a given project and location.
*
* Sample code:
*
*
{@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 future =
* securityPostureClient.createPostureDeploymentCallable().futureCall(request);
* // Do something.
* Operation response = future.get();
* }
* }
*/
public final UnaryCallable
createPostureDeploymentCallable() {
return stub.createPostureDeploymentCallable();
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Updates the parameters of a single PostureDeployment.
*
* Sample code:
*
*
{@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();
* }
* }
*
* @param postureDeployment Required. The resource being updated.
* @param 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 com.google.api.gax.rpc.ApiException if the remote call fails
*/
public final OperationFuture updatePostureDeploymentAsync(
PostureDeployment postureDeployment, FieldMask updateMask) {
UpdatePostureDeploymentRequest request =
UpdatePostureDeploymentRequest.newBuilder()
.setPostureDeployment(postureDeployment)
.setUpdateMask(updateMask)
.build();
return updatePostureDeploymentAsync(request);
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Updates the parameters of a single PostureDeployment.
*
* Sample code:
*
*
{@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();
* }
* }
*
* @param request The request object containing all of the parameters for the API call.
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
public final OperationFuture updatePostureDeploymentAsync(
UpdatePostureDeploymentRequest request) {
return updatePostureDeploymentOperationCallable().futureCall(request);
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Updates the parameters of a single PostureDeployment.
*
* Sample code:
*
*
{@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 future =
* securityPostureClient.updatePostureDeploymentOperationCallable().futureCall(request);
* // Do something.
* PostureDeployment response = future.get();
* }
* }
*/
public final OperationCallable<
UpdatePostureDeploymentRequest, PostureDeployment, OperationMetadata>
updatePostureDeploymentOperationCallable() {
return stub.updatePostureDeploymentOperationCallable();
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Updates the parameters of a single PostureDeployment.
*
* Sample code:
*
*
{@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 future =
* securityPostureClient.updatePostureDeploymentCallable().futureCall(request);
* // Do something.
* Operation response = future.get();
* }
* }
*/
public final UnaryCallable
updatePostureDeploymentCallable() {
return stub.updatePostureDeploymentCallable();
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Deletes a single PostureDeployment.
*
* Sample code:
*
*
{@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();
* }
* }
*
* @param name Required. Name of the resource.
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
public final OperationFuture deletePostureDeploymentAsync(
PostureDeploymentName name) {
DeletePostureDeploymentRequest request =
DeletePostureDeploymentRequest.newBuilder()
.setName(name == null ? null : name.toString())
.build();
return deletePostureDeploymentAsync(request);
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Deletes a single PostureDeployment.
*
* Sample code:
*
*
{@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();
* }
* }
*
* @param name Required. Name of the resource.
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
public final OperationFuture deletePostureDeploymentAsync(String name) {
DeletePostureDeploymentRequest request =
DeletePostureDeploymentRequest.newBuilder().setName(name).build();
return deletePostureDeploymentAsync(request);
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Deletes a single PostureDeployment.
*
* Sample code:
*
*
{@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();
* }
* }
*
* @param request The request object containing all of the parameters for the API call.
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
public final OperationFuture deletePostureDeploymentAsync(
DeletePostureDeploymentRequest request) {
return deletePostureDeploymentOperationCallable().futureCall(request);
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Deletes a single PostureDeployment.
*
* Sample code:
*
*
{@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 future =
* securityPostureClient.deletePostureDeploymentOperationCallable().futureCall(request);
* // Do something.
* future.get();
* }
* }
*/
public final OperationCallable
deletePostureDeploymentOperationCallable() {
return stub.deletePostureDeploymentOperationCallable();
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Deletes a single PostureDeployment.
*
* Sample code:
*
*
{@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 future =
* securityPostureClient.deletePostureDeploymentCallable().futureCall(request);
* // Do something.
* future.get();
* }
* }
*/
public final UnaryCallable
deletePostureDeploymentCallable() {
return stub.deletePostureDeploymentCallable();
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* PostureTemplates Lists all the PostureTemplates available to the user.
*
* Sample code:
*
*
{@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);
* }
* }
* }
*
* @param parent Required. Parent value for ListPostureTemplatesRequest.
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
public final ListPostureTemplatesPagedResponse listPostureTemplates(OrganizationName parent) {
ListPostureTemplatesRequest request =
ListPostureTemplatesRequest.newBuilder()
.setParent(parent == null ? null : parent.toString())
.build();
return listPostureTemplates(request);
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* PostureTemplates Lists all the PostureTemplates available to the user.
*
* Sample code:
*
*
{@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);
* }
* }
* }
*
* @param parent Required. Parent value for ListPostureTemplatesRequest.
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
public final ListPostureTemplatesPagedResponse listPostureTemplates(String parent) {
ListPostureTemplatesRequest request =
ListPostureTemplatesRequest.newBuilder().setParent(parent).build();
return listPostureTemplates(request);
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* PostureTemplates Lists all the PostureTemplates available to the user.
*
* Sample code:
*
*
{@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);
* }
* }
* }
*
* @param request The request object containing all of the parameters for the API call.
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
public final ListPostureTemplatesPagedResponse listPostureTemplates(
ListPostureTemplatesRequest request) {
return listPostureTemplatesPagedCallable().call(request);
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* PostureTemplates Lists all the PostureTemplates available to the user.
*
* Sample code:
*
*
{@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 future =
* securityPostureClient.listPostureTemplatesPagedCallable().futureCall(request);
* // Do something.
* for (PostureTemplate element : future.get().iterateAll()) {
* // doThingsWith(element);
* }
* }
* }
*/
public final UnaryCallable
listPostureTemplatesPagedCallable() {
return stub.listPostureTemplatesPagedCallable();
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* PostureTemplates Lists all the PostureTemplates available to the user.
*
* Sample code:
*
*
{@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;
* }
* }
* }
* }
*/
public final UnaryCallable
listPostureTemplatesCallable() {
return stub.listPostureTemplatesCallable();
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* 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:
*
*
{@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);
* }
* }
*
* @param name Required. Name of the resource.
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
public final PostureTemplate getPostureTemplate(PostureTemplateName name) {
GetPostureTemplateRequest request =
GetPostureTemplateRequest.newBuilder()
.setName(name == null ? null : name.toString())
.build();
return getPostureTemplate(request);
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* 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:
*
*
{@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);
* }
* }
*
* @param name Required. Name of the resource.
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
public final PostureTemplate getPostureTemplate(String name) {
GetPostureTemplateRequest request =
GetPostureTemplateRequest.newBuilder().setName(name).build();
return getPostureTemplate(request);
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* 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:
*
*
{@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);
* }
* }
*
* @param request The request object containing all of the parameters for the API call.
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
public final PostureTemplate getPostureTemplate(GetPostureTemplateRequest request) {
return getPostureTemplateCallable().call(request);
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* 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:
*
*
{@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 future =
* securityPostureClient.getPostureTemplateCallable().futureCall(request);
* // Do something.
* PostureTemplate response = future.get();
* }
* }
*/
public final UnaryCallable
getPostureTemplateCallable() {
return stub.getPostureTemplateCallable();
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Lists information about the supported locations for this service.
*
* Sample code:
*
*
{@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);
* }
* }
* }
*
* @param request The request object containing all of the parameters for the API call.
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
public final ListLocationsPagedResponse listLocations(ListLocationsRequest request) {
return listLocationsPagedCallable().call(request);
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Lists information about the supported locations for this service.
*
* Sample code:
*
*
{@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 future =
* securityPostureClient.listLocationsPagedCallable().futureCall(request);
* // Do something.
* for (Location element : future.get().iterateAll()) {
* // doThingsWith(element);
* }
* }
* }
*/
public final UnaryCallable
listLocationsPagedCallable() {
return stub.listLocationsPagedCallable();
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Lists information about the supported locations for this service.
*
* Sample code:
*
*
{@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;
* }
* }
* }
* }
*/
public final UnaryCallable listLocationsCallable() {
return stub.listLocationsCallable();
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Gets information about a location.
*
* Sample code:
*
*
{@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);
* }
* }
*
* @param request The request object containing all of the parameters for the API call.
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
public final Location getLocation(GetLocationRequest request) {
return getLocationCallable().call(request);
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Gets information about a location.
*
* Sample code:
*
*
{@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 future = securityPostureClient.getLocationCallable().futureCall(request);
* // Do something.
* Location response = future.get();
* }
* }
*/
public final UnaryCallable getLocationCallable() {
return stub.getLocationCallable();
}
@Override
public final void close() {
stub.close();
}
@Override
public void shutdown() {
stub.shutdown();
}
@Override
public boolean isShutdown() {
return stub.isShutdown();
}
@Override
public boolean isTerminated() {
return stub.isTerminated();
}
@Override
public void shutdownNow() {
stub.shutdownNow();
}
@Override
public boolean awaitTermination(long duration, TimeUnit unit) throws InterruptedException {
return stub.awaitTermination(duration, unit);
}
public static class ListPosturesPagedResponse
extends AbstractPagedListResponse<
ListPosturesRequest,
ListPosturesResponse,
Posture,
ListPosturesPage,
ListPosturesFixedSizeCollection> {
public static ApiFuture createAsync(
PageContext context,
ApiFuture futureResponse) {
ApiFuture futurePage =
ListPosturesPage.createEmptyPage().createPageAsync(context, futureResponse);
return ApiFutures.transform(
futurePage,
input -> new ListPosturesPagedResponse(input),
MoreExecutors.directExecutor());
}
private ListPosturesPagedResponse(ListPosturesPage page) {
super(page, ListPosturesFixedSizeCollection.createEmptyCollection());
}
}
public static class ListPosturesPage
extends AbstractPage {
private ListPosturesPage(
PageContext context,
ListPosturesResponse response) {
super(context, response);
}
private static ListPosturesPage createEmptyPage() {
return new ListPosturesPage(null, null);
}
@Override
protected ListPosturesPage createPage(
PageContext context,
ListPosturesResponse response) {
return new ListPosturesPage(context, response);
}
@Override
public ApiFuture createPageAsync(
PageContext context,
ApiFuture futureResponse) {
return super.createPageAsync(context, futureResponse);
}
}
public static class ListPosturesFixedSizeCollection
extends AbstractFixedSizeCollection<
ListPosturesRequest,
ListPosturesResponse,
Posture,
ListPosturesPage,
ListPosturesFixedSizeCollection> {
private ListPosturesFixedSizeCollection(List pages, int collectionSize) {
super(pages, collectionSize);
}
private static ListPosturesFixedSizeCollection createEmptyCollection() {
return new ListPosturesFixedSizeCollection(null, 0);
}
@Override
protected ListPosturesFixedSizeCollection createCollection(
List pages, int collectionSize) {
return new ListPosturesFixedSizeCollection(pages, collectionSize);
}
}
public static class ListPostureRevisionsPagedResponse
extends AbstractPagedListResponse<
ListPostureRevisionsRequest,
ListPostureRevisionsResponse,
Posture,
ListPostureRevisionsPage,
ListPostureRevisionsFixedSizeCollection> {
public static ApiFuture createAsync(
PageContext context,
ApiFuture futureResponse) {
ApiFuture futurePage =
ListPostureRevisionsPage.createEmptyPage().createPageAsync(context, futureResponse);
return ApiFutures.transform(
futurePage,
input -> new ListPostureRevisionsPagedResponse(input),
MoreExecutors.directExecutor());
}
private ListPostureRevisionsPagedResponse(ListPostureRevisionsPage page) {
super(page, ListPostureRevisionsFixedSizeCollection.createEmptyCollection());
}
}
public static class ListPostureRevisionsPage
extends AbstractPage<
ListPostureRevisionsRequest,
ListPostureRevisionsResponse,
Posture,
ListPostureRevisionsPage> {
private ListPostureRevisionsPage(
PageContext context,
ListPostureRevisionsResponse response) {
super(context, response);
}
private static ListPostureRevisionsPage createEmptyPage() {
return new ListPostureRevisionsPage(null, null);
}
@Override
protected ListPostureRevisionsPage createPage(
PageContext context,
ListPostureRevisionsResponse response) {
return new ListPostureRevisionsPage(context, response);
}
@Override
public ApiFuture createPageAsync(
PageContext context,
ApiFuture futureResponse) {
return super.createPageAsync(context, futureResponse);
}
}
public static class ListPostureRevisionsFixedSizeCollection
extends AbstractFixedSizeCollection<
ListPostureRevisionsRequest,
ListPostureRevisionsResponse,
Posture,
ListPostureRevisionsPage,
ListPostureRevisionsFixedSizeCollection> {
private ListPostureRevisionsFixedSizeCollection(
List pages, int collectionSize) {
super(pages, collectionSize);
}
private static ListPostureRevisionsFixedSizeCollection createEmptyCollection() {
return new ListPostureRevisionsFixedSizeCollection(null, 0);
}
@Override
protected ListPostureRevisionsFixedSizeCollection createCollection(
List pages, int collectionSize) {
return new ListPostureRevisionsFixedSizeCollection(pages, collectionSize);
}
}
public static class ListPostureDeploymentsPagedResponse
extends AbstractPagedListResponse<
ListPostureDeploymentsRequest,
ListPostureDeploymentsResponse,
PostureDeployment,
ListPostureDeploymentsPage,
ListPostureDeploymentsFixedSizeCollection> {
public static ApiFuture createAsync(
PageContext<
ListPostureDeploymentsRequest, ListPostureDeploymentsResponse, PostureDeployment>
context,
ApiFuture futureResponse) {
ApiFuture futurePage =
ListPostureDeploymentsPage.createEmptyPage().createPageAsync(context, futureResponse);
return ApiFutures.transform(
futurePage,
input -> new ListPostureDeploymentsPagedResponse(input),
MoreExecutors.directExecutor());
}
private ListPostureDeploymentsPagedResponse(ListPostureDeploymentsPage page) {
super(page, ListPostureDeploymentsFixedSizeCollection.createEmptyCollection());
}
}
public static class ListPostureDeploymentsPage
extends AbstractPage<
ListPostureDeploymentsRequest,
ListPostureDeploymentsResponse,
PostureDeployment,
ListPostureDeploymentsPage> {
private ListPostureDeploymentsPage(
PageContext<
ListPostureDeploymentsRequest, ListPostureDeploymentsResponse, PostureDeployment>
context,
ListPostureDeploymentsResponse response) {
super(context, response);
}
private static ListPostureDeploymentsPage createEmptyPage() {
return new ListPostureDeploymentsPage(null, null);
}
@Override
protected ListPostureDeploymentsPage createPage(
PageContext<
ListPostureDeploymentsRequest, ListPostureDeploymentsResponse, PostureDeployment>
context,
ListPostureDeploymentsResponse response) {
return new ListPostureDeploymentsPage(context, response);
}
@Override
public ApiFuture createPageAsync(
PageContext<
ListPostureDeploymentsRequest, ListPostureDeploymentsResponse, PostureDeployment>
context,
ApiFuture futureResponse) {
return super.createPageAsync(context, futureResponse);
}
}
public static class ListPostureDeploymentsFixedSizeCollection
extends AbstractFixedSizeCollection<
ListPostureDeploymentsRequest,
ListPostureDeploymentsResponse,
PostureDeployment,
ListPostureDeploymentsPage,
ListPostureDeploymentsFixedSizeCollection> {
private ListPostureDeploymentsFixedSizeCollection(
List pages, int collectionSize) {
super(pages, collectionSize);
}
private static ListPostureDeploymentsFixedSizeCollection createEmptyCollection() {
return new ListPostureDeploymentsFixedSizeCollection(null, 0);
}
@Override
protected ListPostureDeploymentsFixedSizeCollection createCollection(
List pages, int collectionSize) {
return new ListPostureDeploymentsFixedSizeCollection(pages, collectionSize);
}
}
public static class ListPostureTemplatesPagedResponse
extends AbstractPagedListResponse<
ListPostureTemplatesRequest,
ListPostureTemplatesResponse,
PostureTemplate,
ListPostureTemplatesPage,
ListPostureTemplatesFixedSizeCollection> {
public static ApiFuture createAsync(
PageContext
context,
ApiFuture futureResponse) {
ApiFuture futurePage =
ListPostureTemplatesPage.createEmptyPage().createPageAsync(context, futureResponse);
return ApiFutures.transform(
futurePage,
input -> new ListPostureTemplatesPagedResponse(input),
MoreExecutors.directExecutor());
}
private ListPostureTemplatesPagedResponse(ListPostureTemplatesPage page) {
super(page, ListPostureTemplatesFixedSizeCollection.createEmptyCollection());
}
}
public static class ListPostureTemplatesPage
extends AbstractPage<
ListPostureTemplatesRequest,
ListPostureTemplatesResponse,
PostureTemplate,
ListPostureTemplatesPage> {
private ListPostureTemplatesPage(
PageContext
context,
ListPostureTemplatesResponse response) {
super(context, response);
}
private static ListPostureTemplatesPage createEmptyPage() {
return new ListPostureTemplatesPage(null, null);
}
@Override
protected ListPostureTemplatesPage createPage(
PageContext
context,
ListPostureTemplatesResponse response) {
return new ListPostureTemplatesPage(context, response);
}
@Override
public ApiFuture createPageAsync(
PageContext
context,
ApiFuture futureResponse) {
return super.createPageAsync(context, futureResponse);
}
}
public static class ListPostureTemplatesFixedSizeCollection
extends AbstractFixedSizeCollection<
ListPostureTemplatesRequest,
ListPostureTemplatesResponse,
PostureTemplate,
ListPostureTemplatesPage,
ListPostureTemplatesFixedSizeCollection> {
private ListPostureTemplatesFixedSizeCollection(
List pages, int collectionSize) {
super(pages, collectionSize);
}
private static ListPostureTemplatesFixedSizeCollection createEmptyCollection() {
return new ListPostureTemplatesFixedSizeCollection(null, 0);
}
@Override
protected ListPostureTemplatesFixedSizeCollection createCollection(
List pages, int collectionSize) {
return new ListPostureTemplatesFixedSizeCollection(pages, collectionSize);
}
}
public static class ListLocationsPagedResponse
extends AbstractPagedListResponse<
ListLocationsRequest,
ListLocationsResponse,
Location,
ListLocationsPage,
ListLocationsFixedSizeCollection> {
public static ApiFuture createAsync(
PageContext context,
ApiFuture futureResponse) {
ApiFuture futurePage =
ListLocationsPage.createEmptyPage().createPageAsync(context, futureResponse);
return ApiFutures.transform(
futurePage,
input -> new ListLocationsPagedResponse(input),
MoreExecutors.directExecutor());
}
private ListLocationsPagedResponse(ListLocationsPage page) {
super(page, ListLocationsFixedSizeCollection.createEmptyCollection());
}
}
public static class ListLocationsPage
extends AbstractPage<
ListLocationsRequest, ListLocationsResponse, Location, ListLocationsPage> {
private ListLocationsPage(
PageContext context,
ListLocationsResponse response) {
super(context, response);
}
private static ListLocationsPage createEmptyPage() {
return new ListLocationsPage(null, null);
}
@Override
protected ListLocationsPage createPage(
PageContext context,
ListLocationsResponse response) {
return new ListLocationsPage(context, response);
}
@Override
public ApiFuture createPageAsync(
PageContext context,
ApiFuture futureResponse) {
return super.createPageAsync(context, futureResponse);
}
}
public static class ListLocationsFixedSizeCollection
extends AbstractFixedSizeCollection<
ListLocationsRequest,
ListLocationsResponse,
Location,
ListLocationsPage,
ListLocationsFixedSizeCollection> {
private ListLocationsFixedSizeCollection(List pages, int collectionSize) {
super(pages, collectionSize);
}
private static ListLocationsFixedSizeCollection createEmptyCollection() {
return new ListLocationsFixedSizeCollection(null, 0);
}
@Override
protected ListLocationsFixedSizeCollection createCollection(
List pages, int collectionSize) {
return new ListLocationsFixedSizeCollection(pages, collectionSize);
}
}
}