Class SecurityCenterClient (2.40.0)

GitHub RepositoryProduct ReferenceREST 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:

  1. 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.
  2. 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.
  3. 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.

Inheritance

java.lang.Object > SecurityCenterClient

Static Methods

create()

public static final SecurityCenterClient create()

Constructs an instance of SecurityCenterClient with default settings.

Returns
TypeDescription
SecurityCenterClient
Exceptions
TypeDescription
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
NameDescription
settingsSecurityCenterSettings
Returns
TypeDescription
SecurityCenterClient
Exceptions
TypeDescription
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
NameDescription
stubSecurityCenterStub
Returns
TypeDescription
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
NameDescription
settingsSecurityCenterSettings

SecurityCenterClient(SecurityCenterStub stub)

protected SecurityCenterClient(SecurityCenterStub stub)
Parameter
NameDescription
stubSecurityCenterStub

Methods

awaitTermination(long duration, TimeUnit unit)

public boolean awaitTermination(long duration, TimeUnit unit)
Parameters
NameDescription
durationlong
unitTimeUnit
Returns
TypeDescription
boolean
Exceptions
TypeDescription
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
NameDescription
parentcom.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
TypeDescription
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
NameDescription
requestBulkMuteFindingsRequest

The request object containing all of the parameters for the API call.

Returns
TypeDescription
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
NameDescription
parentString

Required. The parent, at which bulk action needs to be applied. Its format is "organizations/[organization_id]", "folders/[folder_id]", "projects/[project_id]".

Returns
TypeDescription
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
TypeDescription
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
TypeDescription
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
NameDescription
requestCreateBigQueryExportRequest

The request object containing all of the parameters for the API call.

Returns
TypeDescription
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
NameDescription
parentFolderName

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]".

bigQueryExportBigQueryExport

Required. The BigQuery export being created.

bigQueryExportIdString

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
TypeDescription
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
NameDescription
parentOrganizationName

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]".

bigQueryExportBigQueryExport

Required. The BigQuery export being created.

bigQueryExportIdString

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
TypeDescription
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
NameDescription
parentProjectName

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]".

bigQueryExportBigQueryExport

Required. The BigQuery export being created.

bigQueryExportIdString

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
TypeDescription
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
NameDescription
parentString

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]".

bigQueryExportBigQueryExport

Required. The BigQuery export being created.

bigQueryExportIdString

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
TypeDescription
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
TypeDescription
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
NameDescription
requestCreateFindingRequest

The request object containing all of the parameters for the API call.

Returns
TypeDescription
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
NameDescription
parentSourceName

Required. Resource name of the new finding's parent. Its format should be "organizations/[organization_id]/sources/[source_id]".

findingIdString

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.

findingFinding

Required. The Finding being created. The name and security_marks will be ignored as they are both output only fields on this resource.

Returns
TypeDescription
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
NameDescription
parentString

Required. Resource name of the new finding's parent. Its format should be "organizations/[organization_id]/sources/[source_id]".

findingIdString

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.

findingFinding

Required. The Finding being created. The name and security_marks will be ignored as they are both output only fields on this resource.

Returns
TypeDescription
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
TypeDescription
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
NameDescription
requestCreateMuteConfigRequest

The request object containing all of the parameters for the API call.

Returns
TypeDescription
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
NameDescription
parentFolderName

Required. Resource name of the new mute configs's parent. Its format is "organizations/[organization_id]", "folders/[folder_id]", or "projects/[project_id]".

muteConfig