- 2.61.0 (latest)
- 2.60.0
- 2.59.0
- 2.57.0
- 2.56.0
- 2.55.0
- 2.54.0
- 2.53.0
- 2.52.0
- 2.51.0
- 2.50.0
- 2.49.0
- 2.48.0
- 2.47.0
- 2.45.0
- 2.44.0
- 2.43.0
- 2.42.0
- 2.41.0
- 2.40.0
- 2.39.0
- 2.38.0
- 2.37.0
- 2.36.0
- 2.35.0
- 2.32.0
- 2.31.0
- 2.30.0
- 2.29.0
- 2.28.0
- 2.27.0
- 2.26.0
- 2.25.0
- 2.24.0
- 2.23.0
- 2.22.0
- 2.21.0
- 2.20.0
- 2.19.0
- 2.17.0
- 2.16.0
- 2.15.0
- 2.14.0
- 2.13.0
- 2.12.0
- 2.11.1
- 2.10.0
- 2.9.0
- 2.8.0
- 2.7.1
- 2.6.0
- 2.5.6
- 2.3.2
GitHub Repository | Product Reference | REST Documentation |
Service Description: V1p1Beta1 APIs for Security Center service.
This class provides the ability to make remote calls to the backing service through method calls that map to API methods. Sample code to get started:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (SecurityCenterClient securityCenterClient = SecurityCenterClient.create()) {
OrganizationName parent = OrganizationName.of("[ORGANIZATION]");
Source source = Source.newBuilder().build();
Source response = securityCenterClient.createSource(parent, source);
}
Note: close() needs to be called on the SecurityCenterClient object to clean up resources such as threads. In the example above, try-with-resources is used, which automatically calls close().
The surface of this class includes several types of Java methods for each of the API's methods:
- A "flattened" method. With this type of method, the fields of the request type have been converted into function parameters. It may be the case that not all fields are available as parameters, and not every API method will have a flattened method entry point.
- A "request object" method. This type of method only takes one parameter, a request object, which must be constructed before the call. Not every API method will have a request object method.
- A "callable" method. This type of method takes no parameters and returns an immutable API callable object, which can be used to initiate calls to the service.
See the individual methods for example code.
Many parameters require resource names to be formatted in a particular way. To assist with these names, this class includes a format method for each type of name, and additionally a parse method to extract the individual identifiers contained within names that are returned.
This class can be customized by passing in a custom instance of SecurityCenterSettings to create(). For example:
To customize credentials:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
SecurityCenterSettings securityCenterSettings =
SecurityCenterSettings.newBuilder()
.setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
.build();
SecurityCenterClient securityCenterClient = SecurityCenterClient.create(securityCenterSettings);
To customize the endpoint:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
SecurityCenterSettings securityCenterSettings =
SecurityCenterSettings.newBuilder().setEndpoint(myEndpoint).build();
SecurityCenterClient securityCenterClient = SecurityCenterClient.create(securityCenterSettings);
To use REST (HTTP1.1/JSON) transport (instead of gRPC) for sending and receiving requests over the wire:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
SecurityCenterSettings securityCenterSettings =
SecurityCenterSettings.newHttpJsonBuilder().build();
SecurityCenterClient securityCenterClient = SecurityCenterClient.create(securityCenterSettings);
Please refer to the GitHub repository's samples for more quickstart code snippets.
Static Methods
create()
public static final SecurityCenterClient create()
Constructs an instance of SecurityCenterClient with default settings.
Returns | |
---|---|
Type | Description |
SecurityCenterClient |
Exceptions | |
---|---|
Type | Description |
IOException |
create(SecurityCenterSettings settings)
public static final SecurityCenterClient create(SecurityCenterSettings settings)
Constructs an instance of SecurityCenterClient, using the given settings. The channels are created based on the settings passed in, or defaults for any settings that are not set.
Parameter | |
---|---|
Name | Description |
settings | SecurityCenterSettings |
Returns | |
---|---|
Type | Description |
SecurityCenterClient |
Exceptions | |
---|---|
Type | Description |
IOException |
create(SecurityCenterStub stub)
public static final SecurityCenterClient create(SecurityCenterStub stub)
Constructs an instance of SecurityCenterClient, using the given stub for making calls. This is for advanced usage - prefer using create(SecurityCenterSettings).
Parameter | |
---|---|
Name | Description |
stub | SecurityCenterStub |
Returns | |
---|---|
Type | Description |
SecurityCenterClient |
Constructors
SecurityCenterClient(SecurityCenterSettings settings)
protected SecurityCenterClient(SecurityCenterSettings settings)
Constructs an instance of SecurityCenterClient, using the given settings. This is protected so that it is easy to make a subclass, but otherwise, the static factory methods should be preferred.
Parameter | |
---|---|
Name | Description |
settings | SecurityCenterSettings |
SecurityCenterClient(SecurityCenterStub stub)
protected SecurityCenterClient(SecurityCenterStub stub)
Parameter | |
---|---|
Name | Description |
stub | SecurityCenterStub |
Methods
awaitTermination(long duration, TimeUnit unit)
public boolean awaitTermination(long duration, TimeUnit unit)
Parameters | |
---|---|
Name | Description |
duration | long |
unit | TimeUnit |
Returns | |
---|---|
Type | Description |
boolean |
Exceptions | |
---|---|
Type | Description |
InterruptedException |
close()
public final void close()
createFinding(CreateFindingRequest request)
public final Finding createFinding(CreateFindingRequest request)
Creates a finding. The corresponding source must exist for finding creation to succeed.
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (SecurityCenterClient securityCenterClient = SecurityCenterClient.create()) {
CreateFindingRequest request =
CreateFindingRequest.newBuilder()
.setParent(
SourceName.ofOrganizationSourceName("[ORGANIZATION]", "[SOURCE]").toString())
.setFindingId("findingId439150212")
.setFinding(Finding.newBuilder().build())
.build();
Finding response = securityCenterClient.createFinding(request);
}
Parameter | |
---|---|
Name | Description |
request | CreateFindingRequest The request object containing all of the parameters for the API call. |
Returns | |
---|---|
Type | Description |
Finding |
createFinding(SourceName parent, Finding finding, String findingId)
public final Finding createFinding(SourceName parent, Finding finding, String findingId)
Creates a finding. The corresponding source must exist for finding creation to succeed.
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (SecurityCenterClient securityCenterClient = SecurityCenterClient.create()) {
SourceName parent = SourceName.ofOrganizationSourceName("[ORGANIZATION]", "[SOURCE]");
Finding finding = Finding.newBuilder().build();
String findingId = "findingId439150212";
Finding response = securityCenterClient.createFinding(parent, finding, findingId);
}
Parameters | |
---|---|
Name | Description |
parent | SourceName Required. Resource name of the new finding's parent. Its format should be "organizations/[organization_id]/sources/[source_id]". |
finding | Finding Required. The Finding being created. The name and security_marks will be ignored as they are both output only fields on this resource. |
findingId | String Required. Unique identifier provided by the client within the parent scope. |
Returns | |
---|---|
Type | Description |
Finding |
createFinding(SourceName parent, String findingId, Finding finding)
public final Finding createFinding(SourceName parent, String findingId, Finding finding)
Creates a finding. The corresponding source must exist for finding creation to succeed.
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (SecurityCenterClient securityCenterClient = SecurityCenterClient.create()) {
SourceName parent = SourceName.ofOrganizationSourceName("[ORGANIZATION]", "[SOURCE]");
String findingId = "findingId439150212";
Finding finding = Finding.newBuilder().build();
Finding response = securityCenterClient.createFinding(parent, findingId, finding);
}
Parameters | |
---|---|
Name | Description |
parent | SourceName Required. Resource name of the new finding's parent. Its format should be "organizations/[organization_id]/sources/[source_id]". |
findingId | String Required. Unique identifier provided by the client within the parent scope. |
finding | Finding Required. The Finding being created. The name and security_marks will be ignored as they are both output only fields on this resource. |
Returns | |
---|---|
Type | Description |
Finding |
createFinding(String parent, Finding finding, String findingId)
public final Finding createFinding(String parent, Finding finding, String findingId)
Creates a finding. The corresponding source must exist for finding creation to succeed.
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (SecurityCenterClient securityCenterClient = SecurityCenterClient.create()) {
String parent = SourceName.ofOrganizationSourceName("[ORGANIZATION]", "[SOURCE]").toString();
Finding finding = Finding.newBuilder().build();
String findingId = "findingId439150212";
Finding response = securityCenterClient.createFinding(parent, finding, findingId);
}
Parameters | |
---|---|
Name | Description |
parent | String Required. Resource name of the new finding's parent. Its format should be "organizations/[organization_id]/sources/[source_id]". |
finding | Finding Required. The Finding being created. The name and security_marks will be ignored as they are both output only fields on this resource. |
findingId | String Required. Unique identifier provided by the client within the parent scope. |
Returns | |
---|---|
Type | Description |
Finding |
createFinding(String parent, String findingId, Finding finding)
public final Finding createFinding(String parent, String findingId, Finding finding)
Creates a finding. The corresponding source must exist for finding creation to succeed.
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (SecurityCenterClient securityCenterClient = SecurityCenterClient.create()) {
String parent = SourceName.ofOrganizationSourceName("[ORGANIZATION]", "[SOURCE]").toString();
String findingId = "findingId439150212";
Finding finding = Finding.newBuilder().build();
Finding response = securityCenterClient.createFinding(parent, findingId, finding);
}
Parameters | |
---|---|
Name | Description |
parent | String Required. Resource name of the new finding's parent. Its format should be "organizations/[organization_id]/sources/[source_id]". |
findingId | String Required. Unique identifier provided by the client within the parent scope. |
finding | Finding Required. The Finding being created. The name and security_marks will be ignored as they are both output only fields on this resource. |
Returns | |
---|---|
Type | Description |
Finding |
createFindingCallable()
public final UnaryCallable<CreateFindingRequest,Finding> createFindingCallable()
Creates a finding. The corresponding source must exist for finding creation to succeed.
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (SecurityCenterClient securityCenterClient = SecurityCenterClient.create()) {
CreateFindingRequest request =
CreateFindingRequest.newBuilder()
.setParent(
SourceName.ofOrganizationSourceName("[ORGANIZATION]", "[SOURCE]").toString())
.setFindingId("findingId439150212")
.setFinding(Finding.newBuilder().build())
.build();
ApiFuture<Finding> future = securityCenterClient.createFindingCallable().futureCall(request);
// Do something.
Finding response = future.get();
}
Returns | |
---|---|
Type | Description |
UnaryCallable<CreateFindingRequest,Finding> |
createNotificationConfig(CreateNotificationConfigRequest request)
public final NotificationConfig createNotificationConfig(CreateNotificationConfigRequest request)
Creates a notification config.
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (SecurityCenterClient securityCenterClient = SecurityCenterClient.create()) {
CreateNotificationConfigRequest request =
CreateNotificationConfigRequest.newBuilder()
.setParent(OrganizationName.of("[ORGANIZATION]").toString())
.setConfigId("configId-580140035")
.setNotificationConfig(NotificationConfig.newBuilder().build())
.build();
NotificationConfig response = securityCenterClient.createNotificationConfig(request);
}
Parameter | |
---|---|
Name | Description |
request | CreateNotificationConfigRequest The request object containing all of the parameters for the API call. |
Returns | |
---|---|
Type | Description |
NotificationConfig |
createNotificationConfig(OrganizationName parent, NotificationConfig notificationConfig)
public final NotificationConfig createNotificationConfig(OrganizationName parent, NotificationConfig notificationConfig)
Creates a notification config.
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (SecurityCenterClient securityCenterClient = SecurityCenterClient.create()) {
OrganizationName parent = OrganizationName.of("[ORGANIZATION]");
NotificationConfig notificationConfig = NotificationConfig.newBuilder().build();
NotificationConfig response =
securityCenterClient.createNotificationConfig(parent, notificationConfig);
}
Parameters | |
---|---|
Name | Description |
parent | OrganizationName Required. Resource name of the new notification config's parent. Its format is "organizations/[organization_id]". |
notificationConfig | NotificationConfig Required. The notification config being created. The name and the service account will be ignored as they are both output only fields on this resource. |
Returns | |
---|---|
Type | Description |
NotificationConfig |
createNotificationConfig(OrganizationName parent, String configId, NotificationConfig notificationConfig)
public final NotificationConfig createNotificationConfig(OrganizationName parent, String configId, NotificationConfig notificationConfig)
Creates a notification config.
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (SecurityCenterClient securityCenterClient = SecurityCenterClient.create()) {
OrganizationName parent = OrganizationName.of("[ORGANIZATION]");
String configId = "configId-580140035";
NotificationConfig notificationConfig = NotificationConfig.newBuilder().build();
NotificationConfig response =
securityCenterClient.createNotificationConfig(parent, configId, notificationConfig);
}
Parameters | |
---|---|
Name | Description |
parent | OrganizationName Required. Resource name of the new notification config's parent. Its format is "organizations/[organization_id]". |
configId | String Required. Unique identifier provided by the client within the parent scope. It must be between 1 and 128 characters, and contains alphanumeric characters, underscores or hyphens only. |
notificationConfig | NotificationConfig Required. The notification config being created. The name and the service account will be ignored as they are both output only fields on this resource. |
Returns | |
---|---|
Type | Description |
NotificationConfig |
createNotificationConfig(String parent, NotificationConfig notificationConfig)
public final NotificationConfig createNotificationConfig(String parent, NotificationConfig notificationConfig)
Creates a notification config.
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (SecurityCenterClient securityCenterClient = SecurityCenterClient.create()) {
String parent = OrganizationName.of("[ORGANIZATION]").toString();
NotificationConfig notificationConfig = NotificationConfig.newBuilder().build();
NotificationConfig response =
securityCenterClient.createNotificationConfig(parent, notificationConfig);
}
Parameters | |
---|---|
Name | Description |
parent | String Required. Resource name of the new notification config's parent. Its format is "organizations/[organization_id]". |
notificationConfig | NotificationConfig Required. The notification config being created. The name and the service account will be ignored as they are both output only fields on this resource. |
Returns | |
---|---|
Type | Description |
NotificationConfig |
createNotificationConfig(String parent, String configId, NotificationConfig notificationConfig)
public final NotificationConfig createNotificationConfig(String parent, String configId, NotificationConfig notificationConfig)
Creates a notification config.
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (SecurityCenterClient securityCenterClient = SecurityCenterClient.create()) {
String parent = OrganizationName.of("[ORGANIZATION]").toString();
String configId = "configId-580140035";
NotificationConfig notificationConfig = NotificationConfig.newBuilder().build();
NotificationConfig response =
securityCenterClient.createNotificationConfig(parent, configId, notificationConfig);
}
Parameters | |
---|---|
Name | Description |
parent | String Required. Resource name of the new notification config's parent. Its format is "organizations/[organization_id]". |
configId | String Required. Unique identifier provided by the client within the parent scope. It must be between 1 and 128 characters, and contains alphanumeric characters, underscores or hyphens only. |
notificationConfig | NotificationConfig Required. The notification config being created. The name and the service account will be ignored as they are both output only fields on this resource. |
Returns | |
---|---|
Type | Description |
NotificationConfig |
createNotificationConfigCallable()
public final UnaryCallable<CreateNotificationConfigRequest,NotificationConfig> createNotificationConfigCallable()
Creates a notification config.
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (SecurityCenterClient securityCenterClient = SecurityCenterClient.create()) {
CreateNotificationConfigRequest request =
CreateNotificationConfigRequest.newBuilder()
.setParent(OrganizationName.of("[ORGANIZATION]").toString())
.setConfigId("configId-580140035")
.setNotificationConfig(NotificationConfig.newBuilder().build())
.build();
ApiFuture<NotificationConfig> future =
securityCenterClient.createNotificationConfigCallable().futureCall(request);
// Do something.
NotificationConfig response = future.get();
}
Returns | |
---|---|
Type | Description |
UnaryCallable<CreateNotificationConfigRequest,NotificationConfig> |
createSource(CreateSourceRequest request)
public final Source createSource(CreateSourceRequest request)
Creates a source.
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (SecurityCenterClient securityCenterClient = SecurityCenterClient.create()) {
CreateSourceRequest request =
CreateSourceRequest.newBuilder()
.setParent(OrganizationName.of("[ORGANIZATION]").toString())
.setSource(Source.newBuilder().build())
.build();
Source response = securityCenterClient.createSource(request);
}
Parameter | |
---|---|
Name | Description |
request | CreateSourceRequest The request object containing all of the parameters for the API call. |
Returns | |
---|---|
Type | Description |
Source |
createSource(OrganizationName parent, Source source)
public final Source createSource(OrganizationName parent, Source source)
Creates a source.
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (SecurityCenterClient securityCenterClient = SecurityCenterClient.create()) {
OrganizationName parent = OrganizationName.of("[ORGANIZATION]");
Source source = Source.newBuilder().build();
Source response = securityCenterClient.createSource(parent, source);
}
Parameters | |
---|---|
Name | Description |
parent | OrganizationName Required. Resource name of the new source's parent. Its format should be "organizations/[organization_id]". |
source | Source Required. The Source being created, only the display_name and description will be used. All other fields will be ignored. |
Returns | |
---|---|
Type | Description |
Source |
createSource(String parent, Source source)
public final Source createSource(String parent, Source source)
Creates a source.
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (SecurityCenterClient securityCenterClient = SecurityCenterClient.create()) {
String parent = OrganizationName.of("[ORGANIZATION]").toString();
Source source = Source.newBuilder().build();
Source response = securityCenterClient.createSource(parent, source);
}
Parameters | |
---|---|
Name | Description |
parent | String Required. Resource name of the new source's parent. Its format should be "organizations/[organization_id]". |
source | Source Required. The Source being created, only the display_name and description will be used. All other fields will be ignored. |
Returns | |
---|---|
Type | Description |
Source |
createSourceCallable()
public final UnaryCallable<CreateSourceRequest,Source> createSourceCallable()
Creates a source.
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (SecurityCenterClient securityCenterClient = SecurityCenterClient.create()) {
CreateSourceRequest request =
CreateSourceRequest.newBuilder()
.setParent(OrganizationName.of("[ORGANIZATION]").toString())
.setSource(Source.newBuilder().build())
.build();
ApiFuture<Source> future = securityCenterClient.createSourceCallable().futureCall(request);
// Do something.
Source response = future.get();
}
Returns | |
---|---|
Type | Description |
UnaryCallable<CreateSourceRequest,Source> |
deleteNotificationConfig(DeleteNotificationConfigRequest request)
public final void deleteNotificationConfig(DeleteNotificationConfigRequest request)
Deletes a notification config.
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (SecurityCenterClient securityCenterClient = SecurityCenterClient.create()) {
DeleteNotificationConfigRequest request =
DeleteNotificationConfigRequest.newBuilder()
.setName(
NotificationConfigName.of("[ORGANIZATION]", "[NOTIFICATION_CONFIG]").toString())
.build();
securityCenterClient.deleteNotificationConfig(request);
}
Parameter | |
---|---|
Name | Description |
request | DeleteNotificationConfigRequest The request object containing all of the parameters for the API call. |
deleteNotificationConfig(NotificationConfigName name)
public final void deleteNotificationConfig(NotificationConfigName name)
Deletes a notification config.
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (SecurityCenterClient securityCenterClient = SecurityCenterClient.create()) {
NotificationConfigName name =
NotificationConfigName.of("[ORGANIZATION]", "[NOTIFICATION_CONFIG]");
securityCenterClient.deleteNotificationConfig(name);
}
Parameter | |
---|---|
Name | Description |
name | NotificationConfigName Required. Name of the notification config to delete. Its format is "organizations/[organization_id]/notificationConfigs/[config_id]". |
deleteNotificationConfig(String name)
public final void deleteNotificationConfig(String name)
Deletes a notification config.
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (SecurityCenterClient securityCenterClient = SecurityCenterClient.create()) {
String name = NotificationConfigName.of("[ORGANIZATION]", "[NOTIFICATION_CONFIG]").toString();
securityCenterClient.deleteNotificationConfig(name);
}
Parameter | |
---|---|
Name | Description |
name | String Required. Name of the notification config to delete. Its format is "organizations/[organization_id]/notificationConfigs/[config_id]". |
deleteNotificationConfigCallable()
public final UnaryCallable<DeleteNotificationConfigRequest,Empty> deleteNotificationConfigCallable()
Deletes a notification config.
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (SecurityCenterClient securityCenterClient = SecurityCenterClient.create()) {
DeleteNotificationConfigRequest request =
DeleteNotificationConfigRequest.newBuilder()
.setName(
NotificationConfigName.of("[ORGANIZATION]", "[NOTIFICATION_CONFIG]").toString())
.build();
ApiFuture<Empty> future =
securityCenterClient.deleteNotificationConfigCallable().futureCall(request);
// Do something.
future.get();
}
Returns | |
---|---|
Type | Description |
UnaryCallable<DeleteNotificationConfigRequest,Empty> |
getHttpJsonOperationsClient()
public final OperationsClient getHttpJsonOperationsClient()
Returns the OperationsClient that can be used to query the status of a long-running operation returned by another API method call.
Returns | |
---|---|
Type | Description |
OperationsClient |
getIamPolicy(ResourceName resource)
public final Policy getIamPolicy(ResourceName resource)
Gets the access control policy on the specified Source.
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (SecurityCenterClient securityCenterClient = SecurityCenterClient.create()) {
ResourceName resource = SourceName.ofOrganizationSourceName("[ORGANIZATION]", "[SOURCE]");
Policy response = securityCenterClient.getIamPolicy(resource);
}
Parameter | |
---|---|
Name | Description |
resource | com.google.api.resourcenames.ResourceName REQUIRED: The resource for which the policy is being requested. See the operation documentation for the appropriate value for this field. |
Returns | |
---|---|
Type | Description |
com.google.iam.v1.Policy |
getIamPolicy(GetIamPolicyRequest request)
public final Policy getIamPolicy(GetIamPolicyRequest request)
Gets the access control policy on the specified Source.
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (SecurityCenterClient securityCenterClient = SecurityCenterClient.create()) {
GetIamPolicyRequest request =
GetIamPolicyRequest.newBuilder()
.setResource(
SourceName.ofOrganizationSourceName("[ORGANIZATION]", "[SOURCE]").toString())
.setOptions(GetPolicyOptions.newBuilder().build())
.build();
Policy response = securityCenterClient.getIamPolicy(request);
}
Parameter | |
---|---|
Name | Description |
request | com.google.iam.v1.GetIamPolicyRequest The request object containing all of the parameters for the API call. |
Returns | |
---|---|
Type | Description |
com.google.iam.v1.Policy |
getIamPolicy(String resource)
public final Policy getIamPolicy(String resource)
Gets the access control policy on the specified Source.
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (SecurityCenterClient securityCenterClient = SecurityCenterClient.create()) {
String resource = FolderName.of("[FOLDER]").toString();
Policy response = securityCenterClient.getIamPolicy(resource);
}
Parameter | |
---|---|
Name | Description |
resource | String REQUIRED: The resource for which the policy is being requested. See the operation documentation for the appropriate value for this field. |
Returns | |
---|---|
Type | Description |
com.google.iam.v1.Policy |
getIamPolicyCallable()
public final UnaryCallable<GetIamPolicyRequest,Policy> getIamPolicyCallable()
Gets the access control policy on the specified Source.
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (SecurityCenterClient securityCenterClient = SecurityCenterClient.create()) {
GetIamPolicyRequest request =
GetIamPolicyRequest.newBuilder()
.setResource(
SourceName.ofOrganizationSourceName("[ORGANIZATION]", "[SOURCE]").toString())
.setOptions(GetPolicyOptions.newBuilder().build())
.build();
ApiFuture<Policy> future = securityCenterClient.getIamPolicyCallable().futureCall(request);
// Do something.
Policy response = future.get();
}
Returns | |
---|---|
Type | Description |
UnaryCallable<com.google.iam.v1.GetIamPolicyRequest,com.google.iam.v1.Policy> |
getNotificationConfig(GetNotificationConfigRequest request)
public final NotificationConfig getNotificationConfig(GetNotificationConfigRequest request)
Gets a notification config.
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (SecurityCenterClient securityCenterClient = SecurityCenterClient.create()) {
GetNotificationConfigRequest request =
GetNotificationConfigRequest.newBuilder()
.setName(
NotificationConfigName.of("[ORGANIZATION]", "[NOTIFICATION_CONFIG]").toString())
.build();
NotificationConfig response = securityCenterClient.getNotificationConfig(request);
}
Parameter | |
---|---|
Name | Description |
request | GetNotificationConfigRequest The request object containing all of the parameters for the API call. |
Returns | |
---|---|
Type | Description |
NotificationConfig |
getNotificationConfig(NotificationConfigName name)
public final NotificationConfig getNotificationConfig(NotificationConfigName name)
Gets a notification config.
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (SecurityCenterClient securityCenterClient = SecurityCenterClient.create()) {
NotificationConfigName name =
NotificationConfigName.of("[ORGANIZATION]", "[NOTIFICATION_CONFIG]");
NotificationConfig response = securityCenterClient.getNotificationConfig(name);
}
Parameter | |
---|---|
Name | Description |
name | NotificationConfigName Required. Name of the notification config to get. Its format is "organizations/[organization_id]/notificationConfigs/[config_id]". |
Returns | |
---|---|
Type | Description |
NotificationConfig |
getNotificationConfig(String name)
public final NotificationConfig getNotificationConfig(String name)
Gets a notification config.
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (SecurityCenterClient securityCenterClient = SecurityCenterClient.create()) {
String name = NotificationConfigName.of("[ORGANIZATION]", "[NOTIFICATION_CONFIG]").toString();
NotificationConfig response = securityCenterClient.getNotificationConfig(name);
}
Parameter | |
---|---|
Name | Description |
name | String Required. Name of the notification config to get. Its format is "organizations/[organization_id]/notificationConfigs/[config_id]". |
Returns | |
---|---|
Type | Description |
NotificationConfig |
getNotificationConfigCallable()
public final UnaryCallable<GetNotificationConfigRequest,NotificationConfig> getNotificationConfigCallable()
Gets a notification config.
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (SecurityCenterClient securityCenterClient = SecurityCenterClient.create()) {
GetNotificationConfigRequest request =
GetNotificationConfigRequest.newBuilder()
.setName(
NotificationConfigName.of("[ORGANIZATION]", "[NOTIFICATION_CONFIG]").toString())
.build();
ApiFuture<NotificationConfig> future =
securityCenterClient.getNotificationConfigCallable().futureCall(request);
// Do something.
NotificationConfig response = future.get();
}
Returns | |
---|---|
Type | Description |
UnaryCallable<GetNotificationConfigRequest,NotificationConfig> |
getOperationsClient()
public final OperationsClient getOperationsClient()
Returns the OperationsClient that can be used to query the status of a long-running operation returned by another API method call.
Returns | |
---|---|
Type | Description |
OperationsClient |
getOrganizationSettings(GetOrganizationSettingsRequest request)
public final OrganizationSettings getOrganizationSettings(GetOrganizationSettingsRequest request)
Gets the settings for an organization.
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (SecurityCenterClient securityCenterClient = SecurityCenterClient.create()) {
GetOrganizationSettingsRequest request =
GetOrganizationSettingsRequest.newBuilder()
.setName(OrganizationSettingsName.of("[ORGANIZATION]").toString())
.build();
OrganizationSettings response = securityCenterClient.getOrganizationSettings(request);
}
Parameter | |
---|---|
Name | Description |
request | GetOrganizationSettingsRequest The request object containing all of the parameters for the API call. |
Returns | |
---|---|
Type | Description |
OrganizationSettings |
getOrganizationSettings(OrganizationSettingsName name)
public final OrganizationSettings getOrganizationSettings(OrganizationSettingsName name)
Gets the settings for an organization.
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (SecurityCenterClient securityCenterClient = SecurityCenterClient.create()) {
OrganizationSettingsName name = OrganizationSettingsName.of("[ORGANIZATION]");
OrganizationSettings response = securityCenterClient.getOrganizationSettings(name);
}
Parameter | |
---|---|
Name | Description |
name | OrganizationSettingsName Required. Name of the organization to get organization settings for. Its format is "organizations/[organization_id]/organizationSettings". |
Returns | |
---|---|
Type | Description |
OrganizationSettings |
getOrganizationSettings(String name)
public final OrganizationSettings getOrganizationSettings(String name)
Gets the settings for an organization.
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (SecurityCenterClient securityCenterClient = SecurityCenterClient.create()) {
String name = OrganizationSettingsName.of("[ORGANIZATION]").toString();
OrganizationSettings response = securityCenterClient.getOrganizationSettings(name);
}
Parameter | |
---|---|
Name | Description |
name | String Required. Name of the organization to get organization settings for. Its format is "organizations/[organization_id]/organizationSettings". |
Returns | |
---|---|
Type | Description |
OrganizationSettings |
getOrganizationSettingsCallable()
public final UnaryCallable<GetOrganizationSettingsRequest,OrganizationSettings> getOrganizationSettingsCallable()
Gets the settings for an organization.
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (SecurityCenterClient securityCenterClient = SecurityCenterClient.create()) {
GetOrganizationSettingsRequest request =
GetOrganizationSettingsRequest.newBuilder()
.setName(OrganizationSettingsName.of("[ORGANIZATION]").toString())
.build();
ApiFuture<OrganizationSettings> future =
securityCenterClient.getOrganizationSettingsCallable().futureCall(request);
// Do something.
OrganizationSettings response = future.get();
}
Returns | |
---|---|
Type | Description |
UnaryCallable<GetOrganizationSettingsRequest,OrganizationSettings> |
getSettings()
public final SecurityCenterSettings getSettings()
Returns | |
---|---|
Type | Description |
SecurityCenterSettings |
getSource(GetSourceRequest request)
public final Source getSource(GetSourceRequest request)
Gets a source.
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (SecurityCenterClient securityCenterClient = SecurityCenterClient.create()) {
GetSourceRequest request =
GetSourceRequest.newBuilder()
.setName(SourceName.ofOrganizationSourceName("[ORGANIZATION]", "[SOURCE]").toString())
.build();
Source response = securityCenterClient.getSource(request);
}
Parameter | |
---|---|
Name | Description |
request | GetSourceRequest The request object containing all of the parameters for the API call. |
Returns | |
---|---|
Type | Description |
Source |
getSource(SourceName name)
public final Source getSource(SourceName name)
Gets a source.
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (SecurityCenterClient securityCenterClient = SecurityCenterClient.create()) {
SourceName name = SourceName.ofOrganizationSourceName("[ORGANIZATION]", "[SOURCE]");
Source response = securityCenterClient.getSource(name);
}
Parameter | |
---|---|
Name | Description |
name | SourceName Required. Relative resource name of the source. Its format is "organizations/[organization_id]/source/[source_id]". |
Returns | |
---|---|
Type | Description |
Source |
getSource(String name)
public final Source getSource(String name)
Gets a source.
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (SecurityCenterClient securityCenterClient = SecurityCenterClient.create()) {
String name = SourceName.ofOrganizationSourceName("[ORGANIZATION]", "[SOURCE]").toString();
Source response = securityCenterClient.getSource(name);
}
Parameter | |
---|---|
Name | Description |
name | String Required. Relative resource name of the source. Its format is "organizations/[organization_id]/source/[source_id]". |
Returns | |
---|---|
Type | Description |
Source |
getSourceCallable()
public final UnaryCallable<GetSourceRequest,Source> getSourceCallable()
Gets a source.
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (SecurityCenterClient securityCenterClient = SecurityCenterClient.create()) {
GetSourceRequest request =
GetSourceRequest.newBuilder()
.setName(SourceName.ofOrganizationSourceName("[ORGANIZATION]", "[SOURCE]").toString())
.build();
ApiFuture<Source> future = securityCenterClient.getSourceCallable().futureCall(request);
// Do something.
Source response = future.get();
}
Returns | |
---|---|
Type | Description |
UnaryCallable<GetSourceRequest,Source> |
getStub()
public SecurityCenterStub getStub()
Returns | |
---|---|
Type | Description |
SecurityCenterStub |
groupAssets(GroupAssetsRequest request)
public final SecurityCenterClient.GroupAssetsPagedResponse groupAssets(GroupAssetsRequest request)
Filters an organization's assets and groups them by their specified properties.
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (SecurityCenterClient securityCenterClient = SecurityCenterClient.create()) {
GroupAssetsRequest request =
GroupAssetsRequest.newBuilder()
.setParent(OrganizationName.of("[ORGANIZATION]").toString())
.setFilter("filter-1274492040")
.setGroupBy("groupBy293428022")
.setCompareDuration(Duration.newBuilder().build())
.setReadTime(Timestamp.newBuilder().build())
.setPageToken("pageToken873572522")
.setPageSize(883849137)
.build();
for (GroupResult element : securityCenterClient.groupAssets(request).iterateAll()) {
// doThingsWith(element);
}
}
Parameter | |
---|---|
Name | Description |
request | GroupAssetsRequest The request object containing all of the parameters for the API call. |
Returns | |
---|---|
Type | Description |
SecurityCenterClient.GroupAssetsPagedResponse |
groupAssetsCallable()
public final UnaryCallable<GroupAssetsRequest,GroupAssetsResponse> groupAssetsCallable()
Filters an organization's assets and groups them by their specified properties.
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (SecurityCenterClient securityCenterClient = SecurityCenterClient.create()) {
GroupAssetsRequest request =
GroupAssetsRequest.newBuilder()
.setParent(OrganizationName.of("[ORGANIZATION]").toString())
.setFilter("filter-1274492040")
.setGroupBy("groupBy293428022")
.setCompareDuration(Duration.newBuilder().build())
.setReadTime(Timestamp.newBuilder().build())
.setPageToken("pageToken873572522")
.setPageSize(883849137)
.build();
while (true) {
GroupAssetsResponse response = securityCenterClient.groupAssetsCallable().call(request);
for (GroupResult element : response.getGroupByResultsList()) {
// doThingsWith(element);
}
String nextPageToken = response.getNextPageToken();
if (!Strings.isNullOrEmpty(nextPageToken)) {
request = request.toBuilder().setPageToken(nextPageToken).build();
} else {
break;
}
}
}
Returns | |
---|---|
Type | Description |
UnaryCallable<GroupAssetsRequest,GroupAssetsResponse> |
groupAssetsPagedCallable()
public final UnaryCallable<GroupAssetsRequest,SecurityCenterClient.GroupAssetsPagedResponse> groupAssetsPagedCallable()
Filters an organization's assets and groups them by their specified properties.
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (SecurityCenterClient securityCenterClient = SecurityCenterClient.create()) {
GroupAssetsRequest request =
GroupAssetsRequest.newBuilder()
.setParent(OrganizationName.of("[ORGANIZATION]").toString())
.setFilter("filter-1274492040")
.setGroupBy("groupBy293428022")
.setCompareDuration(Duration.newBuilder().build())
.setReadTime(Timestamp.newBuilder().build())
.setPageToken("pageToken873572522")
.setPageSize(883849137)
.build();
ApiFuture<GroupResult> future =
securityCenterClient.groupAssetsPagedCallable().futureCall(request);
// Do something.
for (GroupResult element : future.get().iterateAll()) {
// doThingsWith(element);
}
}
Returns | |
---|---|
Type | Description |
UnaryCallable<GroupAssetsRequest,GroupAssetsPagedResponse> |
groupFindings(GroupFindingsRequest request)
public final SecurityCenterClient.GroupFindingsPagedResponse groupFindings(GroupFindingsRequest request)
Filters an organization or source's findings and groups them by their specified properties.
To group across all sources provide a -
as the source id. Example:
/v1/organizations/{organization_id}/sources/-/findings,
/v1/folders/{folder_id}/sources/-/findings, /v1/projects/{project_id}/sources/-/findings
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (SecurityCenterClient securityCenterClient = SecurityCenterClient.create()) {
GroupFindingsRequest request =
GroupFindingsRequest.newBuilder()
.setParent(
SourceName.ofOrganizationSourceName("[ORGANIZATION]", "[SOURCE]").toString())
.setFilter("filter-1274492040")
.setGroupBy("groupBy293428022")
.setReadTime(Timestamp.newBuilder().build())
.setCompareDuration(Duration.newBuilder().build())
.setPageToken("pageToken873572522")
.setPageSize(883849137)
.build();
for (GroupResult element : securityCenterClient.groupFindings(request).iterateAll()) {
// doThingsWith(element);
}
}
Parameter | |
---|---|
Name | Description |
request | GroupFindingsRequest The request object containing all of the parameters for the API call. |
Returns | |
---|---|
Type | Description |
SecurityCenterClient.GroupFindingsPagedResponse |
groupFindings(SourceName parent, String groupBy)
public final SecurityCenterClient.GroupFindingsPagedResponse groupFindings(SourceName parent, String groupBy)
Filters an organization or source's findings and groups them by their specified properties.
To group across all sources provide a -
as the source id. Example:
/v1/organizations/{organization_id}/sources/-/findings,
/v1/folders/{folder_id}/sources/-/findings, /v1/projects/{project_id}/sources/-/findings
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (SecurityCenterClient securityCenterClient = SecurityCenterClient.create()) {
SourceName parent = SourceName.ofOrganizationSourceName("[ORGANIZATION]", "[SOURCE]");
String groupBy = "groupBy293428022";
for (GroupResult element : securityCenterClient.groupFindings(parent, groupBy).iterateAll()) {
// doThingsWith(element);
}
}
Parameters | |
---|---|
Name | Description |
parent | SourceName Required. Name of the source to groupBy. Its format is
"organizations/[organization_id]/sources/[source_id]",
folders/[folder_id]/sources/[source_id], or projects/[project_id]/sources/[source_id]. To
groupBy across all sources provide a source_id of |
groupBy | String Required. Expression that defines what assets fields to use for grouping
(including The following fields are supported:
The following fields are supported when compare_duration is set:
|
Returns | |
---|---|
Type | Description |
SecurityCenterClient.GroupFindingsPagedResponse |
groupFindings(String parent, String groupBy)
public final SecurityCenterClient.GroupFindingsPagedResponse groupFindings(String parent, String groupBy)
Filters an organization or source's findings and groups them by their specified properties.
To group across all sources provide a -
as the source id. Example:
/v1/organizations/{organization_id}/sources/-/findings,
/v1/folders/{folder_id}/sources/-/findings, /v1/projects/{project_id}/sources/-/findings
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (SecurityCenterClient securityCenterClient = SecurityCenterClient.create()) {
String parent = SourceName.ofOrganizationSourceName("[ORGANIZATION]", "[SOURCE]").toString();
String groupBy = "groupBy293428022";
for (GroupResult element : securityCenterClient.groupFindings(parent, groupBy).iterateAll()) {
// doThingsWith(element);
}
}
Parameters | |
---|---|
Name | Description |
parent | String Required. Name of the source to groupBy. Its format is
"organizations/[organization_id]/sources/[source_id]",
folders/[folder_id]/sources/[source_id], or projects/[project_id]/sources/[source_id]. To
groupBy across all sources provide a source_id of |
groupBy | String Required. Expression that defines what assets fields to use for grouping
(including The following fields are supported:
The following fields are supported when compare_duration is set:
|
Returns | |
---|---|
Type | Description |
SecurityCenterClient.GroupFindingsPagedResponse |
groupFindingsCallable()
public final UnaryCallable<GroupFindingsRequest,GroupFindingsResponse> groupFindingsCallable()
Filters an organization or source's findings and groups them by their specified properties.
To group across all sources provide a -
as the source id. Example:
/v1/organizations/{organization_id}/sources/-/findings,
/v1/folders/{folder_id}/sources/-/findings, /v1/projects/{project_id}/sources/-/findings
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (SecurityCenterClient securityCenterClient = SecurityCenterClient.create()) {
GroupFindingsRequest request =
GroupFindingsRequest.newBuilder()
.setParent(
SourceName.ofOrganizationSourceName("[ORGANIZATION]", "[SOURCE]").toString())
.setFilter("filter-1274492040")
.setGroupBy("groupBy293428022")
.setReadTime(Timestamp.newBuilder().build())
.setCompareDuration(Duration.newBuilder().build())
.setPageToken("pageToken873572522")
.setPageSize(883849137)
.build();
while (true) {
GroupFindingsResponse response = securityCenterClient.groupFindingsCallable().call(request);
for (GroupResult element : response.getGroupByResultsList()) {
// doThingsWith(element);
}
String nextPageToken = response.getNextPageToken();
if (!Strings.isNullOrEmpty(nextPageToken)) {
request = request.toBuilder().setPageToken(nextPageToken).build();
} else {
break;
}
}
}
Returns | |
---|---|
Type | Description |
UnaryCallable<GroupFindingsRequest,GroupFindingsResponse> |
groupFindingsPagedCallable()
public final UnaryCallable<GroupFindingsRequest,SecurityCenterClient.GroupFindingsPagedResponse> groupFindingsPagedCallable()
Filters an organization or source's findings and groups them by their specified properties.
To group across all sources provide a -
as the source id. Example:
/v1/organizations/{organization_id}/sources/-/findings,