Class SecurityCenterClient
- java.lang.Object
-
- com.google.cloud.securitycenter.v1beta1.SecurityCenterClient
-
- All Implemented Interfaces:
com.google.api.gax.core.BackgroundResource
,AutoCloseable
@BetaApi @Generated("by gapic-generator-java") public class SecurityCenterClient extends Object implements com.google.api.gax.core.BackgroundResource
Service Description: V1 Beta 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.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
SecurityCenterClient.GroupAssetsFixedSizeCollection
static class
SecurityCenterClient.GroupAssetsPage
static class
SecurityCenterClient.GroupAssetsPagedResponse
static class
SecurityCenterClient.GroupFindingsFixedSizeCollection
static class
SecurityCenterClient.GroupFindingsPage
static class
SecurityCenterClient.GroupFindingsPagedResponse
static class
SecurityCenterClient.ListAssetsFixedSizeCollection
static class
SecurityCenterClient.ListAssetsPage
static class
SecurityCenterClient.ListAssetsPagedResponse
static class
SecurityCenterClient.ListFindingsFixedSizeCollection
static class
SecurityCenterClient.ListFindingsPage
static class
SecurityCenterClient.ListFindingsPagedResponse
static class
SecurityCenterClient.ListSourcesFixedSizeCollection
static class
SecurityCenterClient.ListSourcesPage
static class
SecurityCenterClient.ListSourcesPagedResponse
-
Constructor Summary
Constructors Modifier Constructor Description protected
SecurityCenterClient(SecurityCenterSettings settings)
Constructs an instance of SecurityCenterClient, using the given settings.protected
SecurityCenterClient(SecurityCenterStub stub)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
awaitTermination(long duration, TimeUnit unit)
void
close()
static SecurityCenterClient
create()
Constructs an instance of SecurityCenterClient with default settings.static SecurityCenterClient
create(SecurityCenterSettings settings)
Constructs an instance of SecurityCenterClient, using the given settings.static SecurityCenterClient
create(SecurityCenterStub stub)
Constructs an instance of SecurityCenterClient, using the given stub for making calls.Finding
createFinding(CreateFindingRequest request)
Creates a finding.Finding
createFinding(SourceName parent, String findingId, Finding finding)
Creates a finding.Finding
createFinding(String parent, String findingId, Finding finding)
Creates a finding.com.google.api.gax.rpc.UnaryCallable<CreateFindingRequest,Finding>
createFindingCallable()
Creates a finding.Source
createSource(CreateSourceRequest request)
Creates a source.Source
createSource(OrganizationName parent, Source source)
Creates a source.Source
createSource(String parent, Source source)
Creates a source.com.google.api.gax.rpc.UnaryCallable<CreateSourceRequest,Source>
createSourceCallable()
Creates a source.com.google.api.gax.httpjson.longrunning.OperationsClient
getHttpJsonOperationsClient()
Returns the OperationsClient that can be used to query the status of a long-running operation returned by another API method call.com.google.iam.v1.Policy
getIamPolicy(com.google.api.resourcenames.ResourceName resource)
Gets the access control policy on the specified Source.com.google.iam.v1.Policy
getIamPolicy(com.google.iam.v1.GetIamPolicyRequest request)
Gets the access control policy on the specified Source.com.google.iam.v1.Policy
getIamPolicy(String resource)
Gets the access control policy on the specified Source.com.google.api.gax.rpc.UnaryCallable<com.google.iam.v1.GetIamPolicyRequest,com.google.iam.v1.Policy>
getIamPolicyCallable()
Gets the access control policy on the specified Source.com.google.longrunning.OperationsClient
getOperationsClient()
Returns the OperationsClient that can be used to query the status of a long-running operation returned by another API method call.OrganizationSettings
getOrganizationSettings(GetOrganizationSettingsRequest request)
Gets the settings for an organization.OrganizationSettings
getOrganizationSettings(OrganizationSettingsName name)
Gets the settings for an organization.OrganizationSettings
getOrganizationSettings(String name)
Gets the settings for an organization.com.google.api.gax.rpc.UnaryCallable<GetOrganizationSettingsRequest,OrganizationSettings>
getOrganizationSettingsCallable()
Gets the settings for an organization.SecurityCenterSettings
getSettings()
Source
getSource(GetSourceRequest request)
Gets a source.Source
getSource(SourceName name)
Gets a source.Source
getSource(String name)
Gets a source.com.google.api.gax.rpc.UnaryCallable<GetSourceRequest,Source>
getSourceCallable()
Gets a source.SecurityCenterStub
getStub()
SecurityCenterClient.GroupAssetsPagedResponse
groupAssets(GroupAssetsRequest request)
Filters an organization's assets and groups them by their specified properties.com.google.api.gax.rpc.UnaryCallable<GroupAssetsRequest,GroupAssetsResponse>
groupAssetsCallable()
Filters an organization's assets and groups them by their specified properties.com.google.api.gax.rpc.UnaryCallable<GroupAssetsRequest,SecurityCenterClient.GroupAssetsPagedResponse>
groupAssetsPagedCallable()
Filters an organization's assets and groups them by their specified properties.SecurityCenterClient.GroupFindingsPagedResponse
groupFindings(GroupFindingsRequest request)
Filters an organization or source's findings and groups them by their specified properties.SecurityCenterClient.GroupFindingsPagedResponse
groupFindings(SourceName parent, String groupBy)
Filters an organization or source's findings and groups them by their specified properties.SecurityCenterClient.GroupFindingsPagedResponse
groupFindings(String parent, String groupBy)
Filters an organization or source's findings and groups them by their specified properties.com.google.api.gax.rpc.UnaryCallable<GroupFindingsRequest,GroupFindingsResponse>
groupFindingsCallable()
Filters an organization or source's findings and groups them by their specified properties.com.google.api.gax.rpc.UnaryCallable<GroupFindingsRequest,SecurityCenterClient.GroupFindingsPagedResponse>
groupFindingsPagedCallable()
Filters an organization or source's findings and groups them by their specified properties.boolean
isShutdown()
boolean
isTerminated()
SecurityCenterClient.ListAssetsPagedResponse
listAssets(ListAssetsRequest request)
Lists an organization's assets.com.google.api.gax.rpc.UnaryCallable<ListAssetsRequest,ListAssetsResponse>
listAssetsCallable()
Lists an organization's assets.com.google.api.gax.rpc.UnaryCallable<ListAssetsRequest,SecurityCenterClient.ListAssetsPagedResponse>
listAssetsPagedCallable()
Lists an organization's assets.SecurityCenterClient.ListFindingsPagedResponse
listFindings(ListFindingsRequest request)
Lists an organization or source's findings.com.google.api.gax.rpc.UnaryCallable<ListFindingsRequest,ListFindingsResponse>
listFindingsCallable()
Lists an organization or source's findings.com.google.api.gax.rpc.UnaryCallable<ListFindingsRequest,SecurityCenterClient.ListFindingsPagedResponse>
listFindingsPagedCallable()
Lists an organization or source's findings.SecurityCenterClient.ListSourcesPagedResponse
listSources(ListSourcesRequest request)
Lists all sources belonging to an organization.SecurityCenterClient.ListSourcesPagedResponse
listSources(OrganizationName parent)
Lists all sources belonging to an organization.SecurityCenterClient.ListSourcesPagedResponse
listSources(String parent)
Lists all sources belonging to an organization.com.google.api.gax.rpc.UnaryCallable<ListSourcesRequest,ListSourcesResponse>
listSourcesCallable()
Lists all sources belonging to an organization.com.google.api.gax.rpc.UnaryCallable<ListSourcesRequest,SecurityCenterClient.ListSourcesPagedResponse>
listSourcesPagedCallable()
Lists all sources belonging to an organization.com.google.api.gax.longrunning.OperationFuture<com.google.protobuf.Empty,com.google.protobuf.Empty>
runAssetDiscoveryAsync(OrganizationName parent)
Runs asset discovery.com.google.api.gax.longrunning.OperationFuture<com.google.protobuf.Empty,com.google.protobuf.Empty>
runAssetDiscoveryAsync(RunAssetDiscoveryRequest request)
Runs asset discovery.com.google.api.gax.longrunning.OperationFuture<com.google.protobuf.Empty,com.google.protobuf.Empty>
runAssetDiscoveryAsync(String parent)
Runs asset discovery.com.google.api.gax.rpc.UnaryCallable<RunAssetDiscoveryRequest,com.google.longrunning.Operation>
runAssetDiscoveryCallable()
Runs asset discovery.com.google.api.gax.rpc.OperationCallable<RunAssetDiscoveryRequest,com.google.protobuf.Empty,com.google.protobuf.Empty>
runAssetDiscoveryOperationCallable()
Runs asset discovery.Finding
setFindingState(FindingName name, Finding.State state, com.google.protobuf.Timestamp startTime)
Updates the state of a finding.Finding
setFindingState(SetFindingStateRequest request)
Updates the state of a finding.Finding
setFindingState(String name, Finding.State state, com.google.protobuf.Timestamp startTime)
Updates the state of a finding.com.google.api.gax.rpc.UnaryCallable<SetFindingStateRequest,Finding>
setFindingStateCallable()
Updates the state of a finding.com.google.iam.v1.Policy
setIamPolicy(com.google.api.resourcenames.ResourceName resource, com.google.iam.v1.Policy policy)
Sets the access control policy on the specified Source.com.google.iam.v1.Policy
setIamPolicy(com.google.iam.v1.SetIamPolicyRequest request)
Sets the access control policy on the specified Source.com.google.iam.v1.Policy
setIamPolicy(String resource, com.google.iam.v1.Policy policy)
Sets the access control policy on the specified Source.com.google.api.gax.rpc.UnaryCallable<com.google.iam.v1.SetIamPolicyRequest,com.google.iam.v1.Policy>
setIamPolicyCallable()
Sets the access control policy on the specified Source.void
shutdown()
void
shutdownNow()
com.google.iam.v1.TestIamPermissionsResponse
testIamPermissions(com.google.api.resourcenames.ResourceName resource, List<String> permissions)
Returns the permissions that a caller has on the specified source.com.google.iam.v1.TestIamPermissionsResponse
testIamPermissions(com.google.iam.v1.TestIamPermissionsRequest request)
Returns the permissions that a caller has on the specified source.com.google.iam.v1.TestIamPermissionsResponse
testIamPermissions(String resource, List<String> permissions)
Returns the permissions that a caller has on the specified source.com.google.api.gax.rpc.UnaryCallable<com.google.iam.v1.TestIamPermissionsRequest,com.google.iam.v1.TestIamPermissionsResponse>
testIamPermissionsCallable()
Returns the permissions that a caller has on the specified source.Finding
updateFinding(Finding finding)
Creates or updates a finding.Finding
updateFinding(UpdateFindingRequest request)
Creates or updates a finding.com.google.api.gax.rpc.UnaryCallable<UpdateFindingRequest,Finding>
updateFindingCallable()
Creates or updates a finding.OrganizationSettings
updateOrganizationSettings(OrganizationSettings organizationSettings)
Updates an organization's settings.OrganizationSettings
updateOrganizationSettings(UpdateOrganizationSettingsRequest request)
Updates an organization's settings.com.google.api.gax.rpc.UnaryCallable<UpdateOrganizationSettingsRequest,OrganizationSettings>
updateOrganizationSettingsCallable()
Updates an organization's settings.SecurityMarks
updateSecurityMarks(SecurityMarks securityMarks)
Updates security marks.SecurityMarks
updateSecurityMarks(UpdateSecurityMarksRequest request)
Updates security marks.com.google.api.gax.rpc.UnaryCallable<UpdateSecurityMarksRequest,SecurityMarks>
updateSecurityMarksCallable()
Updates security marks.Source
updateSource(Source source)
Updates a source.Source
updateSource(UpdateSourceRequest request)
Updates a source.com.google.api.gax.rpc.UnaryCallable<UpdateSourceRequest,Source>
updateSourceCallable()
Updates a source.
-
-
-
Constructor Detail
-
SecurityCenterClient
protected SecurityCenterClient(SecurityCenterSettings settings) throws IOException
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.- Throws:
IOException
-
SecurityCenterClient
protected SecurityCenterClient(SecurityCenterStub stub)
-
-
Method Detail
-
create
public static final SecurityCenterClient create() throws IOException
Constructs an instance of SecurityCenterClient with default settings.- Throws:
IOException
-
create
public static final SecurityCenterClient create(SecurityCenterSettings settings) throws IOException
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.- Throws:
IOException
-
create
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).
-
getSettings
public final SecurityCenterSettings getSettings()
-
getStub
public SecurityCenterStub getStub()
-
getOperationsClient
public final com.google.longrunning.OperationsClient getOperationsClient()
Returns the OperationsClient that can be used to query the status of a long-running operation returned by another API method call.
-
getHttpJsonOperationsClient
@BetaApi public final com.google.api.gax.httpjson.longrunning.OperationsClient getHttpJsonOperationsClient()
Returns the OperationsClient that can be used to query the status of a long-running operation returned by another API method call.
-
createSource
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:
parent
- Required. Resource name of the new source's parent. Its format should be "organizations/[organization_id]".source
- Required. The Source being created, only the display_name and description will be used. All other fields will be ignored.- Throws:
com.google.api.gax.rpc.ApiException
- if the remote call fails
-
createSource
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:
parent
- Required. Resource name of the new source's parent. Its format should be "organizations/[organization_id]".source
- Required. The Source being created, only the display_name and description will be used. All other fields will be ignored.- Throws:
com.google.api.gax.rpc.ApiException
- if the remote call fails
-
createSource
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); }
- Parameters:
request
- The request object containing all of the parameters for the API call.- Throws:
com.google.api.gax.rpc.ApiException
- if the remote call fails
-
createSourceCallable
public final com.google.api.gax.rpc.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(); }
-
createFinding
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.of("[ORGANIZATION]", "[SOURCE]"); String findingId = "findingId439150212"; Finding finding = Finding.newBuilder().build(); Finding response = securityCenterClient.createFinding(parent, findingId, finding); }
- Parameters:
parent
- Required. Resource name of the new finding's parent. Its format should be "organizations/[organization_id]/sources/[source_id]".findingId
- 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
- Required. The Finding being created. The name and security_marks will be ignored as they are both output only fields on this resource.- Throws:
com.google.api.gax.rpc.ApiException
- if the remote call fails
-
createFinding
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.of("[ORGANIZATION]", "[SOURCE]").toString(); String findingId = "findingId439150212"; Finding finding = Finding.newBuilder().build(); Finding response = securityCenterClient.createFinding(parent, findingId, finding); }
- Parameters:
parent
- Required. Resource name of the new finding's parent. Its format should be "organizations/[organization_id]/sources/[source_id]".findingId
- 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
- Required. The Finding being created. The name and security_marks will be ignored as they are both output only fields on this resource.- Throws:
com.google.api.gax.rpc.ApiException
- if the remote call fails
-
createFinding
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.of("[ORGANIZATION]", "[SOURCE]").toString()) .setFindingId("findingId439150212") .setFinding(Finding.newBuilder().build()) .build(); Finding response = securityCenterClient.createFinding(request); }
- Parameters:
request
- The request object containing all of the parameters for the API call.- Throws:
com.google.api.gax.rpc.ApiException
- if the remote call fails
-
createFindingCallable
public final com.google.api.gax.rpc.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.of("[ORGANIZATION]", "[SOURCE]").toString()) .setFindingId("findingId439150212") .setFinding(Finding.newBuilder().build()) .build(); ApiFuture<Finding> future = securityCenterClient.createFindingCallable().futureCall(request); // Do something. Finding response = future.get(); }
-
getIamPolicy
public final com.google.iam.v1.Policy getIamPolicy(com.google.api.resourcenames.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.of("[ORGANIZATION]", "[SOURCE]"); Policy response = securityCenterClient.getIamPolicy(resource); }
- Parameters:
resource
- REQUIRED: The resource for which the policy is being requested. See the operation documentation for the appropriate value for this field.- Throws:
com.google.api.gax.rpc.ApiException
- if the remote call fails
-
getIamPolicy
public final com.google.iam.v1.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 = OrganizationName.of("[ORGANIZATION]").toString(); Policy response = securityCenterClient.getIamPolicy(resource); }
- Parameters:
resource
- REQUIRED: The resource for which the policy is being requested. See the operation documentation for the appropriate value for this field.- Throws:
com.google.api.gax.rpc.ApiException
- if the remote call fails
-
getIamPolicy
public final com.google.iam.v1.Policy getIamPolicy(com.google.iam.v1.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.of("[ORGANIZATION]", "[SOURCE]").toString()) .setOptions(GetPolicyOptions.newBuilder().build()) .build(); Policy response = securityCenterClient.getIamPolicy(request); }
- Parameters:
request
- The request object containing all of the parameters for the API call.- Throws:
com.google.api.gax.rpc.ApiException
- if the remote call fails
-
getIamPolicyCallable
public final com.google.api.gax.rpc.UnaryCallable<com.google.iam.v1.GetIamPolicyRequest,com.google.iam.v1.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.of("[ORGANIZATION]", "[SOURCE]").toString()) .setOptions(GetPolicyOptions.newBuilder().build()) .build(); ApiFuture<Policy> future = securityCenterClient.getIamPolicyCallable().futureCall(request); // Do something. Policy response = future.get(); }
-
getOrganizationSettings
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); }
- Parameters:
name
- Required. Name of the organization to get organization settings for. Its format is "organizations/[organization_id]/organizationSettings".- Throws:
com.google.api.gax.rpc.ApiException
- if the remote call fails
-
getOrganizationSettings
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); }
- Parameters:
name
- Required. Name of the organization to get organization settings for. Its format is "organizations/[organization_id]/organizationSettings".- Throws:
com.google.api.gax.rpc.ApiException
- if the remote call fails
-
getOrganizationSettings
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); }
- Parameters:
request
- The request object containing all of the parameters for the API call.- Throws:
com.google.api.gax.rpc.ApiException
- if the remote call fails
-
getOrganizationSettingsCallable
public final com.google.api.gax.rpc.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(); }
-
getSource
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.of("[ORGANIZATION]", "[SOURCE]"); Source response = securityCenterClient.getSource(name); }
- Parameters:
name
- Required. Relative resource name of the source. Its format is "organizations/[organization_id]/source/[source_id]".- Throws:
com.google.api.gax.rpc.ApiException
- if the remote call fails
-
getSource
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.of("[ORGANIZATION]", "[SOURCE]").toString(); Source response = securityCenterClient.getSource(name); }
- Parameters:
name
- Required. Relative resource name of the source. Its format is "organizations/[organization_id]/source/[source_id]".- Throws:
com.google.api.gax.rpc.ApiException
- if the remote call fails
-
getSource
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.of("[ORGANIZATION]", "[SOURCE]").toString()) .build(); Source response = securityCenterClient.getSource(request); }
- Parameters:
request
- The request object containing all of the parameters for the API call.- Throws:
com.google.api.gax.rpc.ApiException
- if the remote call fails
-
getSourceCallable
public final com.google.api.gax.rpc.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.of("[ORGANIZATION]", "[SOURCE]").toString()) .build(); ApiFuture<Source> future = securityCenterClient.getSourceCallable().futureCall(request); // Do something. Source response = future.get(); }
-
groupAssets
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); } }
- Parameters:
request
- The request object containing all of the parameters for the API call.- Throws:
com.google.api.gax.rpc.ApiException
- if the remote call fails
-
groupAssetsPagedCallable
public final com.google.api.gax.rpc.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); } }
-
groupAssetsCallable
public final com.google.api.gax.rpc.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; } } }
-
groupFindings
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: /v1beta1/organizations/{organization_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.of("[ORGANIZATION]", "[SOURCE]"); String groupBy = "groupBy293428022"; for (GroupResult element : securityCenterClient.groupFindings(parent, groupBy).iterateAll()) { // doThingsWith(element); } }
- Parameters:
parent
- Required. Name of the source to groupBy. Its format is "organizations/[organization_id]/sources/[source_id]". To groupBy across all sources provide a source_id of `-`. For example: organizations/{organization_id}/sources/-groupBy
- Required. Expression that defines what assets fields to use for grouping (including `state`). The string value should follow SQL syntax: comma separated list of fields. For example: "parent,resource_name".The following fields are supported:
- resource_name
- category
- state
- parent
- Throws:
com.google.api.gax.rpc.ApiException
- if the remote call fails
-
groupFindings
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: /v1beta1/organizations/{organization_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.of("[ORGANIZATION]", "[SOURCE]").toString(); String groupBy = "groupBy293428022"; for (GroupResult element : securityCenterClient.groupFindings(parent, groupBy).iterateAll()) { // doThingsWith(element); } }
- Parameters:
parent
- Required. Name of the source to groupBy. Its format is "organizations/[organization_id]/sources/[source_id]". To groupBy across all sources provide a source_id of `-`. For example: organizations/{organization_id}/sources/-groupBy
- Required. Expression that defines what assets fields to use for grouping (including `state`). The string value should follow SQL syntax: comma separated list of fields. For example: "parent,resource_name".The following fields are supported:
- resource_name
- category
- state
- parent
- Throws:
com.google.api.gax.rpc.ApiException
- if the remote call fails
-
groupFindings
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: /v1beta1/organizations/{organization_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.of("[ORGANIZATION]", "[SOURCE]").toString()) .setFilter("filter-1274492040") .setGroupBy("groupBy293428022") .setReadTime(Timestamp.newBuilder().build()) .setPageToken("pageToken873572522") .setPageSize(883849137) .build(); for (GroupResult element : securityCenterClient.groupFindings(request).iterateAll()) { // doThingsWith(element); } }
- Parameters:
request
- The request object containing all of the parameters for the API call.- Throws:
com.google.api.gax.rpc.ApiException
- if the remote call fails
-
groupFindingsPagedCallable
public final com.google.api.gax.rpc.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: /v1beta1/organizations/{organization_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.of("[ORGANIZATION]", "[SOURCE]").toString()) .setFilter("filter-1274492040") .setGroupBy("groupBy293428022") .setReadTime(Timestamp.newBuilder().build()) .setPageToken("pageToken873572522") .setPageSize(883849137) .build(); ApiFuture<GroupResult> future = securityCenterClient.groupFindingsPagedCallable().futureCall(request); // Do something. for (GroupResult element : future.get().iterateAll()) { // doThingsWith(element); } }
-
groupFindingsCallable
public final com.google.api.gax.rpc.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: /v1beta1/organizations/{organization_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.of("[ORGANIZATION]", "[SOURCE]").toString()) .setFilter("filter-1274492040") .setGroupBy("groupBy293428022") .setReadTime(Timestamp.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; } } }
-
listAssets
public final SecurityCenterClient.ListAssetsPagedResponse listAssets(ListAssetsRequest request)
Lists an organization's assets.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()) { ListAssetsRequest request = ListAssetsRequest.newBuilder() .setParent(OrganizationName.of("[ORGANIZATION]").toString()) .setFilter("filter-1274492040") .setOrderBy("orderBy-1207110587") .setReadTime(Timestamp.newBuilder().build()) .setCompareDuration(Duration.newBuilder().build()) .setFieldMask(FieldMask.newBuilder().build()) .setPageToken("pageToken873572522") .setPageSize(883849137) .build(); for (ListAssetsResponse.ListAssetsResult element : securityCenterClient.listAssets(request).iterateAll()) { // doThingsWith(element); } }
- Parameters:
request
- The request object containing all of the parameters for the API call.- Throws:
com.google.api.gax.rpc.ApiException
- if the remote call fails
-
listAssetsPagedCallable
public final com.google.api.gax.rpc.UnaryCallable<ListAssetsRequest,SecurityCenterClient.ListAssetsPagedResponse> listAssetsPagedCallable()
Lists an organization's assets.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()) { ListAssetsRequest request = ListAssetsRequest.newBuilder() .setParent(OrganizationName.of("[ORGANIZATION]").toString()) .setFilter("filter-1274492040") .setOrderBy("orderBy-1207110587") .setReadTime(Timestamp.newBuilder().build()) .setCompareDuration(Duration.newBuilder().build()) .setFieldMask(FieldMask.newBuilder().build()) .setPageToken("pageToken873572522") .setPageSize(883849137) .build(); ApiFuture<ListAssetsResponse.ListAssetsResult> future = securityCenterClient.listAssetsPagedCallable().futureCall(request); // Do something. for (ListAssetsResponse.ListAssetsResult element : future.get().iterateAll()) { // doThingsWith(element); } }
-
listAssetsCallable
public final com.google.api.gax.rpc.UnaryCallable<ListAssetsRequest,ListAssetsResponse> listAssetsCallable()
Lists an organization's assets.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()) { ListAssetsRequest request = ListAssetsRequest.newBuilder() .setParent(OrganizationName.of("[ORGANIZATION]").toString()) .setFilter("filter-1274492040") .setOrderBy("orderBy-1207110587") .setReadTime(Timestamp.newBuilder().build()) .setCompareDuration(Duration.newBuilder().build()) .setFieldMask(FieldMask.newBuilder().build()) .setPageToken("pageToken873572522") .setPageSize(883849137) .build(); while (true) { ListAssetsResponse response = securityCenterClient.listAssetsCallable().call(request); for (ListAssetsResponse.ListAssetsResult element : response.getListAssetsResultsList()) { // doThingsWith(element); } String nextPageToken = response.getNextPageToken(); if (!Strings.isNullOrEmpty(nextPageToken)) { request = request.toBuilder().setPageToken(nextPageToken).build(); } else { break; } } }
-
listFindings
public final SecurityCenterClient.ListFindingsPagedResponse listFindings(ListFindingsRequest request)
Lists an organization or source's findings.To list across all sources provide a `-` as the source id. Example: /v1beta1/organizations/{organization_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()) { ListFindingsRequest request = ListFindingsRequest.newBuilder() .setParent(SourceName.of("[ORGANIZATION]", "[SOURCE]").toString()) .setFilter("filter-1274492040") .setOrderBy("orderBy-1207110587") .setReadTime(Timestamp.newBuilder().build()) .setFieldMask(FieldMask.newBuilder().build()) .setPageToken("pageToken873572522") .setPageSize(883849137) .build(); for (Finding element : securityCenterClient.listFindings(request).iterateAll()) { // doThingsWith(element); } }
- Parameters:
request
- The request object containing all of the parameters for the API call.- Throws:
com.google.api.gax.rpc.ApiException
- if the remote call fails
-
listFindingsPagedCallable
public final com.google.api.gax.rpc.UnaryCallable<ListFindingsRequest,SecurityCenterClient.ListFindingsPagedResponse> listFindingsPagedCallable()
Lists an organization or source's findings.To list across all sources provide a `-` as the source id. Example: /v1beta1/organizations/{organization_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()) { ListFindingsRequest request = ListFindingsRequest.newBuilder() .setParent(SourceName.of("[ORGANIZATION]", "[SOURCE]").toString()) .setFilter("filter-1274492040") .setOrderBy("orderBy-1207110587") .setReadTime(Timestamp.newBuilder().build()) .setFieldMask(FieldMask.newBuilder().build()) .setPageToken("pageToken873572522") .setPageSize(883849137) .build(); ApiFuture<Finding> future = securityCenterClient.listFindingsPagedCallable().futureCall(request); // Do something. for (Finding element : future.get().iterateAll()) { // doThingsWith(element); } }
-
listFindingsCallable
public final com.google.api.gax.rpc.UnaryCallable<ListFindingsRequest,ListFindingsResponse> listFindingsCallable()
Lists an organization or source's findings.To list across all sources provide a `-` as the source id. Example: /v1beta1/organizations/{organization_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()) { ListFindingsRequest request = ListFindingsRequest.newBuilder() .setParent(SourceName.of("[ORGANIZATION]", "[SOURCE]").toString()) .setFilter("filter-1274492040") .setOrderBy("orderBy-1207110587") .setReadTime(Timestamp.newBuilder().build()) .setFieldMask(FieldMask.newBuilder().build()) .setPageToken("pageToken873572522") .setPageSize(883849137) .build(); while (true) { ListFindingsResponse response = securityCenterClient.listFindingsCallable().call(request); for (Finding element : response.getFindingsList()) { // doThingsWith(element); } String nextPageToken = response.getNextPageToken(); if (!Strings.isNullOrEmpty(nextPageToken)) { request = request.toBuilder().setPageToken(nextPageToken).build(); } else { break; } } }
-
listSources
public final SecurityCenterClient.ListSourcesPagedResponse listSources(OrganizationName parent)
Lists all sources belonging to 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()) { OrganizationName parent = OrganizationName.of("[ORGANIZATION]"); for (Source element : securityCenterClient.listSources(parent).iterateAll()) { // doThingsWith(element); } }
- Parameters:
parent
- Required. Resource name of the parent of sources to list. Its format should be "organizations/[organization_id]".- Throws:
com.google.api.gax.rpc.ApiException
- if the remote call fails
-
listSources
public final SecurityCenterClient.ListSourcesPagedResponse listSources(String parent)
Lists all sources belonging to 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 parent = OrganizationName.of("[ORGANIZATION]").toString(); for (Source element : securityCenterClient.listSources(parent).iterateAll()) { // doThingsWith(element); } }
- Parameters:
parent
- Required. Resource name of the parent of sources to list. Its format should be "organizations/[organization_id]".- Throws:
com.google.api.gax.rpc.ApiException
- if the remote call fails
-
listSources
public final SecurityCenterClient.ListSourcesPagedResponse listSources(ListSourcesRequest request)
Lists all sources belonging to 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()) { ListSourcesRequest request = ListSourcesRequest.newBuilder() .setParent(OrganizationName.of("[ORGANIZATION]").toString()) .setPageToken("pageToken873572522") .setPageSize(883849137) .build(); for (Source element : securityCenterClient.listSources(request).iterateAll()) { // doThingsWith(element); } }
- Parameters:
request
- The request object containing all of the parameters for the API call.- Throws:
com.google.api.gax.rpc.ApiException
- if the remote call fails
-
listSourcesPagedCallable
public final com.google.api.gax.rpc.UnaryCallable<ListSourcesRequest,SecurityCenterClient.ListSourcesPagedResponse> listSourcesPagedCallable()
Lists all sources belonging to 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()) { ListSourcesRequest request = ListSourcesRequest.newBuilder() .setParent(OrganizationName.of("[ORGANIZATION]").toString()) .setPageToken("pageToken873572522") .setPageSize(883849137) .build(); ApiFuture<Source> future = securityCenterClient.listSourcesPagedCallable().futureCall(request); // Do something. for (Source element : future.get().iterateAll()) { // doThingsWith(element); } }
-
listSourcesCallable
public final com.google.api.gax.rpc.UnaryCallable<ListSourcesRequest,ListSourcesResponse> listSourcesCallable()
Lists all sources belonging to 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()) { ListSourcesRequest request = ListSourcesRequest.newBuilder() .setParent(OrganizationName.of("[ORGANIZATION]").toString()) .setPageToken("pageToken873572522") .setPageSize(883849137) .build(); while (true) { ListSourcesResponse response = securityCenterClient.listSourcesCallable().call(request); for (Source element : response.getSourcesList()) { // doThingsWith(element); } String nextPageToken = response.getNextPageToken(); if (!Strings.isNullOrEmpty(nextPageToken)) { request = request.toBuilder().setPageToken(nextPageToken).build(); } else { break; } } }
-
runAssetDiscoveryAsync
public final com.google.api.gax.longrunning.OperationFuture<com.google.protobuf.Empty,com.google.protobuf.Empty> runAssetDiscoveryAsync(OrganizationName parent)
Runs asset discovery. The discovery is tracked with a long-running operation.This API can only be called with limited frequency for an organization. If it is called too frequently the caller will receive a TOO_MANY_REQUESTS error.
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]"); securityCenterClient.runAssetDiscoveryAsync(parent).get(); }
- Parameters:
parent
- Required. Name of the organization to run asset discovery for. Its format is "organizations/[organization_id]".- Throws:
com.google.api.gax.rpc.ApiException
- if the remote call fails
-
runAssetDiscoveryAsync
public final com.google.api.gax.longrunning.OperationFuture<com.google.protobuf.Empty,com.google.protobuf.Empty> runAssetDiscoveryAsync(String parent)
Runs asset discovery. The discovery is tracked with a long-running operation.This API can only be called with limited frequency for an organization. If it is called too frequently the caller will receive a TOO_MANY_REQUESTS error.
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(); securityCenterClient.runAssetDiscoveryAsync(parent).get(); }
- Parameters:
parent
- Required. Name of the organization to run asset discovery for. Its format is "organizations/[organization_id]".- Throws:
com.google.api.gax.rpc.ApiException
- if the remote call fails
-
runAssetDiscoveryAsync
public final com.google.api.gax.longrunning.OperationFuture<com.google.protobuf.Empty,com.google.protobuf.Empty> runAssetDiscoveryAsync(RunAssetDiscoveryRequest request)
Runs asset discovery. The discovery is tracked with a long-running operation.This API can only be called with limited frequency for an organization. If it is called too frequently the caller will receive a TOO_MANY_REQUESTS error.
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()) { RunAssetDiscoveryRequest request = RunAssetDiscoveryRequest.newBuilder() .setParent(OrganizationName.of("[ORGANIZATION]").toString()) .build(); securityCenterClient.runAssetDiscoveryAsync(request).get(); }
- Parameters:
request
- The request object containing all of the parameters for the API call.- Throws:
com.google.api.gax.rpc.ApiException
- if the remote call fails
-
runAssetDiscoveryOperationCallable
public final com.google.api.gax.rpc.OperationCallable<RunAssetDiscoveryRequest,com.google.protobuf.Empty,com.google.protobuf.Empty> runAssetDiscoveryOperationCallable()
Runs asset discovery. The discovery is tracked with a long-running operation.This API can only be called with limited frequency for an organization. If it is called too frequently the caller will receive a TOO_MANY_REQUESTS error.
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()) { RunAssetDiscoveryRequest request = RunAssetDiscoveryRequest.newBuilder() .setParent(OrganizationName.of("[ORGANIZATION]").toString()) .build(); OperationFuture<Empty, Empty> future = securityCenterClient.runAssetDiscoveryOperationCallable().futureCall(request); // Do something. future.get(); }
-
runAssetDiscoveryCallable
public final com.google.api.gax.rpc.UnaryCallable<RunAssetDiscoveryRequest,com.google.longrunning.Operation> runAssetDiscoveryCallable()
Runs asset discovery. The discovery is tracked with a long-running operation.This API can only be called with limited frequency for an organization. If it is called too frequently the caller will receive a TOO_MANY_REQUESTS error.
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()) { RunAssetDiscoveryRequest request = RunAssetDiscoveryRequest.newBuilder() .setParent(OrganizationName.of("[ORGANIZATION]").toString()) .build(); ApiFuture<Operation> future = securityCenterClient.runAssetDiscoveryCallable().futureCall(request); // Do something. future.get(); }
-
setFindingState
public final Finding setFindingState(FindingName name, Finding.State state, com.google.protobuf.Timestamp startTime)
Updates the state of a finding.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()) { FindingName name = FindingName.of("[ORGANIZATION]", "[SOURCE]", "[FINDING]"); Finding.State state = Finding.State.forNumber(0); Timestamp startTime = Timestamp.newBuilder().build(); Finding response = securityCenterClient.setFindingState(name, state, startTime); }
- Parameters:
name
- Required. The relative resource name of the finding. See: https://cloud.google.com/apis/design/resource_names#relative_resource_name Example: "organizations/{organization_id}/sources/{source_id}/finding/{finding_id}".state
- Required. The desired State of the finding.startTime
- Required. The time at which the updated state takes effect.- Throws:
com.google.api.gax.rpc.ApiException
- if the remote call fails
-
setFindingState
public final Finding setFindingState(String name, Finding.State state, com.google.protobuf.Timestamp startTime)
Updates the state of a finding.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 = FindingName.of("[ORGANIZATION]", "[SOURCE]", "[FINDING]").toString(); Finding.State state = Finding.State.forNumber(0); Timestamp startTime = Timestamp.newBuilder().build(); Finding response = securityCenterClient.setFindingState(name, state, startTime); }
- Parameters:
name
- Required. The relative resource name of the finding. See: https://cloud.google.com/apis/design/resource_names#relative_resource_name Example: "organizations/{organization_id}/sources/{source_id}/finding/{finding_id}".state
- Required. The desired State of the finding.startTime
- Required. The time at which the updated state takes effect.- Throws:
com.google.api.gax.rpc.ApiException
- if the remote call fails
-
setFindingState
public final Finding setFindingState(SetFindingStateRequest request)
Updates the state of a finding.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()) { SetFindingStateRequest request = SetFindingStateRequest.newBuilder() .setName(FindingName.of("[ORGANIZATION]", "[SOURCE]", "[FINDING]").toString()) .setStartTime(Timestamp.newBuilder().build()) .build(); Finding response = securityCenterClient.setFindingState(request); }
- Parameters:
request
- The request object containing all of the parameters for the API call.- Throws:
com.google.api.gax.rpc.ApiException
- if the remote call fails
-
setFindingStateCallable
public final com.google.api.gax.rpc.UnaryCallable<SetFindingStateRequest,Finding> setFindingStateCallable()
Updates the state of a finding.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()) { SetFindingStateRequest request = SetFindingStateRequest.newBuilder() .setName(FindingName.of("[ORGANIZATION]", "[SOURCE]", "[FINDING]").toString()) .setStartTime(Timestamp.newBuilder().build()) .build(); ApiFuture<Finding> future = securityCenterClient.setFindingStateCallable().futureCall(request); // Do something. Finding response = future.get(); }
-
setIamPolicy
public final com.google.iam.v1.Policy setIamPolicy(com.google.api.resourcenames.ResourceName resource, com.google.iam.v1.Policy policy)
Sets 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.of("[ORGANIZATION]", "[SOURCE]"); Policy policy = Policy.newBuilder().build(); Policy response = securityCenterClient.setIamPolicy(resource, policy); }
- Parameters:
resource
- REQUIRED: The resource for which the policy is being specified. See the operation documentation for the appropriate value for this field.policy
- REQUIRED: The complete policy to be applied to the `resource`. The size of the policy is limited to a few 10s of KB. An empty policy is a valid policy but certain Cloud Platform services (such as Projects) might reject them.- Throws:
com.google.api.gax.rpc.ApiException
- if the remote call fails
-
setIamPolicy
public final com.google.iam.v1.Policy setIamPolicy(String resource, com.google.iam.v1.Policy policy)
Sets 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 = OrganizationName.of("[ORGANIZATION]").toString(); Policy policy = Policy.newBuilder().build(); Policy response = securityCenterClient.setIamPolicy(resource, policy); }
- Parameters:
resource
- REQUIRED: The resource for which the policy is being specified. See the operation documentation for the appropriate value for this field.policy
- REQUIRED: The complete policy to be applied to the `resource`. The size of the policy is limited to a few 10s of KB. An empty policy is a valid policy but certain Cloud Platform services (such as Projects) might reject them.- Throws:
com.google.api.gax.rpc.ApiException
- if the remote call fails
-
setIamPolicy
public final com.google.iam.v1.Policy setIamPolicy(com.google.iam.v1.SetIamPolicyRequest request)
Sets 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()) { SetIamPolicyRequest request = SetIamPolicyRequest.newBuilder() .setResource(SourceName.of("[ORGANIZATION]", "[SOURCE]").toString()) .setPolicy(Policy.newBuilder().build()) .setUpdateMask(FieldMask.newBuilder().build()) .build(); Policy response = securityCenterClient.setIamPolicy(request); }
- Parameters:
request
- The request object containing all of the parameters for the API call.- Throws:
com.google.api.gax.rpc.ApiException
- if the remote call fails
-
setIamPolicyCallable
public final com.google.api.gax.rpc.UnaryCallable<com.google.iam.v1.SetIamPolicyRequest,com.google.iam.v1.Policy> setIamPolicyCallable()
Sets 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()) { SetIamPolicyRequest request = SetIamPolicyRequest.newBuilder() .setResource(SourceName.of("[ORGANIZATION]", "[SOURCE]").toString()) .setPolicy(Policy.newBuilder().build()) .setUpdateMask(FieldMask.newBuilder().build()) .build(); ApiFuture<Policy> future = securityCenterClient.setIamPolicyCallable().futureCall(request); // Do something. Policy response = future.get(); }
-
testIamPermissions
public final com.google.iam.v1.TestIamPermissionsResponse testIamPermissions(com.google.api.resourcenames.ResourceName resource, List<String> permissions)
Returns the permissions that a caller has 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.of("[ORGANIZATION]", "[SOURCE]"); List<String> permissions = new ArrayList<>(); TestIamPermissionsResponse response = securityCenterClient.testIamPermissions(resource, permissions); }
- Parameters:
resource
- REQUIRED: The resource for which the policy detail is being requested. See the operation documentation for the appropriate value for this field.permissions
- The set of permissions to check for the `resource`. Permissions with wildcards (such as '*' or 'storage.*') are not allowed. For more information see [IAM Overview](https://cloud.google.com/iam/docs/overview#permissions).- Throws:
com.google.api.gax.rpc.ApiException
- if the remote call fails
-
testIamPermissions
public final com.google.iam.v1.TestIamPermissionsResponse testIamPermissions(String resource, List<String> permissions)
Returns the permissions that a caller has 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 = OrganizationName.of("[ORGANIZATION]").toString(); List<String> permissions = new ArrayList<>(); TestIamPermissionsResponse response = securityCenterClient.testIamPermissions(resource, permissions); }
- Parameters:
resource
- REQUIRED: The resource for which the policy detail is being requested. See the operation documentation for the appropriate value for this field.permissions
- The set of permissions to check for the `resource`. Permissions with wildcards (such as '*' or 'storage.*') are not allowed. For more information see [IAM Overview](https://cloud.google.com/iam/docs/overview#permissions).- Throws:
com.google.api.gax.rpc.ApiException
- if the remote call fails
-
testIamPermissions
public final com.google.iam.v1.TestIamPermissionsResponse testIamPermissions(com.google.iam.v1.TestIamPermissionsRequest request)
Returns the permissions that a caller has 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()) { TestIamPermissionsRequest request = TestIamPermissionsRequest.newBuilder() .setResource(SourceName.of("[ORGANIZATION]", "[SOURCE]").toString()) .addAllPermissions(new ArrayList<String>()) .build(); TestIamPermissionsResponse response = securityCenterClient.testIamPermissions(request); }
- Parameters:
request
- The request object containing all of the parameters for the API call.- Throws:
com.google.api.gax.rpc.ApiException
- if the remote call fails
-
testIamPermissionsCallable
public final com.google.api.gax.rpc.UnaryCallable<com.google.iam.v1.TestIamPermissionsRequest,com.google.iam.v1.TestIamPermissionsResponse> testIamPermissionsCallable()
Returns the permissions that a caller has 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()) { TestIamPermissionsRequest request = TestIamPermissionsRequest.newBuilder() .setResource(SourceName.of("[ORGANIZATION]", "[SOURCE]").toString()) .addAllPermissions(new ArrayList<String>()) .build(); ApiFuture<TestIamPermissionsResponse> future = securityCenterClient.testIamPermissionsCallable().futureCall(request); // Do something. TestIamPermissionsResponse response = future.get(); }
-
updateFinding
public final Finding updateFinding(Finding finding)
Creates or updates a finding. The corresponding source must exist for a 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()) { Finding finding = Finding.newBuilder().build(); Finding response = securityCenterClient.updateFinding(finding); }
- Parameters:
finding
- Required. The finding resource to update or create if it does not already exist. parent, security_marks, and update_time will be ignored.In the case of creation, the finding id portion of the name must alphanumeric and less than or equal to 32 characters and greater than 0 characters in length.
- Throws:
com.google.api.gax.rpc.ApiException
- if the remote call fails
-
updateFinding
public final Finding updateFinding(UpdateFindingRequest request)
Creates or updates a finding. The corresponding source must exist for a 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()) { UpdateFindingRequest request = UpdateFindingRequest.newBuilder() .setFinding(Finding.newBuilder().build()) .setUpdateMask(FieldMask.newBuilder().build()) .build(); Finding response = securityCenterClient.updateFinding(request); }
- Parameters:
request
- The request object containing all of the parameters for the API call.- Throws:
com.google.api.gax.rpc.ApiException
- if the remote call fails
-
updateFindingCallable
public final com.google.api.gax.rpc.UnaryCallable<UpdateFindingRequest,Finding> updateFindingCallable()
Creates or updates a finding. The corresponding source must exist for a 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()) { UpdateFindingRequest request = UpdateFindingRequest.newBuilder() .setFinding(Finding.newBuilder().build()) .setUpdateMask(FieldMask.newBuilder().build()) .build(); ApiFuture<Finding> future = securityCenterClient.updateFindingCallable().futureCall(request); // Do something. Finding response = future.get(); }
-
updateOrganizationSettings
public final OrganizationSettings updateOrganizationSettings(OrganizationSettings organizationSettings)
Updates an organization's settings.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()) { OrganizationSettings organizationSettings = OrganizationSettings.newBuilder().build(); OrganizationSettings response = securityCenterClient.updateOrganizationSettings(organizationSettings); }
- Parameters:
organizationSettings
- Required. The organization settings resource to update.- Throws:
com.google.api.gax.rpc.ApiException
- if the remote call fails
-
updateOrganizationSettings
public final OrganizationSettings updateOrganizationSettings(UpdateOrganizationSettingsRequest request)
Updates an organization's settings.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()) { UpdateOrganizationSettingsRequest request = UpdateOrganizationSettingsRequest.newBuilder() .setOrganizationSettings(OrganizationSettings.newBuilder().build()) .setUpdateMask(FieldMask.newBuilder().build()) .build(); OrganizationSettings response = securityCenterClient.updateOrganizationSettings(request); }
- Parameters:
request
- The request object containing all of the parameters for the API call.- Throws:
com.google.api.gax.rpc.ApiException
- if the remote call fails
-
updateOrganizationSettingsCallable
public final com.google.api.gax.rpc.UnaryCallable<UpdateOrganizationSettingsRequest,OrganizationSettings> updateOrganizationSettingsCallable()
Updates an organization's settings.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()) { UpdateOrganizationSettingsRequest request = UpdateOrganizationSettingsRequest.newBuilder() .setOrganizationSettings(OrganizationSettings.newBuilder().build()) .setUpdateMask(FieldMask.newBuilder().build()) .build(); ApiFuture<OrganizationSettings> future = securityCenterClient.updateOrganizationSettingsCallable().futureCall(request); // Do something. OrganizationSettings response = future.get(); }
-
updateSource
public final Source updateSource(Source source)
Updates 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()) { Source source = Source.newBuilder().build(); Source response = securityCenterClient.updateSource(source); }
- Parameters:
source
- Required. The source resource to update.- Throws:
com.google.api.gax.rpc.ApiException
- if the remote call fails
-
updateSource
public final Source updateSource(UpdateSourceRequest request)
Updates 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()) { UpdateSourceRequest request = UpdateSourceRequest.newBuilder() .setSource(Source.newBuilder().build()) .setUpdateMask(FieldMask.newBuilder().build()) .build(); Source response = securityCenterClient.updateSource(request); }
- Parameters:
request
- The request object containing all of the parameters for the API call.- Throws:
com.google.api.gax.rpc.ApiException
- if the remote call fails
-
updateSourceCallable
public final com.google.api.gax.rpc.UnaryCallable<UpdateSourceRequest,Source> updateSourceCallable()
Updates 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()) { UpdateSourceRequest request = UpdateSourceRequest.newBuilder() .setSource(Source.newBuilder().build()) .setUpdateMask(FieldMask.newBuilder().build()) .build(); ApiFuture<Source> future = securityCenterClient.updateSourceCallable().futureCall(request); // Do something. Source response = future.get(); }
-
updateSecurityMarks
public final SecurityMarks updateSecurityMarks(SecurityMarks securityMarks)
Updates security marks.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()) { SecurityMarks securityMarks = SecurityMarks.newBuilder().build(); SecurityMarks response = securityCenterClient.updateSecurityMarks(securityMarks); }
- Parameters:
securityMarks
- Required. The security marks resource to update.- Throws:
com.google.api.gax.rpc.ApiException
- if the remote call fails
-
updateSecurityMarks
public final SecurityMarks updateSecurityMarks(UpdateSecurityMarksRequest request)
Updates security marks.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()) { UpdateSecurityMarksRequest request = UpdateSecurityMarksRequest.newBuilder() .setSecurityMarks(SecurityMarks.newBuilder().build()) .setUpdateMask(FieldMask.newBuilder().build()) .setStartTime(Timestamp.newBuilder().build()) .build(); SecurityMarks response = securityCenterClient.updateSecurityMarks(request); }
- Parameters:
request
- The request object containing all of the parameters for the API call.- Throws:
com.google.api.gax.rpc.ApiException
- if the remote call fails
-
updateSecurityMarksCallable
public final com.google.api.gax.rpc.UnaryCallable<UpdateSecurityMarksRequest,SecurityMarks> updateSecurityMarksCallable()
Updates security marks.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()) { UpdateSecurityMarksRequest request = UpdateSecurityMarksRequest.newBuilder() .setSecurityMarks(SecurityMarks.newBuilder().build()) .setUpdateMask(FieldMask.newBuilder().build()) .setStartTime(Timestamp.newBuilder().build()) .build(); ApiFuture<SecurityMarks> future = securityCenterClient.updateSecurityMarksCallable().futureCall(request); // Do something. SecurityMarks response = future.get(); }
-
close
public final void close()
- Specified by:
close
in interfaceAutoCloseable
-
shutdown
public void shutdown()
- Specified by:
shutdown
in interfacecom.google.api.gax.core.BackgroundResource
-
isShutdown
public boolean isShutdown()
- Specified by:
isShutdown
in interfacecom.google.api.gax.core.BackgroundResource
-
isTerminated
public boolean isTerminated()
- Specified by:
isTerminated
in interfacecom.google.api.gax.core.BackgroundResource
-
shutdownNow
public void shutdownNow()
- Specified by:
shutdownNow
in interfacecom.google.api.gax.core.BackgroundResource
-
awaitTermination
public boolean awaitTermination(long duration, TimeUnit unit) throws InterruptedException
- Specified by:
awaitTermination
in interfacecom.google.api.gax.core.BackgroundResource
- Throws:
InterruptedException
-
-