com.google.cloud.securitycenter.settings.v1beta1.SecurityCenterSettingsServiceClient Maven / Gradle / Ivy
/*
* 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.securitycenter.settings.v1beta1;
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.paging.AbstractFixedSizeCollection;
import com.google.api.gax.paging.AbstractPage;
import com.google.api.gax.paging.AbstractPagedListResponse;
import com.google.api.gax.rpc.PageContext;
import com.google.api.gax.rpc.UnaryCallable;
import com.google.cloud.securitycenter.settings.v1beta1.stub.SecurityCenterSettingsServiceStub;
import com.google.cloud.securitycenter.settings.v1beta1.stub.SecurityCenterSettingsServiceStubSettings;
import com.google.common.util.concurrent.MoreExecutors;
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: ## API Overview
*
* The SecurityCenterSettingsService is a sub-api of `securitycenter.googleapis.com`. The service
* provides methods to manage Security Center Settings, and Component Settings for GCP
* organizations, folders, projects, and clusters.
*
*
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 (SecurityCenterSettingsServiceClient securityCenterSettingsServiceClient =
* SecurityCenterSettingsServiceClient.create()) {
* ServiceAccountName name = ServiceAccountName.of("[ORGANIZATION]");
* ServiceAccount response = securityCenterSettingsServiceClient.getServiceAccount(name);
* }
* }
*
* Note: close() needs to be called on the SecurityCenterSettingsServiceClient 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
*
*
* GetServiceAccount
* Retrieves the organizations service account, if it exists, otherwise it creates the organization service account. This API is idempotent and will only create a service account once. On subsequent calls it will return the previously created service account. SHA, SCC and CTD Infra Automation will use this SA. This SA will not have any permissions when created. The UI will provision this via IAM or the user will using their own internal process. This API only creates SAs on the organization. Folders are not supported and projects will use per-project SAs associated with APIs enabled on a project. This API will be called by the UX onboarding workflow.
*
* Request object method variants only take one parameter, a request object, which must be constructed before the call.
*
* getServiceAccount(GetServiceAccountRequest request)
*
* "Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.
*
* getServiceAccount(ServiceAccountName name)
*
getServiceAccount(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.
*
* getServiceAccountCallable()
*
*
*
*
* GetSettings
* Gets the Settings.
*
* Request object method variants only take one parameter, a request object, which must be constructed before the call.
*
* getSettings(GetSettingsRequest request)
*
* "Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.
*
* getSettings(SettingsName name)
*
getSettings(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.
*
* getSettingsCallable()
*
*
*
*
* UpdateSettings
* Updates the Settings.
*
* Request object method variants only take one parameter, a request object, which must be constructed before the call.
*
* updateSettings(UpdateSettingsRequest request)
*
* "Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.
*
* updateSettings(Settings settings, 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.
*
* updateSettingsCallable()
*
*
*
*
* ResetSettings
* Reset the organization, folder or project's settings and return the settings of just that resource to the default.
*
Settings are present at the organization, folder, project, and cluster levels. Using Reset on a sub-organization level will remove that resource's override and result in the parent's settings being used (eg: if Reset on a cluster, project settings will be used).
*
Using Reset on organization will remove the override that was set and result in default settings being used.
*
* Request object method variants only take one parameter, a request object, which must be constructed before the call.
*
* resetSettings(ResetSettingsRequest request)
*
* Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
*
* resetSettingsCallable()
*
*
*
*
* BatchGetSettings
* Gets a list of settings.
*
* Request object method variants only take one parameter, a request object, which must be constructed before the call.
*
* batchGetSettings(BatchGetSettingsRequest request)
*
* Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
*
* batchGetSettingsCallable()
*
*
*
*
* CalculateEffectiveSettings
* CalculateEffectiveSettings looks up all of the Security Center Settings resources in the GCP resource hierarchy, and calculates the effective settings on that resource by applying the following rules: * Settings provided closer to the target resource take precedence over those further away (e.g. folder will override organization level settings). * Product defaults can be overridden at org, folder, project, and cluster levels. * Detectors will be filtered out if they belong to a billing tier the customer has not configured.
*
* Request object method variants only take one parameter, a request object, which must be constructed before the call.
*
* calculateEffectiveSettings(CalculateEffectiveSettingsRequest request)
*
* "Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.
*
* calculateEffectiveSettings(SettingsName name)
*
calculateEffectiveSettings(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.
*
* calculateEffectiveSettingsCallable()
*
*
*
*
* BatchCalculateEffectiveSettings
* Gets a list of effective settings.
*
* Request object method variants only take one parameter, a request object, which must be constructed before the call.
*
* batchCalculateEffectiveSettings(BatchCalculateEffectiveSettingsRequest request)
*
* Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
*
* batchCalculateEffectiveSettingsCallable()
*
*
*
*
* GetComponentSettings
* Gets the Component Settings.
*
* Request object method variants only take one parameter, a request object, which must be constructed before the call.
*
* getComponentSettings(GetComponentSettingsRequest request)
*
* "Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.
*
* getComponentSettings(ComponentSettingsName name)
*
getComponentSettings(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.
*
* getComponentSettingsCallable()
*
*
*
*
* UpdateComponentSettings
* Updates the Component Settings.
*
* Request object method variants only take one parameter, a request object, which must be constructed before the call.
*
* updateComponentSettings(UpdateComponentSettingsRequest request)
*
* "Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.
*
* updateComponentSettings(ComponentSettings componentSettings, 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.
*
* updateComponentSettingsCallable()
*
*
*
*
* ResetComponentSettings
* Reset the organization, folder or project's component settings and return the settings to the default. Settings are present at the organization, folder and project levels. Using Reset for a folder or project will remove the override that was set and result in the organization-level settings being used.
*
* Request object method variants only take one parameter, a request object, which must be constructed before the call.
*
* resetComponentSettings(ResetComponentSettingsRequest request)
*
* Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
*
* resetComponentSettingsCallable()
*
*
*
*
* CalculateEffectiveComponentSettings
* Gets the Effective Component Settings.
*
* Request object method variants only take one parameter, a request object, which must be constructed before the call.
*
* calculateEffectiveComponentSettings(CalculateEffectiveComponentSettingsRequest request)
*
* "Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.
*
* calculateEffectiveComponentSettings(ComponentSettingsName name)
*
calculateEffectiveComponentSettings(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.
*
* calculateEffectiveComponentSettingsCallable()
*
*
*
*
* ListDetectors
* Retrieves an unordered list of available detectors.
*
* Request object method variants only take one parameter, a request object, which must be constructed before the call.
*
* listDetectors(ListDetectorsRequest request)
*
* "Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.
*
* listDetectors(OrganizationName parent)
*
listDetectors(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.
*
* listDetectorsPagedCallable()
*
listDetectorsCallable()
*
*
*
*
* ListComponents
* Retrieves an unordered list of available SCC components.
*
* Request object method variants only take one parameter, a request object, which must be constructed before the call.
*
* listComponents(ListComponentsRequest request)
*
* "Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.
*
* listComponents(OrganizationName parent)
*
listComponents(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.
*
* listComponentsPagedCallable()
*
listComponentsCallable()
*
*
*
*
*
* 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
* SecurityCenterSettingsServiceSettings 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
* SecurityCenterSettingsServiceSettings securityCenterSettingsServiceSettings =
* SecurityCenterSettingsServiceSettings.newBuilder()
* .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
* .build();
* SecurityCenterSettingsServiceClient securityCenterSettingsServiceClient =
* SecurityCenterSettingsServiceClient.create(securityCenterSettingsServiceSettings);
* }
*
* 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
* SecurityCenterSettingsServiceSettings securityCenterSettingsServiceSettings =
* SecurityCenterSettingsServiceSettings.newBuilder().setEndpoint(myEndpoint).build();
* SecurityCenterSettingsServiceClient securityCenterSettingsServiceClient =
* SecurityCenterSettingsServiceClient.create(securityCenterSettingsServiceSettings);
* }
*
* Please refer to the GitHub repository's samples for more quickstart code snippets.
*/
@BetaApi
@Generated("by gapic-generator-java")
public class SecurityCenterSettingsServiceClient implements BackgroundResource {
private final SecurityCenterSettingsServiceSettings settings;
private final SecurityCenterSettingsServiceStub stub;
/** Constructs an instance of SecurityCenterSettingsServiceClient with default settings. */
public static final SecurityCenterSettingsServiceClient create() throws IOException {
return create(SecurityCenterSettingsServiceSettings.newBuilder().build());
}
/**
* Constructs an instance of SecurityCenterSettingsServiceClient, 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 SecurityCenterSettingsServiceClient create(
SecurityCenterSettingsServiceSettings settings) throws IOException {
return new SecurityCenterSettingsServiceClient(settings);
}
/**
* Constructs an instance of SecurityCenterSettingsServiceClient, using the given stub for making
* calls. This is for advanced usage - prefer using create(SecurityCenterSettingsServiceSettings).
*/
public static final SecurityCenterSettingsServiceClient create(
SecurityCenterSettingsServiceStub stub) {
return new SecurityCenterSettingsServiceClient(stub);
}
/**
* Constructs an instance of SecurityCenterSettingsServiceClient, 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 SecurityCenterSettingsServiceClient(SecurityCenterSettingsServiceSettings settings)
throws IOException {
this.settings = settings;
this.stub =
((SecurityCenterSettingsServiceStubSettings) settings.getStubSettings()).createStub();
}
protected SecurityCenterSettingsServiceClient(SecurityCenterSettingsServiceStub stub) {
this.settings = null;
this.stub = stub;
}
public final SecurityCenterSettingsServiceSettings getSettings() {
return settings;
}
public SecurityCenterSettingsServiceStub getStub() {
return stub;
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Retrieves the organizations service account, if it exists, otherwise it creates the
* organization service account. This API is idempotent and will only create a service account
* once. On subsequent calls it will return the previously created service account. SHA, SCC and
* CTD Infra Automation will use this SA. This SA will not have any permissions when created. The
* UI will provision this via IAM or the user will using their own internal process. This API only
* creates SAs on the organization. Folders are not supported and projects will use per-project
* SAs associated with APIs enabled on a project. This API will be called by the UX onboarding
* workflow.
*
*
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 (SecurityCenterSettingsServiceClient securityCenterSettingsServiceClient =
* SecurityCenterSettingsServiceClient.create()) {
* ServiceAccountName name = ServiceAccountName.of("[ORGANIZATION]");
* ServiceAccount response = securityCenterSettingsServiceClient.getServiceAccount(name);
* }
* }
*
* @param name Required. The relative resource name of the service account resource. Format: *
* `organizations/{organization}/serviceAccount`
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
public final ServiceAccount getServiceAccount(ServiceAccountName name) {
GetServiceAccountRequest request =
GetServiceAccountRequest.newBuilder()
.setName(name == null ? null : name.toString())
.build();
return getServiceAccount(request);
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Retrieves the organizations service account, if it exists, otherwise it creates the
* organization service account. This API is idempotent and will only create a service account
* once. On subsequent calls it will return the previously created service account. SHA, SCC and
* CTD Infra Automation will use this SA. This SA will not have any permissions when created. The
* UI will provision this via IAM or the user will using their own internal process. This API only
* creates SAs on the organization. Folders are not supported and projects will use per-project
* SAs associated with APIs enabled on a project. This API will be called by the UX onboarding
* workflow.
*
* 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 (SecurityCenterSettingsServiceClient securityCenterSettingsServiceClient =
* SecurityCenterSettingsServiceClient.create()) {
* String name = ServiceAccountName.of("[ORGANIZATION]").toString();
* ServiceAccount response = securityCenterSettingsServiceClient.getServiceAccount(name);
* }
* }
*
* @param name Required. The relative resource name of the service account resource. Format: *
* `organizations/{organization}/serviceAccount`
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
public final ServiceAccount getServiceAccount(String name) {
GetServiceAccountRequest request = GetServiceAccountRequest.newBuilder().setName(name).build();
return getServiceAccount(request);
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Retrieves the organizations service account, if it exists, otherwise it creates the
* organization service account. This API is idempotent and will only create a service account
* once. On subsequent calls it will return the previously created service account. SHA, SCC and
* CTD Infra Automation will use this SA. This SA will not have any permissions when created. The
* UI will provision this via IAM or the user will using their own internal process. This API only
* creates SAs on the organization. Folders are not supported and projects will use per-project
* SAs associated with APIs enabled on a project. This API will be called by the UX onboarding
* workflow.
*
* 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 (SecurityCenterSettingsServiceClient securityCenterSettingsServiceClient =
* SecurityCenterSettingsServiceClient.create()) {
* GetServiceAccountRequest request =
* GetServiceAccountRequest.newBuilder()
* .setName(ServiceAccountName.of("[ORGANIZATION]").toString())
* .build();
* ServiceAccount response = securityCenterSettingsServiceClient.getServiceAccount(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 ServiceAccount getServiceAccount(GetServiceAccountRequest request) {
return getServiceAccountCallable().call(request);
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Retrieves the organizations service account, if it exists, otherwise it creates the
* organization service account. This API is idempotent and will only create a service account
* once. On subsequent calls it will return the previously created service account. SHA, SCC and
* CTD Infra Automation will use this SA. This SA will not have any permissions when created. The
* UI will provision this via IAM or the user will using their own internal process. This API only
* creates SAs on the organization. Folders are not supported and projects will use per-project
* SAs associated with APIs enabled on a project. This API will be called by the UX onboarding
* workflow.
*
* 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 (SecurityCenterSettingsServiceClient securityCenterSettingsServiceClient =
* SecurityCenterSettingsServiceClient.create()) {
* GetServiceAccountRequest request =
* GetServiceAccountRequest.newBuilder()
* .setName(ServiceAccountName.of("[ORGANIZATION]").toString())
* .build();
* ApiFuture future =
* securityCenterSettingsServiceClient.getServiceAccountCallable().futureCall(request);
* // Do something.
* ServiceAccount response = future.get();
* }
* }
*/
public final UnaryCallable getServiceAccountCallable() {
return stub.getServiceAccountCallable();
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Gets the Settings.
*
* 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 (SecurityCenterSettingsServiceClient securityCenterSettingsServiceClient =
* SecurityCenterSettingsServiceClient.create()) {
* SettingsName name = SettingsName.ofOrganizationName("[ORGANIZATION]");
* Settings response = securityCenterSettingsServiceClient.getSettings(name);
* }
* }
*
* @param name Required. The name of the settings to retrieve. Formats: *
* `organizations/{organization}/settings` * `folders/{folder}/settings` *
* `projects/{project}/settings` *
* `projects/{project}/locations/{location}/clusters/{cluster}/settings` *
* `projects/{project}/regions/{region}/clusters/{cluster}/settings` *
* `projects/{project}/zones/{zone}/clusters/{cluster}/settings`
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
public final Settings getSettings(SettingsName name) {
GetSettingsRequest request =
GetSettingsRequest.newBuilder().setName(name == null ? null : name.toString()).build();
return getSettings(request);
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Gets the Settings.
*
* 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 (SecurityCenterSettingsServiceClient securityCenterSettingsServiceClient =
* SecurityCenterSettingsServiceClient.create()) {
* String name = SettingsName.ofOrganizationName("[ORGANIZATION]").toString();
* Settings response = securityCenterSettingsServiceClient.getSettings(name);
* }
* }
*
* @param name Required. The name of the settings to retrieve. Formats: *
* `organizations/{organization}/settings` * `folders/{folder}/settings` *
* `projects/{project}/settings` *
* `projects/{project}/locations/{location}/clusters/{cluster}/settings` *
* `projects/{project}/regions/{region}/clusters/{cluster}/settings` *
* `projects/{project}/zones/{zone}/clusters/{cluster}/settings`
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
public final Settings getSettings(String name) {
GetSettingsRequest request = GetSettingsRequest.newBuilder().setName(name).build();
return getSettings(request);
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Gets the Settings.
*
* 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 (SecurityCenterSettingsServiceClient securityCenterSettingsServiceClient =
* SecurityCenterSettingsServiceClient.create()) {
* GetSettingsRequest request =
* GetSettingsRequest.newBuilder()
* .setName(SettingsName.ofOrganizationName("[ORGANIZATION]").toString())
* .build();
* Settings response = securityCenterSettingsServiceClient.getSettings(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 Settings getSettings(GetSettingsRequest request) {
return getSettingsCallable().call(request);
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Gets the Settings.
*
* 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 (SecurityCenterSettingsServiceClient securityCenterSettingsServiceClient =
* SecurityCenterSettingsServiceClient.create()) {
* GetSettingsRequest request =
* GetSettingsRequest.newBuilder()
* .setName(SettingsName.ofOrganizationName("[ORGANIZATION]").toString())
* .build();
* ApiFuture future =
* securityCenterSettingsServiceClient.getSettingsCallable().futureCall(request);
* // Do something.
* Settings response = future.get();
* }
* }
*/
public final UnaryCallable getSettingsCallable() {
return stub.getSettingsCallable();
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Updates the Settings.
*
* 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 (SecurityCenterSettingsServiceClient securityCenterSettingsServiceClient =
* SecurityCenterSettingsServiceClient.create()) {
* Settings settings = Settings.newBuilder().build();
* FieldMask updateMask = FieldMask.newBuilder().build();
* Settings response = securityCenterSettingsServiceClient.updateSettings(settings, updateMask);
* }
* }
*
* @param settings Required. The settings to update.
* The settings' `name` field is used to identify the settings to be updated. Formats:
* * `organizations/{organization}/settings` * `folders/{folder}/settings` *
* `projects/{project}/settings` *
* `projects/{project}/locations/{location}/clusters/{cluster}/settings` *
* `projects/{project}/regions/{region}/clusters/{cluster}/settings` *
* `projects/{project}/zones/{zone}/clusters/{cluster}/settings`
* @param updateMask The list of fields to be updated on the settings.
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
public final Settings updateSettings(Settings settings, FieldMask updateMask) {
UpdateSettingsRequest request =
UpdateSettingsRequest.newBuilder().setSettings(settings).setUpdateMask(updateMask).build();
return updateSettings(request);
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Updates the Settings.
*
*
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 (SecurityCenterSettingsServiceClient securityCenterSettingsServiceClient =
* SecurityCenterSettingsServiceClient.create()) {
* UpdateSettingsRequest request =
* UpdateSettingsRequest.newBuilder()
* .setSettings(Settings.newBuilder().build())
* .setUpdateMask(FieldMask.newBuilder().build())
* .build();
* Settings response = securityCenterSettingsServiceClient.updateSettings(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 Settings updateSettings(UpdateSettingsRequest request) {
return updateSettingsCallable().call(request);
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Updates the Settings.
*
* 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 (SecurityCenterSettingsServiceClient securityCenterSettingsServiceClient =
* SecurityCenterSettingsServiceClient.create()) {
* UpdateSettingsRequest request =
* UpdateSettingsRequest.newBuilder()
* .setSettings(Settings.newBuilder().build())
* .setUpdateMask(FieldMask.newBuilder().build())
* .build();
* ApiFuture future =
* securityCenterSettingsServiceClient.updateSettingsCallable().futureCall(request);
* // Do something.
* Settings response = future.get();
* }
* }
*/
public final UnaryCallable updateSettingsCallable() {
return stub.updateSettingsCallable();
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Reset the organization, folder or project's settings and return the settings of just that
* resource to the default.
*
* Settings are present at the organization, folder, project, and cluster levels. Using Reset
* on a sub-organization level will remove that resource's override and result in the parent's
* settings being used (eg: if Reset on a cluster, project settings will be used).
*
*
Using Reset on organization will remove the override that was set and result in default
* settings being used.
*
*
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 (SecurityCenterSettingsServiceClient securityCenterSettingsServiceClient =
* SecurityCenterSettingsServiceClient.create()) {
* ResetSettingsRequest request =
* ResetSettingsRequest.newBuilder()
* .setName(SettingsName.ofOrganizationName("[ORGANIZATION]").toString())
* .setEtag("etag3123477")
* .build();
* securityCenterSettingsServiceClient.resetSettings(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 void resetSettings(ResetSettingsRequest request) {
resetSettingsCallable().call(request);
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Reset the organization, folder or project's settings and return the settings of just that
* resource to the default.
*
* Settings are present at the organization, folder, project, and cluster levels. Using Reset
* on a sub-organization level will remove that resource's override and result in the parent's
* settings being used (eg: if Reset on a cluster, project settings will be used).
*
*
Using Reset on organization will remove the override that was set and result in default
* settings being used.
*
*
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 (SecurityCenterSettingsServiceClient securityCenterSettingsServiceClient =
* SecurityCenterSettingsServiceClient.create()) {
* ResetSettingsRequest request =
* ResetSettingsRequest.newBuilder()
* .setName(SettingsName.ofOrganizationName("[ORGANIZATION]").toString())
* .setEtag("etag3123477")
* .build();
* ApiFuture future =
* securityCenterSettingsServiceClient.resetSettingsCallable().futureCall(request);
* // Do something.
* future.get();
* }
* }
*/
public final UnaryCallable resetSettingsCallable() {
return stub.resetSettingsCallable();
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Gets a list of settings.
*
* 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 (SecurityCenterSettingsServiceClient securityCenterSettingsServiceClient =
* SecurityCenterSettingsServiceClient.create()) {
* BatchGetSettingsRequest request =
* BatchGetSettingsRequest.newBuilder()
* .setParent(OrganizationName.of("[ORGANIZATION]").toString())
* .addAllNames(new ArrayList())
* .build();
* BatchGetSettingsResponse response =
* securityCenterSettingsServiceClient.batchGetSettings(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 BatchGetSettingsResponse batchGetSettings(BatchGetSettingsRequest request) {
return batchGetSettingsCallable().call(request);
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Gets a list of settings.
*
* 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 (SecurityCenterSettingsServiceClient securityCenterSettingsServiceClient =
* SecurityCenterSettingsServiceClient.create()) {
* BatchGetSettingsRequest request =
* BatchGetSettingsRequest.newBuilder()
* .setParent(OrganizationName.of("[ORGANIZATION]").toString())
* .addAllNames(new ArrayList())
* .build();
* ApiFuture future =
* securityCenterSettingsServiceClient.batchGetSettingsCallable().futureCall(request);
* // Do something.
* BatchGetSettingsResponse response = future.get();
* }
* }
*/
public final UnaryCallable
batchGetSettingsCallable() {
return stub.batchGetSettingsCallable();
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* CalculateEffectiveSettings looks up all of the Security Center Settings resources in the GCP
* resource hierarchy, and calculates the effective settings on that resource by applying the
* following rules: * Settings provided closer to the target resource take precedence over
* those further away (e.g. folder will override organization level settings). * Product
* defaults can be overridden at org, folder, project, and cluster levels. * Detectors will be
* filtered out if they belong to a billing tier the customer has not configured.
*
* 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 (SecurityCenterSettingsServiceClient securityCenterSettingsServiceClient =
* SecurityCenterSettingsServiceClient.create()) {
* SettingsName name = SettingsName.ofOrganizationName("[ORGANIZATION]");
* Settings response = securityCenterSettingsServiceClient.calculateEffectiveSettings(name);
* }
* }
*
* @param name Required. The name of the effective settings to retrieve. Formats: *
* `organizations/{organization}/effectiveSettings` * `folders/{folder}/effectiveSettings`
* * `projects/{project}/effectiveSettings` *
* `projects/{project}/locations/{location}/clusters/{cluster}/effectiveSettings` *
* `projects/{project}/regions/{region}/clusters/{cluster}/effectiveSettings` *
* `projects/{project}/zones/{zone}/clusters/{cluster}/effectiveSettings`
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
public final Settings calculateEffectiveSettings(SettingsName name) {
CalculateEffectiveSettingsRequest request =
CalculateEffectiveSettingsRequest.newBuilder()
.setName(name == null ? null : name.toString())
.build();
return calculateEffectiveSettings(request);
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* CalculateEffectiveSettings looks up all of the Security Center Settings resources in the GCP
* resource hierarchy, and calculates the effective settings on that resource by applying the
* following rules: * Settings provided closer to the target resource take precedence over
* those further away (e.g. folder will override organization level settings). * Product
* defaults can be overridden at org, folder, project, and cluster levels. * Detectors will be
* filtered out if they belong to a billing tier the customer has not configured.
*
* 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 (SecurityCenterSettingsServiceClient securityCenterSettingsServiceClient =
* SecurityCenterSettingsServiceClient.create()) {
* String name = SettingsName.ofOrganizationName("[ORGANIZATION]").toString();
* Settings response = securityCenterSettingsServiceClient.calculateEffectiveSettings(name);
* }
* }
*
* @param name Required. The name of the effective settings to retrieve. Formats: *
* `organizations/{organization}/effectiveSettings` * `folders/{folder}/effectiveSettings`
* * `projects/{project}/effectiveSettings` *
* `projects/{project}/locations/{location}/clusters/{cluster}/effectiveSettings` *
* `projects/{project}/regions/{region}/clusters/{cluster}/effectiveSettings` *
* `projects/{project}/zones/{zone}/clusters/{cluster}/effectiveSettings`
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
public final Settings calculateEffectiveSettings(String name) {
CalculateEffectiveSettingsRequest request =
CalculateEffectiveSettingsRequest.newBuilder().setName(name).build();
return calculateEffectiveSettings(request);
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* CalculateEffectiveSettings looks up all of the Security Center Settings resources in the GCP
* resource hierarchy, and calculates the effective settings on that resource by applying the
* following rules: * Settings provided closer to the target resource take precedence over
* those further away (e.g. folder will override organization level settings). * Product
* defaults can be overridden at org, folder, project, and cluster levels. * Detectors will be
* filtered out if they belong to a billing tier the customer has not configured.
*
* 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 (SecurityCenterSettingsServiceClient securityCenterSettingsServiceClient =
* SecurityCenterSettingsServiceClient.create()) {
* CalculateEffectiveSettingsRequest request =
* CalculateEffectiveSettingsRequest.newBuilder()
* .setName(SettingsName.ofOrganizationName("[ORGANIZATION]").toString())
* .build();
* Settings response = securityCenterSettingsServiceClient.calculateEffectiveSettings(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 Settings calculateEffectiveSettings(CalculateEffectiveSettingsRequest request) {
return calculateEffectiveSettingsCallable().call(request);
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* CalculateEffectiveSettings looks up all of the Security Center Settings resources in the GCP
* resource hierarchy, and calculates the effective settings on that resource by applying the
* following rules: * Settings provided closer to the target resource take precedence over
* those further away (e.g. folder will override organization level settings). * Product
* defaults can be overridden at org, folder, project, and cluster levels. * Detectors will be
* filtered out if they belong to a billing tier the customer has not configured.
*
* 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 (SecurityCenterSettingsServiceClient securityCenterSettingsServiceClient =
* SecurityCenterSettingsServiceClient.create()) {
* CalculateEffectiveSettingsRequest request =
* CalculateEffectiveSettingsRequest.newBuilder()
* .setName(SettingsName.ofOrganizationName("[ORGANIZATION]").toString())
* .build();
* ApiFuture future =
* securityCenterSettingsServiceClient
* .calculateEffectiveSettingsCallable()
* .futureCall(request);
* // Do something.
* Settings response = future.get();
* }
* }
*/
public final UnaryCallable
calculateEffectiveSettingsCallable() {
return stub.calculateEffectiveSettingsCallable();
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Gets a list of effective settings.
*
* 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 (SecurityCenterSettingsServiceClient securityCenterSettingsServiceClient =
* SecurityCenterSettingsServiceClient.create()) {
* BatchCalculateEffectiveSettingsRequest request =
* BatchCalculateEffectiveSettingsRequest.newBuilder()
* .setParent(OrganizationName.of("[ORGANIZATION]").toString())
* .addAllRequests(new ArrayList())
* .build();
* BatchCalculateEffectiveSettingsResponse response =
* securityCenterSettingsServiceClient.batchCalculateEffectiveSettings(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 BatchCalculateEffectiveSettingsResponse batchCalculateEffectiveSettings(
BatchCalculateEffectiveSettingsRequest request) {
return batchCalculateEffectiveSettingsCallable().call(request);
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Gets a list of effective settings.
*
* 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 (SecurityCenterSettingsServiceClient securityCenterSettingsServiceClient =
* SecurityCenterSettingsServiceClient.create()) {
* BatchCalculateEffectiveSettingsRequest request =
* BatchCalculateEffectiveSettingsRequest.newBuilder()
* .setParent(OrganizationName.of("[ORGANIZATION]").toString())
* .addAllRequests(new ArrayList())
* .build();
* ApiFuture future =
* securityCenterSettingsServiceClient
* .batchCalculateEffectiveSettingsCallable()
* .futureCall(request);
* // Do something.
* BatchCalculateEffectiveSettingsResponse response = future.get();
* }
* }
*/
public final UnaryCallable<
BatchCalculateEffectiveSettingsRequest, BatchCalculateEffectiveSettingsResponse>
batchCalculateEffectiveSettingsCallable() {
return stub.batchCalculateEffectiveSettingsCallable();
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Gets the Component Settings.
*
* 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 (SecurityCenterSettingsServiceClient securityCenterSettingsServiceClient =
* SecurityCenterSettingsServiceClient.create()) {
* ComponentSettingsName name =
* ComponentSettingsName.ofOrganizationComponentName("[ORGANIZATION]", "[COMPONENT]");
* ComponentSettings response = securityCenterSettingsServiceClient.getComponentSettings(name);
* }
* }
*
* @param name Required. The component settings to retrieve.
* Formats: * `organizations/{organization}/components/{component}/settings` *
* `folders/{folder}/components/{component}/settings` *
* `projects/{project}/components/{component}/settings` *
* `projects/{project}/locations/{location}/clusters/{cluster}/components/{component}/settings`
* *
* `projects/{project}/regions/{region}/clusters/{cluster}/components/{component}/settings`
* * `projects/{project}/zones/{zone}/clusters/{cluster}/components/{component}/settings`
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
public final ComponentSettings getComponentSettings(ComponentSettingsName name) {
GetComponentSettingsRequest request =
GetComponentSettingsRequest.newBuilder()
.setName(name == null ? null : name.toString())
.build();
return getComponentSettings(request);
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Gets the Component Settings.
*
*
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 (SecurityCenterSettingsServiceClient securityCenterSettingsServiceClient =
* SecurityCenterSettingsServiceClient.create()) {
* String name =
* ComponentSettingsName.ofOrganizationComponentName("[ORGANIZATION]", "[COMPONENT]")
* .toString();
* ComponentSettings response = securityCenterSettingsServiceClient.getComponentSettings(name);
* }
* }
*
* @param name Required. The component settings to retrieve.
* Formats: * `organizations/{organization}/components/{component}/settings` *
* `folders/{folder}/components/{component}/settings` *
* `projects/{project}/components/{component}/settings` *
* `projects/{project}/locations/{location}/clusters/{cluster}/components/{component}/settings`
* *
* `projects/{project}/regions/{region}/clusters/{cluster}/components/{component}/settings`
* * `projects/{project}/zones/{zone}/clusters/{cluster}/components/{component}/settings`
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
public final ComponentSettings getComponentSettings(String name) {
GetComponentSettingsRequest request =
GetComponentSettingsRequest.newBuilder().setName(name).build();
return getComponentSettings(request);
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Gets the Component Settings.
*
*
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 (SecurityCenterSettingsServiceClient securityCenterSettingsServiceClient =
* SecurityCenterSettingsServiceClient.create()) {
* GetComponentSettingsRequest request =
* GetComponentSettingsRequest.newBuilder()
* .setName(
* ComponentSettingsName.ofOrganizationComponentName("[ORGANIZATION]", "[COMPONENT]")
* .toString())
* .build();
* ComponentSettings response =
* securityCenterSettingsServiceClient.getComponentSettings(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 ComponentSettings getComponentSettings(GetComponentSettingsRequest request) {
return getComponentSettingsCallable().call(request);
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Gets the Component Settings.
*
* 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 (SecurityCenterSettingsServiceClient securityCenterSettingsServiceClient =
* SecurityCenterSettingsServiceClient.create()) {
* GetComponentSettingsRequest request =
* GetComponentSettingsRequest.newBuilder()
* .setName(
* ComponentSettingsName.ofOrganizationComponentName("[ORGANIZATION]", "[COMPONENT]")
* .toString())
* .build();
* ApiFuture future =
* securityCenterSettingsServiceClient.getComponentSettingsCallable().futureCall(request);
* // Do something.
* ComponentSettings response = future.get();
* }
* }
*/
public final UnaryCallable
getComponentSettingsCallable() {
return stub.getComponentSettingsCallable();
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Updates the Component Settings.
*
* 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 (SecurityCenterSettingsServiceClient securityCenterSettingsServiceClient =
* SecurityCenterSettingsServiceClient.create()) {
* ComponentSettings componentSettings = ComponentSettings.newBuilder().build();
* FieldMask updateMask = FieldMask.newBuilder().build();
* ComponentSettings response =
* securityCenterSettingsServiceClient.updateComponentSettings(
* componentSettings, updateMask);
* }
* }
*
* @param componentSettings Required. The component settings to update.
* The component settings' `name` field is used to identify the component settings to be
* updated. Formats: * `organizations/{organization}/components/{component}/settings`
* * `folders/{folder}/components/{component}/settings` *
* `projects/{project}/components/{component}/settings` *
* `projects/{project}/locations/{location}/clusters/{cluster}/components/{component}/settings`
* *
* `projects/{project}/regions/{region}/clusters/{cluster}/components/{component}/settings`
* * `projects/{project}/zones/{zone}/clusters/{cluster}/components/{component}/settings`
* @param updateMask The list of fields to be updated on the component settings resource.
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
public final ComponentSettings updateComponentSettings(
ComponentSettings componentSettings, FieldMask updateMask) {
UpdateComponentSettingsRequest request =
UpdateComponentSettingsRequest.newBuilder()
.setComponentSettings(componentSettings)
.setUpdateMask(updateMask)
.build();
return updateComponentSettings(request);
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Updates the Component Settings.
*
*
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 (SecurityCenterSettingsServiceClient securityCenterSettingsServiceClient =
* SecurityCenterSettingsServiceClient.create()) {
* UpdateComponentSettingsRequest request =
* UpdateComponentSettingsRequest.newBuilder()
* .setComponentSettings(ComponentSettings.newBuilder().build())
* .setUpdateMask(FieldMask.newBuilder().build())
* .build();
* ComponentSettings response =
* securityCenterSettingsServiceClient.updateComponentSettings(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 ComponentSettings updateComponentSettings(UpdateComponentSettingsRequest request) {
return updateComponentSettingsCallable().call(request);
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Updates the Component Settings.
*
* 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 (SecurityCenterSettingsServiceClient securityCenterSettingsServiceClient =
* SecurityCenterSettingsServiceClient.create()) {
* UpdateComponentSettingsRequest request =
* UpdateComponentSettingsRequest.newBuilder()
* .setComponentSettings(ComponentSettings.newBuilder().build())
* .setUpdateMask(FieldMask.newBuilder().build())
* .build();
* ApiFuture future =
* securityCenterSettingsServiceClient.updateComponentSettingsCallable().futureCall(request);
* // Do something.
* ComponentSettings response = future.get();
* }
* }
*/
public final UnaryCallable
updateComponentSettingsCallable() {
return stub.updateComponentSettingsCallable();
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Reset the organization, folder or project's component settings and return the settings to the
* default. Settings are present at the organization, folder and project levels. Using Reset for a
* folder or project will remove the override that was set and result in the organization-level
* settings being used.
*
* 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 (SecurityCenterSettingsServiceClient securityCenterSettingsServiceClient =
* SecurityCenterSettingsServiceClient.create()) {
* ResetComponentSettingsRequest request =
* ResetComponentSettingsRequest.newBuilder()
* .setName(
* ComponentSettingsName.ofOrganizationComponentName("[ORGANIZATION]", "[COMPONENT]")
* .toString())
* .setEtag("etag3123477")
* .build();
* securityCenterSettingsServiceClient.resetComponentSettings(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 void resetComponentSettings(ResetComponentSettingsRequest request) {
resetComponentSettingsCallable().call(request);
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Reset the organization, folder or project's component settings and return the settings to the
* default. Settings are present at the organization, folder and project levels. Using Reset for a
* folder or project will remove the override that was set and result in the organization-level
* settings being used.
*
* 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 (SecurityCenterSettingsServiceClient securityCenterSettingsServiceClient =
* SecurityCenterSettingsServiceClient.create()) {
* ResetComponentSettingsRequest request =
* ResetComponentSettingsRequest.newBuilder()
* .setName(
* ComponentSettingsName.ofOrganizationComponentName("[ORGANIZATION]", "[COMPONENT]")
* .toString())
* .setEtag("etag3123477")
* .build();
* ApiFuture future =
* securityCenterSettingsServiceClient.resetComponentSettingsCallable().futureCall(request);
* // Do something.
* future.get();
* }
* }
*/
public final UnaryCallable
resetComponentSettingsCallable() {
return stub.resetComponentSettingsCallable();
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Gets the Effective Component Settings.
*
* 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 (SecurityCenterSettingsServiceClient securityCenterSettingsServiceClient =
* SecurityCenterSettingsServiceClient.create()) {
* ComponentSettingsName name =
* ComponentSettingsName.ofOrganizationComponentName("[ORGANIZATION]", "[COMPONENT]");
* ComponentSettings response =
* securityCenterSettingsServiceClient.calculateEffectiveComponentSettings(name);
* }
* }
*
* @param name Required. The effective component settings to retrieve.
* Formats: * `organizations/{organization}/components/{component}/settings` *
* `folders/{folder}/components/{component}/settings` *
* `projects/{project}/components/{component}/settings` *
* `projects/{project}/locations/{location}/clusters/{cluster}/components/{component}/settings`
* *
* `projects/{project}/regions/{region}/clusters/{cluster}/components/{component}/settings`
* * `projects/{project}/zones/{zone}/clusters/{cluster}/components/{component}/settings`
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
public final ComponentSettings calculateEffectiveComponentSettings(ComponentSettingsName name) {
CalculateEffectiveComponentSettingsRequest request =
CalculateEffectiveComponentSettingsRequest.newBuilder()
.setName(name == null ? null : name.toString())
.build();
return calculateEffectiveComponentSettings(request);
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Gets the Effective Component Settings.
*
*
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 (SecurityCenterSettingsServiceClient securityCenterSettingsServiceClient =
* SecurityCenterSettingsServiceClient.create()) {
* String name =
* ComponentSettingsName.ofOrganizationComponentName("[ORGANIZATION]", "[COMPONENT]")
* .toString();
* ComponentSettings response =
* securityCenterSettingsServiceClient.calculateEffectiveComponentSettings(name);
* }
* }
*
* @param name Required. The effective component settings to retrieve.
* Formats: * `organizations/{organization}/components/{component}/settings` *
* `folders/{folder}/components/{component}/settings` *
* `projects/{project}/components/{component}/settings` *
* `projects/{project}/locations/{location}/clusters/{cluster}/components/{component}/settings`
* *
* `projects/{project}/regions/{region}/clusters/{cluster}/components/{component}/settings`
* * `projects/{project}/zones/{zone}/clusters/{cluster}/components/{component}/settings`
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
public final ComponentSettings calculateEffectiveComponentSettings(String name) {
CalculateEffectiveComponentSettingsRequest request =
CalculateEffectiveComponentSettingsRequest.newBuilder().setName(name).build();
return calculateEffectiveComponentSettings(request);
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Gets the Effective Component Settings.
*
*
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 (SecurityCenterSettingsServiceClient securityCenterSettingsServiceClient =
* SecurityCenterSettingsServiceClient.create()) {
* CalculateEffectiveComponentSettingsRequest request =
* CalculateEffectiveComponentSettingsRequest.newBuilder()
* .setName(
* ComponentSettingsName.ofOrganizationComponentName("[ORGANIZATION]", "[COMPONENT]")
* .toString())
* .build();
* ComponentSettings response =
* securityCenterSettingsServiceClient.calculateEffectiveComponentSettings(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 ComponentSettings calculateEffectiveComponentSettings(
CalculateEffectiveComponentSettingsRequest request) {
return calculateEffectiveComponentSettingsCallable().call(request);
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Gets the Effective Component Settings.
*
* 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 (SecurityCenterSettingsServiceClient securityCenterSettingsServiceClient =
* SecurityCenterSettingsServiceClient.create()) {
* CalculateEffectiveComponentSettingsRequest request =
* CalculateEffectiveComponentSettingsRequest.newBuilder()
* .setName(
* ComponentSettingsName.ofOrganizationComponentName("[ORGANIZATION]", "[COMPONENT]")
* .toString())
* .build();
* ApiFuture future =
* securityCenterSettingsServiceClient
* .calculateEffectiveComponentSettingsCallable()
* .futureCall(request);
* // Do something.
* ComponentSettings response = future.get();
* }
* }
*/
public final UnaryCallable
calculateEffectiveComponentSettingsCallable() {
return stub.calculateEffectiveComponentSettingsCallable();
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Retrieves an unordered list of available detectors.
*
* 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 (SecurityCenterSettingsServiceClient securityCenterSettingsServiceClient =
* SecurityCenterSettingsServiceClient.create()) {
* OrganizationName parent = OrganizationName.of("[ORGANIZATION]");
* for (Detector element :
* securityCenterSettingsServiceClient.listDetectors(parent).iterateAll()) {
* // doThingsWith(element);
* }
* }
* }
*
* @param parent Required. The parent, which owns this collection of detectors. Format: *
* `organizations/{organization}`
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
public final ListDetectorsPagedResponse listDetectors(OrganizationName parent) {
ListDetectorsRequest request =
ListDetectorsRequest.newBuilder()
.setParent(parent == null ? null : parent.toString())
.build();
return listDetectors(request);
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Retrieves an unordered list of available detectors.
*
* 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 (SecurityCenterSettingsServiceClient securityCenterSettingsServiceClient =
* SecurityCenterSettingsServiceClient.create()) {
* String parent = OrganizationName.of("[ORGANIZATION]").toString();
* for (Detector element :
* securityCenterSettingsServiceClient.listDetectors(parent).iterateAll()) {
* // doThingsWith(element);
* }
* }
* }
*
* @param parent Required. The parent, which owns this collection of detectors. Format: *
* `organizations/{organization}`
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
public final ListDetectorsPagedResponse listDetectors(String parent) {
ListDetectorsRequest request = ListDetectorsRequest.newBuilder().setParent(parent).build();
return listDetectors(request);
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Retrieves an unordered list of available detectors.
*
* 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 (SecurityCenterSettingsServiceClient securityCenterSettingsServiceClient =
* SecurityCenterSettingsServiceClient.create()) {
* ListDetectorsRequest request =
* ListDetectorsRequest.newBuilder()
* .setParent(OrganizationName.of("[ORGANIZATION]").toString())
* .setFilter("filter-1274492040")
* .setPageSize(883849137)
* .setPageToken("pageToken873572522")
* .build();
* for (Detector element :
* securityCenterSettingsServiceClient.listDetectors(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 ListDetectorsPagedResponse listDetectors(ListDetectorsRequest request) {
return listDetectorsPagedCallable().call(request);
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Retrieves an unordered list of available detectors.
*
* 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 (SecurityCenterSettingsServiceClient securityCenterSettingsServiceClient =
* SecurityCenterSettingsServiceClient.create()) {
* ListDetectorsRequest request =
* ListDetectorsRequest.newBuilder()
* .setParent(OrganizationName.of("[ORGANIZATION]").toString())
* .setFilter("filter-1274492040")
* .setPageSize(883849137)
* .setPageToken("pageToken873572522")
* .build();
* ApiFuture future =
* securityCenterSettingsServiceClient.listDetectorsPagedCallable().futureCall(request);
* // Do something.
* for (Detector element : future.get().iterateAll()) {
* // doThingsWith(element);
* }
* }
* }
*/
public final UnaryCallable
listDetectorsPagedCallable() {
return stub.listDetectorsPagedCallable();
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Retrieves an unordered list of available detectors.
*
* 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 (SecurityCenterSettingsServiceClient securityCenterSettingsServiceClient =
* SecurityCenterSettingsServiceClient.create()) {
* ListDetectorsRequest request =
* ListDetectorsRequest.newBuilder()
* .setParent(OrganizationName.of("[ORGANIZATION]").toString())
* .setFilter("filter-1274492040")
* .setPageSize(883849137)
* .setPageToken("pageToken873572522")
* .build();
* while (true) {
* ListDetectorsResponse response =
* securityCenterSettingsServiceClient.listDetectorsCallable().call(request);
* for (Detector element : response.getDetectorsList()) {
* // doThingsWith(element);
* }
* String nextPageToken = response.getNextPageToken();
* if (!Strings.isNullOrEmpty(nextPageToken)) {
* request = request.toBuilder().setPageToken(nextPageToken).build();
* } else {
* break;
* }
* }
* }
* }
*/
public final UnaryCallable listDetectorsCallable() {
return stub.listDetectorsCallable();
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Retrieves an unordered list of available SCC components.
*
* 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 (SecurityCenterSettingsServiceClient securityCenterSettingsServiceClient =
* SecurityCenterSettingsServiceClient.create()) {
* OrganizationName parent = OrganizationName.of("[ORGANIZATION]");
* for (String element :
* securityCenterSettingsServiceClient.listComponents(parent).iterateAll()) {
* // doThingsWith(element);
* }
* }
* }
*
* @param parent Required. The parent, which owns this collection of components. Format: *
* `organizations/{organization}`
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
public final ListComponentsPagedResponse listComponents(OrganizationName parent) {
ListComponentsRequest request =
ListComponentsRequest.newBuilder()
.setParent(parent == null ? null : parent.toString())
.build();
return listComponents(request);
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Retrieves an unordered list of available SCC components.
*
* 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 (SecurityCenterSettingsServiceClient securityCenterSettingsServiceClient =
* SecurityCenterSettingsServiceClient.create()) {
* String parent = OrganizationName.of("[ORGANIZATION]").toString();
* for (String element :
* securityCenterSettingsServiceClient.listComponents(parent).iterateAll()) {
* // doThingsWith(element);
* }
* }
* }
*
* @param parent Required. The parent, which owns this collection of components. Format: *
* `organizations/{organization}`
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
public final ListComponentsPagedResponse listComponents(String parent) {
ListComponentsRequest request = ListComponentsRequest.newBuilder().setParent(parent).build();
return listComponents(request);
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Retrieves an unordered list of available SCC components.
*
* 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 (SecurityCenterSettingsServiceClient securityCenterSettingsServiceClient =
* SecurityCenterSettingsServiceClient.create()) {
* ListComponentsRequest request =
* ListComponentsRequest.newBuilder()
* .setParent(OrganizationName.of("[ORGANIZATION]").toString())
* .setPageSize(883849137)
* .setPageToken("pageToken873572522")
* .build();
* for (String element :
* securityCenterSettingsServiceClient.listComponents(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 ListComponentsPagedResponse listComponents(ListComponentsRequest request) {
return listComponentsPagedCallable().call(request);
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Retrieves an unordered list of available SCC components.
*
* 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 (SecurityCenterSettingsServiceClient securityCenterSettingsServiceClient =
* SecurityCenterSettingsServiceClient.create()) {
* ListComponentsRequest request =
* ListComponentsRequest.newBuilder()
* .setParent(OrganizationName.of("[ORGANIZATION]").toString())
* .setPageSize(883849137)
* .setPageToken("pageToken873572522")
* .build();
* ApiFuture future =
* securityCenterSettingsServiceClient.listComponentsPagedCallable().futureCall(request);
* // Do something.
* for (String element : future.get().iterateAll()) {
* // doThingsWith(element);
* }
* }
* }
*/
public final UnaryCallable
listComponentsPagedCallable() {
return stub.listComponentsPagedCallable();
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Retrieves an unordered list of available SCC components.
*
* 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 (SecurityCenterSettingsServiceClient securityCenterSettingsServiceClient =
* SecurityCenterSettingsServiceClient.create()) {
* ListComponentsRequest request =
* ListComponentsRequest.newBuilder()
* .setParent(OrganizationName.of("[ORGANIZATION]").toString())
* .setPageSize(883849137)
* .setPageToken("pageToken873572522")
* .build();
* while (true) {
* ListComponentsResponse response =
* securityCenterSettingsServiceClient.listComponentsCallable().call(request);
* for (String element : response.getComponentsList()) {
* // doThingsWith(element);
* }
* String nextPageToken = response.getNextPageToken();
* if (!Strings.isNullOrEmpty(nextPageToken)) {
* request = request.toBuilder().setPageToken(nextPageToken).build();
* } else {
* break;
* }
* }
* }
* }
*/
public final UnaryCallable
listComponentsCallable() {
return stub.listComponentsCallable();
}
@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 ListDetectorsPagedResponse
extends AbstractPagedListResponse<
ListDetectorsRequest,
ListDetectorsResponse,
Detector,
ListDetectorsPage,
ListDetectorsFixedSizeCollection> {
public static ApiFuture createAsync(
PageContext context,
ApiFuture futureResponse) {
ApiFuture futurePage =
ListDetectorsPage.createEmptyPage().createPageAsync(context, futureResponse);
return ApiFutures.transform(
futurePage,
input -> new ListDetectorsPagedResponse(input),
MoreExecutors.directExecutor());
}
private ListDetectorsPagedResponse(ListDetectorsPage page) {
super(page, ListDetectorsFixedSizeCollection.createEmptyCollection());
}
}
public static class ListDetectorsPage
extends AbstractPage<
ListDetectorsRequest, ListDetectorsResponse, Detector, ListDetectorsPage> {
private ListDetectorsPage(
PageContext context,
ListDetectorsResponse response) {
super(context, response);
}
private static ListDetectorsPage createEmptyPage() {
return new ListDetectorsPage(null, null);
}
@Override
protected ListDetectorsPage createPage(
PageContext context,
ListDetectorsResponse response) {
return new ListDetectorsPage(context, response);
}
@Override
public ApiFuture createPageAsync(
PageContext context,
ApiFuture futureResponse) {
return super.createPageAsync(context, futureResponse);
}
}
public static class ListDetectorsFixedSizeCollection
extends AbstractFixedSizeCollection<
ListDetectorsRequest,
ListDetectorsResponse,
Detector,
ListDetectorsPage,
ListDetectorsFixedSizeCollection> {
private ListDetectorsFixedSizeCollection(List pages, int collectionSize) {
super(pages, collectionSize);
}
private static ListDetectorsFixedSizeCollection createEmptyCollection() {
return new ListDetectorsFixedSizeCollection(null, 0);
}
@Override
protected ListDetectorsFixedSizeCollection createCollection(
List pages, int collectionSize) {
return new ListDetectorsFixedSizeCollection(pages, collectionSize);
}
}
public static class ListComponentsPagedResponse
extends AbstractPagedListResponse<
ListComponentsRequest,
ListComponentsResponse,
String,
ListComponentsPage,
ListComponentsFixedSizeCollection> {
public static ApiFuture createAsync(
PageContext context,
ApiFuture futureResponse) {
ApiFuture futurePage =
ListComponentsPage.createEmptyPage().createPageAsync(context, futureResponse);
return ApiFutures.transform(
futurePage,
input -> new ListComponentsPagedResponse(input),
MoreExecutors.directExecutor());
}
private ListComponentsPagedResponse(ListComponentsPage page) {
super(page, ListComponentsFixedSizeCollection.createEmptyCollection());
}
}
public static class ListComponentsPage
extends AbstractPage<
ListComponentsRequest, ListComponentsResponse, String, ListComponentsPage> {
private ListComponentsPage(
PageContext context,
ListComponentsResponse response) {
super(context, response);
}
private static ListComponentsPage createEmptyPage() {
return new ListComponentsPage(null, null);
}
@Override
protected ListComponentsPage createPage(
PageContext context,
ListComponentsResponse response) {
return new ListComponentsPage(context, response);
}
@Override
public ApiFuture createPageAsync(
PageContext context,
ApiFuture futureResponse) {
return super.createPageAsync(context, futureResponse);
}
}
public static class ListComponentsFixedSizeCollection
extends AbstractFixedSizeCollection<
ListComponentsRequest,
ListComponentsResponse,
String,
ListComponentsPage,
ListComponentsFixedSizeCollection> {
private ListComponentsFixedSizeCollection(List pages, int collectionSize) {
super(pages, collectionSize);
}
private static ListComponentsFixedSizeCollection createEmptyCollection() {
return new ListComponentsFixedSizeCollection(null, 0);
}
@Override
protected ListComponentsFixedSizeCollection createCollection(
List pages, int collectionSize) {
return new ListComponentsFixedSizeCollection(pages, collectionSize);
}
}
}