- 2.62.0 (latest)
- 2.61.0
- 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: V1 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()) {
SecurityHealthAnalyticsSettingsName parent =
SecurityHealthAnalyticsSettingsName.ofOrganizationName("[ORGANIZATION]");
SecurityHealthAnalyticsCustomModule securityHealthAnalyticsCustomModule =
SecurityHealthAnalyticsCustomModule.newBuilder().build();
SecurityHealthAnalyticsCustomModule response =
securityCenterClient.createSecurityHealthAnalyticsCustomModule(
parent, securityHealthAnalyticsCustomModule);
}
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 |
bulkMuteFindingsAsync(ResourceName parent)
public final OperationFuture<BulkMuteFindingsResponse,Empty> bulkMuteFindingsAsync(ResourceName parent)
Kicks off an LRO to bulk mute findings for a parent based on a filter. The parent can be either an organization, folder or project. The findings matched by the filter will be muted after the LRO is done.
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 parent = FolderName.of("[FOLDER]");
BulkMuteFindingsResponse response = securityCenterClient.bulkMuteFindingsAsync(parent).get();
}
Parameter | |
---|---|
Name | Description |
parent | com.google.api.resourcenames.ResourceName Required. The parent, at which bulk action needs to be applied. Its format is "organizations/[organization_id]", "folders/[folder_id]", "projects/[project_id]". |
Returns | |
---|---|
Type | Description |
OperationFuture<BulkMuteFindingsResponse,Empty> |
bulkMuteFindingsAsync(BulkMuteFindingsRequest request)
public final OperationFuture<BulkMuteFindingsResponse,Empty> bulkMuteFindingsAsync(BulkMuteFindingsRequest request)
Kicks off an LRO to bulk mute findings for a parent based on a filter. The parent can be either an organization, folder or project. The findings matched by the filter will be muted after the LRO is done.
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()) {
BulkMuteFindingsRequest request =
BulkMuteFindingsRequest.newBuilder()
.setParent(FolderName.of("[FOLDER]").toString())
.setFilter("filter-1274492040")
.setMuteAnnotation("muteAnnotation-2111042008")
.build();
BulkMuteFindingsResponse response = securityCenterClient.bulkMuteFindingsAsync(request).get();
}
Parameter | |
---|---|
Name | Description |
request | BulkMuteFindingsRequest The request object containing all of the parameters for the API call. |
Returns | |
---|---|
Type | Description |
OperationFuture<BulkMuteFindingsResponse,Empty> |
bulkMuteFindingsAsync(String parent)
public final OperationFuture<BulkMuteFindingsResponse,Empty> bulkMuteFindingsAsync(String parent)
Kicks off an LRO to bulk mute findings for a parent based on a filter. The parent can be either an organization, folder or project. The findings matched by the filter will be muted after the LRO is done.
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 = FolderName.of("[FOLDER]").toString();
BulkMuteFindingsResponse response = securityCenterClient.bulkMuteFindingsAsync(parent).get();
}
Parameter | |
---|---|
Name | Description |
parent | String Required. The parent, at which bulk action needs to be applied. Its format is "organizations/[organization_id]", "folders/[folder_id]", "projects/[project_id]". |
Returns | |
---|---|
Type | Description |
OperationFuture<BulkMuteFindingsResponse,Empty> |
bulkMuteFindingsCallable()
public final UnaryCallable<BulkMuteFindingsRequest,Operation> bulkMuteFindingsCallable()
Kicks off an LRO to bulk mute findings for a parent based on a filter. The parent can be either an organization, folder or project. The findings matched by the filter will be muted after the LRO is done.
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()) {
BulkMuteFindingsRequest request =
BulkMuteFindingsRequest.newBuilder()
.setParent(FolderName.of("[FOLDER]").toString())
.setFilter("filter-1274492040")
.setMuteAnnotation("muteAnnotation-2111042008")
.build();
ApiFuture<Operation> future =
securityCenterClient.bulkMuteFindingsCallable().futureCall(request);
// Do something.
Operation response = future.get();
}
Returns | |
---|---|
Type | Description |
UnaryCallable<BulkMuteFindingsRequest,Operation> |
bulkMuteFindingsOperationCallable()
public final OperationCallable<BulkMuteFindingsRequest,BulkMuteFindingsResponse,Empty> bulkMuteFindingsOperationCallable()
Kicks off an LRO to bulk mute findings for a parent based on a filter. The parent can be either an organization, folder or project. The findings matched by the filter will be muted after the LRO is done.
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()) {
BulkMuteFindingsRequest request =
BulkMuteFindingsRequest.newBuilder()
.setParent(FolderName.of("[FOLDER]").toString())
.setFilter("filter-1274492040")
.setMuteAnnotation("muteAnnotation-2111042008")
.build();
OperationFuture<BulkMuteFindingsResponse, Empty> future =
securityCenterClient.bulkMuteFindingsOperationCallable().futureCall(request);
// Do something.
BulkMuteFindingsResponse response = future.get();
}
Returns | |
---|---|
Type | Description |
OperationCallable<BulkMuteFindingsRequest,BulkMuteFindingsResponse,Empty> |
close()
public final void close()
createBigQueryExport(CreateBigQueryExportRequest request)
public final BigQueryExport createBigQueryExport(CreateBigQueryExportRequest request)
Creates a BigQuery export.
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()) {
CreateBigQueryExportRequest request =
CreateBigQueryExportRequest.newBuilder()
.setParent(OrganizationName.of("[ORGANIZATION]").toString())
.setBigQueryExport(BigQueryExport.newBuilder().build())
.setBigQueryExportId("bigQueryExportId1024198583")
.build();
BigQueryExport response = securityCenterClient.createBigQueryExport(request);
}
Parameter | |
---|---|
Name | Description |
request | CreateBigQueryExportRequest The request object containing all of the parameters for the API call. |
Returns | |
---|---|
Type | Description |
BigQueryExport |
createBigQueryExport(FolderName parent, BigQueryExport bigQueryExport, String bigQueryExportId)
public final BigQueryExport createBigQueryExport(FolderName parent, BigQueryExport bigQueryExport, String bigQueryExportId)
Creates a BigQuery export.
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()) {
FolderName parent = FolderName.of("[FOLDER]");
BigQueryExport bigQueryExport = BigQueryExport.newBuilder().build();
String bigQueryExportId = "bigQueryExportId1024198583";
BigQueryExport response =
securityCenterClient.createBigQueryExport(parent, bigQueryExport, bigQueryExportId);
}
Parameters | |
---|---|
Name | Description |
parent | FolderName Required. The name of the parent resource of the new BigQuery export. Its format is "organizations/[organization_id]", "folders/[folder_id]", or "projects/[project_id]". |
bigQueryExport | BigQueryExport Required. The BigQuery export being created. |
bigQueryExportId | String Required. Unique identifier provided by the client within the parent scope. It must consist of only lowercase letters, numbers, and hyphens, must start with a letter, must end with either a letter or a number, and must be 63 characters or less. |
Returns | |
---|---|
Type | Description |
BigQueryExport |
createBigQueryExport(OrganizationName parent, BigQueryExport bigQueryExport, String bigQueryExportId)
public final BigQueryExport createBigQueryExport(OrganizationName parent, BigQueryExport bigQueryExport, String bigQueryExportId)
Creates a BigQuery export.
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]");
BigQueryExport bigQueryExport = BigQueryExport.newBuilder().build();
String bigQueryExportId = "bigQueryExportId1024198583";
BigQueryExport response =
securityCenterClient.createBigQueryExport(parent, bigQueryExport, bigQueryExportId);
}
Parameters | |
---|---|
Name | Description |
parent | OrganizationName Required. The name of the parent resource of the new BigQuery export. Its format is "organizations/[organization_id]", "folders/[folder_id]", or "projects/[project_id]". |
bigQueryExport | BigQueryExport Required. The BigQuery export being created. |
bigQueryExportId | String Required. Unique identifier provided by the client within the parent scope. It must consist of only lowercase letters, numbers, and hyphens, must start with a letter, must end with either a letter or a number, and must be 63 characters or less. |
Returns | |
---|---|
Type | Description |
BigQueryExport |
createBigQueryExport(ProjectName parent, BigQueryExport bigQueryExport, String bigQueryExportId)
public final BigQueryExport createBigQueryExport(ProjectName parent, BigQueryExport bigQueryExport, String bigQueryExportId)
Creates a BigQuery export.
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()) {
ProjectName parent = ProjectName.of("[PROJECT]");
BigQueryExport bigQueryExport = BigQueryExport.newBuilder().build();
String bigQueryExportId = "bigQueryExportId1024198583";
BigQueryExport response =
securityCenterClient.createBigQueryExport(parent, bigQueryExport, bigQueryExportId);
}
Parameters | |
---|---|
Name | Description |
parent | ProjectName Required. The name of the parent resource of the new BigQuery export. Its format is "organizations/[organization_id]", "folders/[folder_id]", or "projects/[project_id]". |
bigQueryExport | BigQueryExport Required. The BigQuery export being created. |
bigQueryExportId | String Required. Unique identifier provided by the client within the parent scope. It must consist of only lowercase letters, numbers, and hyphens, must start with a letter, must end with either a letter or a number, and must be 63 characters or less. |
Returns | |
---|---|
Type | Description |
BigQueryExport |
createBigQueryExport(String parent, BigQueryExport bigQueryExport, String bigQueryExportId)
public final BigQueryExport createBigQueryExport(String parent, BigQueryExport bigQueryExport, String bigQueryExportId)
Creates a BigQuery export.
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();
BigQueryExport bigQueryExport = BigQueryExport.newBuilder().build();
String bigQueryExportId = "bigQueryExportId1024198583";
BigQueryExport response =
securityCenterClient.createBigQueryExport(parent, bigQueryExport, bigQueryExportId);
}
Parameters | |
---|---|
Name | Description |
parent | String Required. The name of the parent resource of the new BigQuery export. Its format is "organizations/[organization_id]", "folders/[folder_id]", or "projects/[project_id]". |
bigQueryExport | BigQueryExport Required. The BigQuery export being created. |
bigQueryExportId | String Required. Unique identifier provided by the client within the parent scope. It must consist of only lowercase letters, numbers, and hyphens, must start with a letter, must end with either a letter or a number, and must be 63 characters or less. |
Returns | |
---|---|
Type | Description |
BigQueryExport |
createBigQueryExportCallable()
public final UnaryCallable<CreateBigQueryExportRequest,BigQueryExport> createBigQueryExportCallable()
Creates a BigQuery export.
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()) {
CreateBigQueryExportRequest request =
CreateBigQueryExportRequest.newBuilder()
.setParent(OrganizationName.of("[ORGANIZATION]").toString())
.setBigQueryExport(BigQueryExport.newBuilder().build())
.setBigQueryExportId("bigQueryExportId1024198583")
.build();
ApiFuture<BigQueryExport> future =
securityCenterClient.createBigQueryExportCallable().futureCall(request);
// Do something.
BigQueryExport response = future.get();
}
Returns | |
---|---|
Type | Description |
UnaryCallable<CreateBigQueryExportRequest,BigQueryExport> |
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, 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. It must be alphanumeric and less than or equal to 32 characters and greater than 0 characters in length. |
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, 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. It must be alphanumeric and less than or equal to 32 characters and greater than 0 characters in length. |
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> |
createMuteConfig(CreateMuteConfigRequest request)
public final MuteConfig createMuteConfig(CreateMuteConfigRequest request)
Creates a mute 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()) {
CreateMuteConfigRequest request =
CreateMuteConfigRequest.newBuilder()
.setParent(OrganizationName.of("[ORGANIZATION]").toString())
.setMuteConfig(MuteConfig.newBuilder().build())
.setMuteConfigId("muteConfigId1689669942")
.build();
MuteConfig response = securityCenterClient.createMuteConfig(request);
}
Parameter | |
---|---|
Name | Description |
request | CreateMuteConfigRequest The request object containing all of the parameters for the API call. |
Returns | |
---|---|
Type | Description |
MuteConfig |
createMuteConfig(FolderName parent, MuteConfig muteConfig)
public final MuteConfig createMuteConfig(FolderName parent, MuteConfig muteConfig)
Creates a mute 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()) {
FolderName parent = FolderName.of("[FOLDER]");
MuteConfig muteConfig = MuteConfig.newBuilder().build();
MuteConfig response = securityCenterClient.createMuteConfig(parent, muteConfig);
}
Parameters | |
---|---|
Name | Description |
parent | FolderName Required. Resource name of the new mute configs's parent. Its format is "organizations/[organization_id]", "folders/[folder_id]", or "projects/[project_id]". |
muteConfig |
|