@Generated(value="by gapic-generator") @BetaApi public class SecurityCenterClient extends Object implements BackgroundResource
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:
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:
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:
SecurityCenterSettings securityCenterSettings =
SecurityCenterSettings.newBuilder()
.setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
.build();
SecurityCenterClient securityCenterClient =
SecurityCenterClient.create(securityCenterSettings);
To customize the endpoint:
SecurityCenterSettings securityCenterSettings =
SecurityCenterSettings.newBuilder().setEndpoint(myEndpoint).build();
SecurityCenterClient securityCenterClient =
SecurityCenterClient.create(securityCenterSettings);
Modifier and Type | Class and 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 |
Modifier | Constructor and Description |
---|---|
protected |
SecurityCenterClient(SecurityCenterSettings settings)
Constructs an instance of SecurityCenterClient, using the given settings.
|
protected |
SecurityCenterClient(SecurityCenterStub stub) |
Modifier and Type | Method and 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.
|
com.google.cloud.securitycenter.v1.Finding |
createFinding(com.google.cloud.securitycenter.v1.CreateFindingRequest request)
Creates a finding.
|
com.google.cloud.securitycenter.v1.Finding |
createFinding(com.google.cloud.securitycenter.v1.SourceName parent,
String findingId,
com.google.cloud.securitycenter.v1.Finding finding)
Creates a finding.
|
com.google.cloud.securitycenter.v1.Finding |
createFinding(String parent,
String findingId,
com.google.cloud.securitycenter.v1.Finding finding)
Creates a finding.
|
UnaryCallable<com.google.cloud.securitycenter.v1.CreateFindingRequest,com.google.cloud.securitycenter.v1.Finding> |
createFindingCallable()
Creates a finding.
|
com.google.cloud.securitycenter.v1.Source |
createSource(com.google.cloud.securitycenter.v1.CreateSourceRequest request)
Creates a source.
|
com.google.cloud.securitycenter.v1.Source |
createSource(com.google.cloud.securitycenter.v1.OrganizationName parent,
com.google.cloud.securitycenter.v1.Source source)
Creates a source.
|
com.google.cloud.securitycenter.v1.Source |
createSource(String parent,
com.google.cloud.securitycenter.v1.Source source)
Creates a source.
|
UnaryCallable<com.google.cloud.securitycenter.v1.CreateSourceRequest,com.google.cloud.securitycenter.v1.Source> |
createSourceCallable()
Creates a 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(com.google.cloud.securitycenter.v1.SourceName resource)
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.
|
UnaryCallable<com.google.iam.v1.GetIamPolicyRequest,com.google.iam.v1.Policy> |
getIamPolicyCallable()
Gets the access control policy on the specified Source.
|
OperationsClient |
getOperationsClient()
Returns the OperationsClient that can be used to query the status of a long-running operation
returned by another API method call.
|
com.google.cloud.securitycenter.v1.OrganizationSettings |
getOrganizationSettings(com.google.cloud.securitycenter.v1.GetOrganizationSettingsRequest request)
Gets the settings for an organization.
|
com.google.cloud.securitycenter.v1.OrganizationSettings |
getOrganizationSettings(com.google.cloud.securitycenter.v1.OrganizationSettingsName name)
Gets the settings for an organization.
|
com.google.cloud.securitycenter.v1.OrganizationSettings |
getOrganizationSettings(String name)
Gets the settings for an organization.
|
UnaryCallable<com.google.cloud.securitycenter.v1.GetOrganizationSettingsRequest,com.google.cloud.securitycenter.v1.OrganizationSettings> |
getOrganizationSettingsCallable()
Gets the settings for an organization.
|
SecurityCenterSettings |
getSettings() |
com.google.cloud.securitycenter.v1.Source |
getSource(com.google.cloud.securitycenter.v1.GetSourceRequest request)
Gets a source.
|
com.google.cloud.securitycenter.v1.Source |
getSource(com.google.cloud.securitycenter.v1.SourceName name)
Gets a source.
|
com.google.cloud.securitycenter.v1.Source |
getSource(String name)
Gets a source.
|
UnaryCallable<com.google.cloud.securitycenter.v1.GetSourceRequest,com.google.cloud.securitycenter.v1.Source> |
getSourceCallable()
Gets a source.
|
SecurityCenterStub |
getStub() |
SecurityCenterClient.GroupAssetsPagedResponse |
groupAssets(com.google.cloud.securitycenter.v1.GroupAssetsRequest request)
Filters an organization's assets and groups them by their specified properties.
|
UnaryCallable<com.google.cloud.securitycenter.v1.GroupAssetsRequest,com.google.cloud.securitycenter.v1.GroupAssetsResponse> |
groupAssetsCallable()
Filters an organization's assets and groups them by their specified properties.
|
UnaryCallable<com.google.cloud.securitycenter.v1.GroupAssetsRequest,SecurityCenterClient.GroupAssetsPagedResponse> |
groupAssetsPagedCallable()
Filters an organization's assets and groups them by their specified properties.
|
SecurityCenterClient.GroupFindingsPagedResponse |
groupFindings(com.google.cloud.securitycenter.v1.GroupFindingsRequest request)
Filters an organization or source's findings and groups them by their specified properties.
|
SecurityCenterClient.GroupFindingsPagedResponse |
groupFindings(com.google.cloud.securitycenter.v1.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.
|
UnaryCallable<com.google.cloud.securitycenter.v1.GroupFindingsRequest,com.google.cloud.securitycenter.v1.GroupFindingsResponse> |
groupFindingsCallable()
Filters an organization or source's findings and groups them by their specified properties.
|
UnaryCallable<com.google.cloud.securitycenter.v1.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(com.google.cloud.securitycenter.v1.ListAssetsRequest request)
Lists an organization's assets.
|
UnaryCallable<com.google.cloud.securitycenter.v1.ListAssetsRequest,com.google.cloud.securitycenter.v1.ListAssetsResponse> |
listAssetsCallable()
Lists an organization's assets.
|
UnaryCallable<com.google.cloud.securitycenter.v1.ListAssetsRequest,SecurityCenterClient.ListAssetsPagedResponse> |
listAssetsPagedCallable()
Lists an organization's assets.
|
SecurityCenterClient.ListFindingsPagedResponse |
listFindings(com.google.cloud.securitycenter.v1.ListFindingsRequest request)
Lists an organization or source's findings.
|
UnaryCallable<com.google.cloud.securitycenter.v1.ListFindingsRequest,com.google.cloud.securitycenter.v1.ListFindingsResponse> |
listFindingsCallable()
Lists an organization or source's findings.
|
UnaryCallable<com.google.cloud.securitycenter.v1.ListFindingsRequest,SecurityCenterClient.ListFindingsPagedResponse> |
listFindingsPagedCallable()
Lists an organization or source's findings.
|
SecurityCenterClient.ListSourcesPagedResponse |
listSources(com.google.cloud.securitycenter.v1.ListSourcesRequest request)
Lists all sources belonging to an organization.
|
SecurityCenterClient.ListSourcesPagedResponse |
listSources(com.google.cloud.securitycenter.v1.OrganizationName parent)
Lists all sources belonging to an organization.
|
SecurityCenterClient.ListSourcesPagedResponse |
listSources(String parent)
Lists all sources belonging to an organization.
|
UnaryCallable<com.google.cloud.securitycenter.v1.ListSourcesRequest,com.google.cloud.securitycenter.v1.ListSourcesResponse> |
listSourcesCallable()
Lists all sources belonging to an organization.
|
UnaryCallable<com.google.cloud.securitycenter.v1.ListSourcesRequest,SecurityCenterClient.ListSourcesPagedResponse> |
listSourcesPagedCallable()
Lists all sources belonging to an organization.
|
OperationFuture<Empty,Empty> |
runAssetDiscoveryAsync(com.google.cloud.securitycenter.v1.OrganizationName parent)
Runs asset discovery.
|
OperationFuture<Empty,Empty> |
runAssetDiscoveryAsync(com.google.cloud.securitycenter.v1.RunAssetDiscoveryRequest request)
Runs asset discovery.
|
OperationFuture<Empty,Empty> |
runAssetDiscoveryAsync(String parent)
Runs asset discovery.
|
UnaryCallable<com.google.cloud.securitycenter.v1.RunAssetDiscoveryRequest,Operation> |
runAssetDiscoveryCallable()
Runs asset discovery.
|
OperationCallable<com.google.cloud.securitycenter.v1.RunAssetDiscoveryRequest,Empty,Empty> |
runAssetDiscoveryOperationCallable()
Runs asset discovery.
|
com.google.cloud.securitycenter.v1.Finding |
setFindingState(com.google.cloud.securitycenter.v1.FindingName name,
com.google.cloud.securitycenter.v1.Finding.State state,
Timestamp startTime)
Updates the state of a finding.
|
com.google.cloud.securitycenter.v1.Finding |
setFindingState(com.google.cloud.securitycenter.v1.SetFindingStateRequest request)
Updates the state of a finding.
|
com.google.cloud.securitycenter.v1.Finding |
setFindingState(String name,
com.google.cloud.securitycenter.v1.Finding.State state,
Timestamp startTime)
Updates the state of a finding.
|
UnaryCallable<com.google.cloud.securitycenter.v1.SetFindingStateRequest,com.google.cloud.securitycenter.v1.Finding> |
setFindingStateCallable()
Updates the state of a finding.
|
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(com.google.cloud.securitycenter.v1.SourceName resource,
com.google.iam.v1.Policy policy)
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.
|
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.cloud.securitycenter.v1.SourceName resource,
List<String> permissions)
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.iam.v1.TestIamPermissionsResponse |
testIamPermissions(com.google.iam.v1.TestIamPermissionsRequest request)
Returns the permissions that a caller has on the specified source.
|
UnaryCallable<com.google.iam.v1.TestIamPermissionsRequest,com.google.iam.v1.TestIamPermissionsResponse> |
testIamPermissionsCallable()
Returns the permissions that a caller has on the specified source.
|
com.google.cloud.securitycenter.v1.Finding |
updateFinding(com.google.cloud.securitycenter.v1.Finding finding)
Creates or updates a finding.
|
com.google.cloud.securitycenter.v1.Finding |
updateFinding(com.google.cloud.securitycenter.v1.UpdateFindingRequest request)
Creates or updates a finding.
|
UnaryCallable<com.google.cloud.securitycenter.v1.UpdateFindingRequest,com.google.cloud.securitycenter.v1.Finding> |
updateFindingCallable()
Creates or updates a finding.
|
com.google.cloud.securitycenter.v1.OrganizationSettings |
updateOrganizationSettings(com.google.cloud.securitycenter.v1.OrganizationSettings organizationSettings)
Updates an organization's settings.
|
com.google.cloud.securitycenter.v1.OrganizationSettings |
updateOrganizationSettings(com.google.cloud.securitycenter.v1.UpdateOrganizationSettingsRequest request)
Updates an organization's settings.
|
UnaryCallable<com.google.cloud.securitycenter.v1.UpdateOrganizationSettingsRequest,com.google.cloud.securitycenter.v1.OrganizationSettings> |
updateOrganizationSettingsCallable()
Updates an organization's settings.
|
com.google.cloud.securitycenter.v1.SecurityMarks |
updateSecurityMarks(com.google.cloud.securitycenter.v1.SecurityMarks securityMarks)
Updates security marks.
|
com.google.cloud.securitycenter.v1.SecurityMarks |
updateSecurityMarks(com.google.cloud.securitycenter.v1.UpdateSecurityMarksRequest request)
Updates security marks.
|
UnaryCallable<com.google.cloud.securitycenter.v1.UpdateSecurityMarksRequest,com.google.cloud.securitycenter.v1.SecurityMarks> |
updateSecurityMarksCallable()
Updates security marks.
|
com.google.cloud.securitycenter.v1.Source |
updateSource(com.google.cloud.securitycenter.v1.Source source)
Updates a source.
|
com.google.cloud.securitycenter.v1.Source |
updateSource(com.google.cloud.securitycenter.v1.UpdateSourceRequest request)
Updates a source.
|
UnaryCallable<com.google.cloud.securitycenter.v1.UpdateSourceRequest,com.google.cloud.securitycenter.v1.Source> |
updateSourceCallable()
Updates a source.
|
protected SecurityCenterClient(SecurityCenterSettings settings) throws IOException
IOException
@BetaApi(value="A restructuring of stub classes is planned, so this may break in the future") protected SecurityCenterClient(SecurityCenterStub stub)
public static final SecurityCenterClient create() throws IOException
IOException
public static final SecurityCenterClient create(SecurityCenterSettings settings) throws IOException
IOException
@BetaApi(value="A restructuring of stub classes is planned, so this may break in the future") public static final SecurityCenterClient create(SecurityCenterStub stub)
public final SecurityCenterSettings getSettings()
@BetaApi(value="A restructuring of stub classes is planned, so this may break in the future") public SecurityCenterStub getStub()
@BetaApi(value="The surface for long-running operations is not stable yet and may change in the future.") public final OperationsClient getOperationsClient()
public final com.google.cloud.securitycenter.v1.Source createSource(com.google.cloud.securitycenter.v1.OrganizationName parent, com.google.cloud.securitycenter.v1.Source source)
Sample code:
try (SecurityCenterClient securityCenterClient = SecurityCenterClient.create()) {
OrganizationName parent = OrganizationName.of("[ORGANIZATION]");
Source source = Source.newBuilder().build();
Source response = securityCenterClient.createSource(parent, source);
}
parent
- Resource name of the new source's parent. Its format should be
"organizations/[organization_id]".source
- The Source being created, only the display_name and description will be used. All
other fields will be ignored.ApiException
- if the remote call failspublic final com.google.cloud.securitycenter.v1.Source createSource(String parent, com.google.cloud.securitycenter.v1.Source source)
Sample code:
try (SecurityCenterClient securityCenterClient = SecurityCenterClient.create()) {
OrganizationName parent = OrganizationName.of("[ORGANIZATION]");
Source source = Source.newBuilder().build();
Source response = securityCenterClient.createSource(parent.toString(), source);
}
parent
- Resource name of the new source's parent. Its format should be
"organizations/[organization_id]".source
- The Source being created, only the display_name and description will be used. All
other fields will be ignored.ApiException
- if the remote call failspublic final com.google.cloud.securitycenter.v1.Source createSource(com.google.cloud.securitycenter.v1.CreateSourceRequest request)
Sample code:
try (SecurityCenterClient securityCenterClient = SecurityCenterClient.create()) {
OrganizationName parent = OrganizationName.of("[ORGANIZATION]");
Source source = Source.newBuilder().build();
CreateSourceRequest request = CreateSourceRequest.newBuilder()
.setParent(parent.toString())
.setSource(source)
.build();
Source response = securityCenterClient.createSource(request);
}
request
- The request object containing all of the parameters for the API call.ApiException
- if the remote call failspublic final UnaryCallable<com.google.cloud.securitycenter.v1.CreateSourceRequest,com.google.cloud.securitycenter.v1.Source> createSourceCallable()
Sample code:
try (SecurityCenterClient securityCenterClient = SecurityCenterClient.create()) {
OrganizationName parent = OrganizationName.of("[ORGANIZATION]");
Source source = Source.newBuilder().build();
CreateSourceRequest request = CreateSourceRequest.newBuilder()
.setParent(parent.toString())
.setSource(source)
.build();
ApiFuture<Source> future = securityCenterClient.createSourceCallable().futureCall(request);
// Do something
Source response = future.get();
}
public final com.google.cloud.securitycenter.v1.Finding createFinding(com.google.cloud.securitycenter.v1.SourceName parent, String findingId, com.google.cloud.securitycenter.v1.Finding finding)
Sample code:
try (SecurityCenterClient securityCenterClient = SecurityCenterClient.create()) {
SourceName parent = SourceName.of("[ORGANIZATION]", "[SOURCE]");
String findingId = "";
Finding finding = Finding.newBuilder().build();
Finding response = securityCenterClient.createFinding(parent, findingId, finding);
}
parent
- Resource name of the new finding's parent. Its format should be
"organizations/[organization_id]/sources/[source_id]".findingId
- 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
- The Finding being created. The name and security_marks will be ignored as they
are both output only fields on this resource.ApiException
- if the remote call failspublic final com.google.cloud.securitycenter.v1.Finding createFinding(String parent, String findingId, com.google.cloud.securitycenter.v1.Finding finding)
Sample code:
try (SecurityCenterClient securityCenterClient = SecurityCenterClient.create()) {
SourceName parent = SourceName.of("[ORGANIZATION]", "[SOURCE]");
String findingId = "";
Finding finding = Finding.newBuilder().build();
Finding response = securityCenterClient.createFinding(parent.toString(), findingId, finding);
}
parent
- Resource name of the new finding's parent. Its format should be
"organizations/[organization_id]/sources/[source_id]".findingId
- 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
- The Finding being created. The name and security_marks will be ignored as they
are both output only fields on this resource.ApiException
- if the remote call failspublic final com.google.cloud.securitycenter.v1.Finding createFinding(com.google.cloud.securitycenter.v1.CreateFindingRequest request)
Sample code:
try (SecurityCenterClient securityCenterClient = SecurityCenterClient.create()) {
SourceName parent = SourceName.of("[ORGANIZATION]", "[SOURCE]");
String findingId = "";
Finding finding = Finding.newBuilder().build();
CreateFindingRequest request = CreateFindingRequest.newBuilder()
.setParent(parent.toString())
.setFindingId(findingId)
.setFinding(finding)
.build();
Finding response = securityCenterClient.createFinding(request);
}
request
- The request object containing all of the parameters for the API call.ApiException
- if the remote call failspublic final UnaryCallable<com.google.cloud.securitycenter.v1.CreateFindingRequest,com.google.cloud.securitycenter.v1.Finding> createFindingCallable()
Sample code:
try (SecurityCenterClient securityCenterClient = SecurityCenterClient.create()) {
SourceName parent = SourceName.of("[ORGANIZATION]", "[SOURCE]");
String findingId = "";
Finding finding = Finding.newBuilder().build();
CreateFindingRequest request = CreateFindingRequest.newBuilder()
.setParent(parent.toString())
.setFindingId(findingId)
.setFinding(finding)
.build();
ApiFuture<Finding> future = securityCenterClient.createFindingCallable().futureCall(request);
// Do something
Finding response = future.get();
}
public final com.google.iam.v1.Policy getIamPolicy(com.google.cloud.securitycenter.v1.SourceName resource)
Sample code:
try (SecurityCenterClient securityCenterClient = SecurityCenterClient.create()) {
SourceName resource = SourceName.of("[ORGANIZATION]", "[SOURCE]");
Policy response = securityCenterClient.getIamPolicy(resource);
}
resource
- REQUIRED: The resource for which the policy is being requested. `resource` is
usually specified as a path. For example, a Project resource is specified as
`projects/{project}`.ApiException
- if the remote call failspublic final com.google.iam.v1.Policy getIamPolicy(String resource)
Sample code:
try (SecurityCenterClient securityCenterClient = SecurityCenterClient.create()) {
SourceName resource = SourceName.of("[ORGANIZATION]", "[SOURCE]");
Policy response = securityCenterClient.getIamPolicy(resource.toString());
}
resource
- REQUIRED: The resource for which the policy is being requested. `resource` is
usually specified as a path. For example, a Project resource is specified as
`projects/{project}`.ApiException
- if the remote call failspublic final com.google.iam.v1.Policy getIamPolicy(com.google.iam.v1.GetIamPolicyRequest request)
Sample code:
try (SecurityCenterClient securityCenterClient = SecurityCenterClient.create()) {
ResourceName resource = SourceName.of("[ORGANIZATION]", "[SOURCE]");
GetIamPolicyRequest request = GetIamPolicyRequest.newBuilder()
.setResource(resource.toString())
.build();
Policy response = securityCenterClient.getIamPolicy(request);
}
request
- The request object containing all of the parameters for the API call.ApiException
- if the remote call failspublic final UnaryCallable<com.google.iam.v1.GetIamPolicyRequest,com.google.iam.v1.Policy> getIamPolicyCallable()
Sample code:
try (SecurityCenterClient securityCenterClient = SecurityCenterClient.create()) {
ResourceName resource = SourceName.of("[ORGANIZATION]", "[SOURCE]");
GetIamPolicyRequest request = GetIamPolicyRequest.newBuilder()
.setResource(resource.toString())
.build();
ApiFuture<Policy> future = securityCenterClient.getIamPolicyCallable().futureCall(request);
// Do something
Policy response = future.get();
}
public final com.google.cloud.securitycenter.v1.OrganizationSettings getOrganizationSettings(com.google.cloud.securitycenter.v1.OrganizationSettingsName name)
Sample code:
try (SecurityCenterClient securityCenterClient = SecurityCenterClient.create()) {
OrganizationSettingsName name = OrganizationSettingsName.of("[ORGANIZATION]");
OrganizationSettings response = securityCenterClient.getOrganizationSettings(name);
}
name
- Name of the organization to get organization settings for. Its format is
"organizations/[organization_id]/organizationSettings".ApiException
- if the remote call failspublic final com.google.cloud.securitycenter.v1.OrganizationSettings getOrganizationSettings(String name)
Sample code:
try (SecurityCenterClient securityCenterClient = SecurityCenterClient.create()) {
OrganizationSettingsName name = OrganizationSettingsName.of("[ORGANIZATION]");
OrganizationSettings response = securityCenterClient.getOrganizationSettings(name.toString());
}
name
- Name of the organization to get organization settings for. Its format is
"organizations/[organization_id]/organizationSettings".ApiException
- if the remote call failspublic final com.google.cloud.securitycenter.v1.OrganizationSettings getOrganizationSettings(com.google.cloud.securitycenter.v1.GetOrganizationSettingsRequest request)
Sample code:
try (SecurityCenterClient securityCenterClient = SecurityCenterClient.create()) {
OrganizationSettingsName name = OrganizationSettingsName.of("[ORGANIZATION]");
GetOrganizationSettingsRequest request = GetOrganizationSettingsRequest.newBuilder()
.setName(name.toString())
.build();
OrganizationSettings response = securityCenterClient.getOrganizationSettings(request);
}
request
- The request object containing all of the parameters for the API call.ApiException
- if the remote call failspublic final UnaryCallable<com.google.cloud.securitycenter.v1.GetOrganizationSettingsRequest,com.google.cloud.securitycenter.v1.OrganizationSettings> getOrganizationSettingsCallable()
Sample code:
try (SecurityCenterClient securityCenterClient = SecurityCenterClient.create()) {
OrganizationSettingsName name = OrganizationSettingsName.of("[ORGANIZATION]");
GetOrganizationSettingsRequest request = GetOrganizationSettingsRequest.newBuilder()
.setName(name.toString())
.build();
ApiFuture<OrganizationSettings> future = securityCenterClient.getOrganizationSettingsCallable().futureCall(request);
// Do something
OrganizationSettings response = future.get();
}
public final com.google.cloud.securitycenter.v1.Source getSource(com.google.cloud.securitycenter.v1.SourceName name)
Sample code:
try (SecurityCenterClient securityCenterClient = SecurityCenterClient.create()) {
SourceName name = SourceName.of("[ORGANIZATION]", "[SOURCE]");
Source response = securityCenterClient.getSource(name);
}
name
- Relative resource name of the source. Its format is
"organizations/[organization_id]/source/[source_id]".ApiException
- if the remote call failspublic final com.google.cloud.securitycenter.v1.Source getSource(String name)
Sample code:
try (SecurityCenterClient securityCenterClient = SecurityCenterClient.create()) {
SourceName name = SourceName.of("[ORGANIZATION]", "[SOURCE]");
Source response = securityCenterClient.getSource(name.toString());
}
name
- Relative resource name of the source. Its format is
"organizations/[organization_id]/source/[source_id]".ApiException
- if the remote call failspublic final com.google.cloud.securitycenter.v1.Source getSource(com.google.cloud.securitycenter.v1.GetSourceRequest request)
Sample code:
try (SecurityCenterClient securityCenterClient = SecurityCenterClient.create()) {
SourceName name = SourceName.of("[ORGANIZATION]", "[SOURCE]");
GetSourceRequest request = GetSourceRequest.newBuilder()
.setName(name.toString())
.build();
Source response = securityCenterClient.getSource(request);
}
request
- The request object containing all of the parameters for the API call.ApiException
- if the remote call failspublic final UnaryCallable<com.google.cloud.securitycenter.v1.GetSourceRequest,com.google.cloud.securitycenter.v1.Source> getSourceCallable()
Sample code:
try (SecurityCenterClient securityCenterClient = SecurityCenterClient.create()) {
SourceName name = SourceName.of("[ORGANIZATION]", "[SOURCE]");
GetSourceRequest request = GetSourceRequest.newBuilder()
.setName(name.toString())
.build();
ApiFuture<Source> future = securityCenterClient.getSourceCallable().futureCall(request);
// Do something
Source response = future.get();
}
public final SecurityCenterClient.GroupAssetsPagedResponse groupAssets(com.google.cloud.securitycenter.v1.GroupAssetsRequest request)
Sample code:
try (SecurityCenterClient securityCenterClient = SecurityCenterClient.create()) {
OrganizationName parent = OrganizationName.of("[ORGANIZATION]");
String groupBy = "";
GroupAssetsRequest request = GroupAssetsRequest.newBuilder()
.setParent(parent.toString())
.setGroupBy(groupBy)
.build();
for (GroupResult element : securityCenterClient.groupAssets(request).iterateAll()) {
// doThingsWith(element);
}
}
request
- The request object containing all of the parameters for the API call.ApiException
- if the remote call failspublic final UnaryCallable<com.google.cloud.securitycenter.v1.GroupAssetsRequest,SecurityCenterClient.GroupAssetsPagedResponse> groupAssetsPagedCallable()
Sample code:
try (SecurityCenterClient securityCenterClient = SecurityCenterClient.create()) {
OrganizationName parent = OrganizationName.of("[ORGANIZATION]");
String groupBy = "";
GroupAssetsRequest request = GroupAssetsRequest.newBuilder()
.setParent(parent.toString())
.setGroupBy(groupBy)
.build();
ApiFuture<GroupAssetsPagedResponse> future = securityCenterClient.groupAssetsPagedCallable().futureCall(request);
// Do something
for (GroupResult element : future.get().iterateAll()) {
// doThingsWith(element);
}
}
public final UnaryCallable<com.google.cloud.securitycenter.v1.GroupAssetsRequest,com.google.cloud.securitycenter.v1.GroupAssetsResponse> groupAssetsCallable()
Sample code:
try (SecurityCenterClient securityCenterClient = SecurityCenterClient.create()) {
OrganizationName parent = OrganizationName.of("[ORGANIZATION]");
String groupBy = "";
GroupAssetsRequest request = GroupAssetsRequest.newBuilder()
.setParent(parent.toString())
.setGroupBy(groupBy)
.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;
}
}
}
public final SecurityCenterClient.GroupFindingsPagedResponse groupFindings(com.google.cloud.securitycenter.v1.SourceName parent, String groupBy)
To group across all sources provide a `-` as the source id. Example: /v1/organizations/123/sources/-/findings
Sample code:
try (SecurityCenterClient securityCenterClient = SecurityCenterClient.create()) {
SourceName parent = SourceName.of("[ORGANIZATION]", "[SOURCE]");
String groupBy = "";
for (GroupResult element : securityCenterClient.groupFindings(parent, groupBy).iterateAll()) {
// doThingsWith(element);
}
}
parent
- 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/123/sources/-groupBy
- Expression that defines what assets fields to use for grouping (including
`state_change`). 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
The following fields are supported when compare_duration is set:
* state_change
ApiException
- if the remote call failspublic final SecurityCenterClient.GroupFindingsPagedResponse groupFindings(String parent, String groupBy)
To group across all sources provide a `-` as the source id. Example: /v1/organizations/123/sources/-/findings
Sample code:
try (SecurityCenterClient securityCenterClient = SecurityCenterClient.create()) {
SourceName parent = SourceName.of("[ORGANIZATION]", "[SOURCE]");
String groupBy = "";
for (GroupResult element : securityCenterClient.groupFindings(parent.toString(), groupBy).iterateAll()) {
// doThingsWith(element);
}
}
parent
- 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/123/sources/-groupBy
- Expression that defines what assets fields to use for grouping (including
`state_change`). 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
The following fields are supported when compare_duration is set:
* state_change
ApiException
- if the remote call failspublic final SecurityCenterClient.GroupFindingsPagedResponse groupFindings(com.google.cloud.securitycenter.v1.GroupFindingsRequest request)
To group across all sources provide a `-` as the source id. Example: /v1/organizations/123/sources/-/findings
Sample code:
try (SecurityCenterClient securityCenterClient = SecurityCenterClient.create()) {
SourceName parent = SourceName.of("[ORGANIZATION]", "[SOURCE]");
String groupBy = "";
GroupFindingsRequest request = GroupFindingsRequest.newBuilder()
.setParent(parent.toString())
.setGroupBy(groupBy)
.build();
for (GroupResult element : securityCenterClient.groupFindings(request).iterateAll()) {
// doThingsWith(element);
}
}
request
- The request object containing all of the parameters for the API call.ApiException
- if the remote call failspublic final UnaryCallable<com.google.cloud.securitycenter.v1.GroupFindingsRequest,SecurityCenterClient.GroupFindingsPagedResponse> groupFindingsPagedCallable()
To group across all sources provide a `-` as the source id. Example: /v1/organizations/123/sources/-/findings
Sample code:
try (SecurityCenterClient securityCenterClient = SecurityCenterClient.create()) {
SourceName parent = SourceName.of("[ORGANIZATION]", "[SOURCE]");
String groupBy = "";
GroupFindingsRequest request = GroupFindingsRequest.newBuilder()
.setParent(parent.toString())
.setGroupBy(groupBy)
.build();
ApiFuture<GroupFindingsPagedResponse> future = securityCenterClient.groupFindingsPagedCallable().futureCall(request);
// Do something
for (GroupResult element : future.get().iterateAll()) {
// doThingsWith(element);
}
}
public final UnaryCallable<com.google.cloud.securitycenter.v1.GroupFindingsRequest,com.google.cloud.securitycenter.v1.GroupFindingsResponse> groupFindingsCallable()
To group across all sources provide a `-` as the source id. Example: /v1/organizations/123/sources/-/findings
Sample code:
try (SecurityCenterClient securityCenterClient = SecurityCenterClient.create()) {
SourceName parent = SourceName.of("[ORGANIZATION]", "[SOURCE]");
String groupBy = "";
GroupFindingsRequest request = GroupFindingsRequest.newBuilder()
.setParent(parent.toString())
.setGroupBy(groupBy)
.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;
}
}
}
public final SecurityCenterClient.ListAssetsPagedResponse listAssets(com.google.cloud.securitycenter.v1.ListAssetsRequest request)
Sample code:
try (SecurityCenterClient securityCenterClient = SecurityCenterClient.create()) {
OrganizationName parent = OrganizationName.of("[ORGANIZATION]");
ListAssetsRequest request = ListAssetsRequest.newBuilder()
.setParent(parent.toString())
.build();
for (ListAssetsResponse.ListAssetsResult element : securityCenterClient.listAssets(request).iterateAll()) {
// doThingsWith(element);
}
}
request
- The request object containing all of the parameters for the API call.ApiException
- if the remote call failspublic final UnaryCallable<com.google.cloud.securitycenter.v1.ListAssetsRequest,SecurityCenterClient.ListAssetsPagedResponse> listAssetsPagedCallable()
Sample code:
try (SecurityCenterClient securityCenterClient = SecurityCenterClient.create()) {
OrganizationName parent = OrganizationName.of("[ORGANIZATION]");
ListAssetsRequest request = ListAssetsRequest.newBuilder()
.setParent(parent.toString())
.build();
ApiFuture<ListAssetsPagedResponse> future = securityCenterClient.listAssetsPagedCallable().futureCall(request);
// Do something
for (ListAssetsResponse.ListAssetsResult element : future.get().iterateAll()) {
// doThingsWith(element);
}
}
public final UnaryCallable<com.google.cloud.securitycenter.v1.ListAssetsRequest,com.google.cloud.securitycenter.v1.ListAssetsResponse> listAssetsCallable()
Sample code:
try (SecurityCenterClient securityCenterClient = SecurityCenterClient.create()) {
OrganizationName parent = OrganizationName.of("[ORGANIZATION]");
ListAssetsRequest request = ListAssetsRequest.newBuilder()
.setParent(parent.toString())
.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;
}
}
}
public final SecurityCenterClient.ListFindingsPagedResponse listFindings(com.google.cloud.securitycenter.v1.ListFindingsRequest request)
To list across all sources provide a `-` as the source id. Example: /v1/organizations/123/sources/-/findings
Sample code:
try (SecurityCenterClient securityCenterClient = SecurityCenterClient.create()) {
SourceName parent = SourceName.of("[ORGANIZATION]", "[SOURCE]");
ListFindingsRequest request = ListFindingsRequest.newBuilder()
.setParent(parent.toString())
.build();
for (ListFindingsResponse.ListFindingsResult element : securityCenterClient.listFindings(request).iterateAll()) {
// doThingsWith(element);
}
}
request
- The request object containing all of the parameters for the API call.ApiException
- if the remote call failspublic final UnaryCallable<com.google.cloud.securitycenter.v1.ListFindingsRequest,SecurityCenterClient.ListFindingsPagedResponse> listFindingsPagedCallable()
To list across all sources provide a `-` as the source id. Example: /v1/organizations/123/sources/-/findings
Sample code:
try (SecurityCenterClient securityCenterClient = SecurityCenterClient.create()) {
SourceName parent = SourceName.of("[ORGANIZATION]", "[SOURCE]");
ListFindingsRequest request = ListFindingsRequest.newBuilder()
.setParent(parent.toString())
.build();
ApiFuture<ListFindingsPagedResponse> future = securityCenterClient.listFindingsPagedCallable().futureCall(request);
// Do something
for (ListFindingsResponse.ListFindingsResult element : future.get().iterateAll()) {
// doThingsWith(element);
}
}
public final UnaryCallable<com.google.cloud.securitycenter.v1.ListFindingsRequest,com.google.cloud.securitycenter.v1.ListFindingsResponse> listFindingsCallable()
To list across all sources provide a `-` as the source id. Example: /v1/organizations/123/sources/-/findings
Sample code:
try (SecurityCenterClient securityCenterClient = SecurityCenterClient.create()) {
SourceName parent = SourceName.of("[ORGANIZATION]", "[SOURCE]");
ListFindingsRequest request = ListFindingsRequest.newBuilder()
.setParent(parent.toString())
.build();
while (true) {
ListFindingsResponse response = securityCenterClient.listFindingsCallable().call(request);
for (ListFindingsResponse.ListFindingsResult element : response.getListFindingsResultsList()) {
// doThingsWith(element);
}
String nextPageToken = response.getNextPageToken();
if (!Strings.isNullOrEmpty(nextPageToken)) {
request = request.toBuilder().setPageToken(nextPageToken).build();
} else {
break;
}
}
}
public final SecurityCenterClient.ListSourcesPagedResponse listSources(com.google.cloud.securitycenter.v1.OrganizationName parent)
Sample code:
try (SecurityCenterClient securityCenterClient = SecurityCenterClient.create()) {
OrganizationName parent = OrganizationName.of("[ORGANIZATION]");
for (Source element : securityCenterClient.listSources(parent).iterateAll()) {
// doThingsWith(element);
}
}
parent
- Resource name of the parent of sources to list. Its format should be
"organizations/[organization_id]".ApiException
- if the remote call failspublic final SecurityCenterClient.ListSourcesPagedResponse listSources(String parent)
Sample code:
try (SecurityCenterClient securityCenterClient = SecurityCenterClient.create()) {
OrganizationName parent = OrganizationName.of("[ORGANIZATION]");
for (Source element : securityCenterClient.listSources(parent.toString()).iterateAll()) {
// doThingsWith(element);
}
}
parent
- Resource name of the parent of sources to list. Its format should be
"organizations/[organization_id]".ApiException
- if the remote call failspublic final SecurityCenterClient.ListSourcesPagedResponse listSources(com.google.cloud.securitycenter.v1.ListSourcesRequest request)
Sample code:
try (SecurityCenterClient securityCenterClient = SecurityCenterClient.create()) {
OrganizationName parent = OrganizationName.of("[ORGANIZATION]");
ListSourcesRequest request = ListSourcesRequest.newBuilder()
.setParent(parent.toString())
.build();
for (Source element : securityCenterClient.listSources(request).iterateAll()) {
// doThingsWith(element);
}
}
request
- The request object containing all of the parameters for the API call.ApiException
- if the remote call failspublic final UnaryCallable<com.google.cloud.securitycenter.v1.ListSourcesRequest,SecurityCenterClient.ListSourcesPagedResponse> listSourcesPagedCallable()
Sample code:
try (SecurityCenterClient securityCenterClient = SecurityCenterClient.create()) {
OrganizationName parent = OrganizationName.of("[ORGANIZATION]");
ListSourcesRequest request = ListSourcesRequest.newBuilder()
.setParent(parent.toString())
.build();
ApiFuture<ListSourcesPagedResponse> future = securityCenterClient.listSourcesPagedCallable().futureCall(request);
// Do something
for (Source element : future.get().iterateAll()) {
// doThingsWith(element);
}
}
public final UnaryCallable<com.google.cloud.securitycenter.v1.ListSourcesRequest,com.google.cloud.securitycenter.v1.ListSourcesResponse> listSourcesCallable()
Sample code:
try (SecurityCenterClient securityCenterClient = SecurityCenterClient.create()) {
OrganizationName parent = OrganizationName.of("[ORGANIZATION]");
ListSourcesRequest request = ListSourcesRequest.newBuilder()
.setParent(parent.toString())
.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;
}
}
}
@BetaApi(value="The surface for long-running operations is not stable yet and may change in the future.") public final OperationFuture<Empty,Empty> runAssetDiscoveryAsync(com.google.cloud.securitycenter.v1.OrganizationName parent)
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:
try (SecurityCenterClient securityCenterClient = SecurityCenterClient.create()) {
OrganizationName parent = OrganizationName.of("[ORGANIZATION]");
securityCenterClient.runAssetDiscoveryAsync(parent).get();
}
parent
- Name of the organization to run asset discovery for. Its format is
"organizations/[organization_id]".ApiException
- if the remote call fails@BetaApi(value="The surface for long-running operations is not stable yet and may change in the future.") public final OperationFuture<Empty,Empty> runAssetDiscoveryAsync(String parent)
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:
try (SecurityCenterClient securityCenterClient = SecurityCenterClient.create()) {
OrganizationName parent = OrganizationName.of("[ORGANIZATION]");
securityCenterClient.runAssetDiscoveryAsync(parent.toString()).get();
}
parent
- Name of the organization to run asset discovery for. Its format is
"organizations/[organization_id]".ApiException
- if the remote call fails@BetaApi(value="The surface for long-running operations is not stable yet and may change in the future.") public final OperationFuture<Empty,Empty> runAssetDiscoveryAsync(com.google.cloud.securitycenter.v1.RunAssetDiscoveryRequest request)
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:
try (SecurityCenterClient securityCenterClient = SecurityCenterClient.create()) {
OrganizationName parent = OrganizationName.of("[ORGANIZATION]");
RunAssetDiscoveryRequest request = RunAssetDiscoveryRequest.newBuilder()
.setParent(parent.toString())
.build();
securityCenterClient.runAssetDiscoveryAsync(request).get();
}
request
- The request object containing all of the parameters for the API call.ApiException
- if the remote call fails@BetaApi(value="The surface for use by generated code is not stable yet and may change in the future.") public final OperationCallable<com.google.cloud.securitycenter.v1.RunAssetDiscoveryRequest,Empty,Empty> runAssetDiscoveryOperationCallable()
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:
try (SecurityCenterClient securityCenterClient = SecurityCenterClient.create()) {
OrganizationName parent = OrganizationName.of("[ORGANIZATION]");
RunAssetDiscoveryRequest request = RunAssetDiscoveryRequest.newBuilder()
.setParent(parent.toString())
.build();
OperationFuture<Empty, Empty> future = securityCenterClient.runAssetDiscoveryOperationCallable().futureCall(request);
// Do something
future.get();
}
public final UnaryCallable<com.google.cloud.securitycenter.v1.RunAssetDiscoveryRequest,Operation> runAssetDiscoveryCallable()
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:
try (SecurityCenterClient securityCenterClient = SecurityCenterClient.create()) {
OrganizationName parent = OrganizationName.of("[ORGANIZATION]");
RunAssetDiscoveryRequest request = RunAssetDiscoveryRequest.newBuilder()
.setParent(parent.toString())
.build();
ApiFuture<Operation> future = securityCenterClient.runAssetDiscoveryCallable().futureCall(request);
// Do something
future.get();
}
public final com.google.cloud.securitycenter.v1.Finding setFindingState(com.google.cloud.securitycenter.v1.FindingName name, com.google.cloud.securitycenter.v1.Finding.State state, Timestamp startTime)
Sample code:
try (SecurityCenterClient securityCenterClient = SecurityCenterClient.create()) {
FindingName name = FindingName.of("[ORGANIZATION]", "[SOURCE]", "[FINDING]");
Finding.State state = Finding.State.STATE_UNSPECIFIED;
Timestamp startTime = Timestamp.newBuilder().build();
Finding response = securityCenterClient.setFindingState(name, state, startTime);
}
name
- The relative resource name of the finding. See:
https://cloud.google.com/apis/design/resource_names#relative_resource_name Example:
"organizations/123/sources/456/finding/789".state
- The desired State of the finding.startTime
- The time at which the updated state takes effect.ApiException
- if the remote call failspublic final com.google.cloud.securitycenter.v1.Finding setFindingState(String name, com.google.cloud.securitycenter.v1.Finding.State state, Timestamp startTime)
Sample code:
try (SecurityCenterClient securityCenterClient = SecurityCenterClient.create()) {
FindingName name = FindingName.of("[ORGANIZATION]", "[SOURCE]", "[FINDING]");
Finding.State state = Finding.State.STATE_UNSPECIFIED;
Timestamp startTime = Timestamp.newBuilder().build();
Finding response = securityCenterClient.setFindingState(name.toString(), state, startTime);
}
name
- The relative resource name of the finding. See:
https://cloud.google.com/apis/design/resource_names#relative_resource_name Example:
"organizations/123/sources/456/finding/789".state
- The desired State of the finding.startTime
- The time at which the updated state takes effect.ApiException
- if the remote call failspublic final com.google.cloud.securitycenter.v1.Finding setFindingState(com.google.cloud.securitycenter.v1.SetFindingStateRequest request)
Sample code:
try (SecurityCenterClient securityCenterClient = SecurityCenterClient.create()) {
FindingName name = FindingName.of("[ORGANIZATION]", "[SOURCE]", "[FINDING]");
Finding.State state = Finding.State.STATE_UNSPECIFIED;
Timestamp startTime = Timestamp.newBuilder().build();
SetFindingStateRequest request = SetFindingStateRequest.newBuilder()
.setName(name.toString())
.setState(state)
.setStartTime(startTime)
.build();
Finding response = securityCenterClient.setFindingState(request);
}
request
- The request object containing all of the parameters for the API call.ApiException
- if the remote call failspublic final UnaryCallable<com.google.cloud.securitycenter.v1.SetFindingStateRequest,com.google.cloud.securitycenter.v1.Finding> setFindingStateCallable()
Sample code:
try (SecurityCenterClient securityCenterClient = SecurityCenterClient.create()) {
FindingName name = FindingName.of("[ORGANIZATION]", "[SOURCE]", "[FINDING]");
Finding.State state = Finding.State.STATE_UNSPECIFIED;
Timestamp startTime = Timestamp.newBuilder().build();
SetFindingStateRequest request = SetFindingStateRequest.newBuilder()
.setName(name.toString())
.setState(state)
.setStartTime(startTime)
.build();
ApiFuture<Finding> future = securityCenterClient.setFindingStateCallable().futureCall(request);
// Do something
Finding response = future.get();
}
public final com.google.iam.v1.Policy setIamPolicy(com.google.cloud.securitycenter.v1.SourceName resource, com.google.iam.v1.Policy policy)
Sample code:
try (SecurityCenterClient securityCenterClient = SecurityCenterClient.create()) {
SourceName resource = SourceName.of("[ORGANIZATION]", "[SOURCE]");
Policy policy = Policy.newBuilder().build();
Policy response = securityCenterClient.setIamPolicy(resource, policy);
}
resource
- REQUIRED: The resource for which the policy is being specified. `resource` is
usually specified as a path. For example, a Project resource is specified as
`projects/{project}`.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.ApiException
- if the remote call failspublic final com.google.iam.v1.Policy setIamPolicy(String resource, com.google.iam.v1.Policy policy)
Sample code:
try (SecurityCenterClient securityCenterClient = SecurityCenterClient.create()) {
SourceName resource = SourceName.of("[ORGANIZATION]", "[SOURCE]");
Policy policy = Policy.newBuilder().build();
Policy response = securityCenterClient.setIamPolicy(resource.toString(), policy);
}
resource
- REQUIRED: The resource for which the policy is being specified. `resource` is
usually specified as a path. For example, a Project resource is specified as
`projects/{project}`.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.ApiException
- if the remote call failspublic final com.google.iam.v1.Policy setIamPolicy(com.google.iam.v1.SetIamPolicyRequest request)
Sample code:
try (SecurityCenterClient securityCenterClient = SecurityCenterClient.create()) {
ResourceName resource = SourceName.of("[ORGANIZATION]", "[SOURCE]");
Policy policy = Policy.newBuilder().build();
SetIamPolicyRequest request = SetIamPolicyRequest.newBuilder()
.setResource(resource.toString())
.setPolicy(policy)
.build();
Policy response = securityCenterClient.setIamPolicy(request);
}
request
- The request object containing all of the parameters for the API call.ApiException
- if the remote call failspublic final UnaryCallable<com.google.iam.v1.SetIamPolicyRequest,com.google.iam.v1.Policy> setIamPolicyCallable()
Sample code:
try (SecurityCenterClient securityCenterClient = SecurityCenterClient.create()) {
ResourceName resource = SourceName.of("[ORGANIZATION]", "[SOURCE]");
Policy policy = Policy.newBuilder().build();
SetIamPolicyRequest request = SetIamPolicyRequest.newBuilder()
.setResource(resource.toString())
.setPolicy(policy)
.build();
ApiFuture<Policy> future = securityCenterClient.setIamPolicyCallable().futureCall(request);
// Do something
Policy response = future.get();
}
public final com.google.iam.v1.TestIamPermissionsResponse testIamPermissions(com.google.cloud.securitycenter.v1.SourceName resource, List<String> permissions)
Sample code:
try (SecurityCenterClient securityCenterClient = SecurityCenterClient.create()) {
SourceName resource = SourceName.of("[ORGANIZATION]", "[SOURCE]");
List<String> permissions = new ArrayList<>();
TestIamPermissionsResponse response = securityCenterClient.testIamPermissions(resource, permissions);
}
resource
- REQUIRED: The resource for which the policy detail is being requested.
`resource` is usually specified as a path. For example, a Project resource is specified as
`projects/{project}`.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).ApiException
- if the remote call failspublic final com.google.iam.v1.TestIamPermissionsResponse testIamPermissions(String resource, List<String> permissions)
Sample code:
try (SecurityCenterClient securityCenterClient = SecurityCenterClient.create()) {
SourceName resource = SourceName.of("[ORGANIZATION]", "[SOURCE]");
List<String> permissions = new ArrayList<>();
TestIamPermissionsResponse response = securityCenterClient.testIamPermissions(resource.toString(), permissions);
}
resource
- REQUIRED: The resource for which the policy detail is being requested.
`resource` is usually specified as a path. For example, a Project resource is specified as
`projects/{project}`.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).ApiException
- if the remote call failspublic final com.google.iam.v1.TestIamPermissionsResponse testIamPermissions(com.google.iam.v1.TestIamPermissionsRequest request)
Sample code:
try (SecurityCenterClient securityCenterClient = SecurityCenterClient.create()) {
ResourceName resource = SourceName.of("[ORGANIZATION]", "[SOURCE]");
List<String> permissions = new ArrayList<>();
TestIamPermissionsRequest request = TestIamPermissionsRequest.newBuilder()
.setResource(resource.toString())
.addAllPermissions(permissions)
.build();
TestIamPermissionsResponse response = securityCenterClient.testIamPermissions(request);
}
request
- The request object containing all of the parameters for the API call.ApiException
- if the remote call failspublic final UnaryCallable<com.google.iam.v1.TestIamPermissionsRequest,com.google.iam.v1.TestIamPermissionsResponse> testIamPermissionsCallable()
Sample code:
try (SecurityCenterClient securityCenterClient = SecurityCenterClient.create()) {
ResourceName resource = SourceName.of("[ORGANIZATION]", "[SOURCE]");
List<String> permissions = new ArrayList<>();
TestIamPermissionsRequest request = TestIamPermissionsRequest.newBuilder()
.setResource(resource.toString())
.addAllPermissions(permissions)
.build();
ApiFuture<TestIamPermissionsResponse> future = securityCenterClient.testIamPermissionsCallable().futureCall(request);
// Do something
TestIamPermissionsResponse response = future.get();
}
public final com.google.cloud.securitycenter.v1.Finding updateFinding(com.google.cloud.securitycenter.v1.Finding finding)
Sample code:
try (SecurityCenterClient securityCenterClient = SecurityCenterClient.create()) {
Finding finding = Finding.newBuilder().build();
Finding response = securityCenterClient.updateFinding(finding);
}
finding
- 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 be alphanumeric and less than or equal to 32 characters and greater than 0 characters in length.
ApiException
- if the remote call failspublic final com.google.cloud.securitycenter.v1.Finding updateFinding(com.google.cloud.securitycenter.v1.UpdateFindingRequest request)
Sample code:
try (SecurityCenterClient securityCenterClient = SecurityCenterClient.create()) {
Finding finding = Finding.newBuilder().build();
UpdateFindingRequest request = UpdateFindingRequest.newBuilder()
.setFinding(finding)
.build();
Finding response = securityCenterClient.updateFinding(request);
}
request
- The request object containing all of the parameters for the API call.ApiException
- if the remote call failspublic final UnaryCallable<com.google.cloud.securitycenter.v1.UpdateFindingRequest,com.google.cloud.securitycenter.v1.Finding> updateFindingCallable()
Sample code:
try (SecurityCenterClient securityCenterClient = SecurityCenterClient.create()) {
Finding finding = Finding.newBuilder().build();
UpdateFindingRequest request = UpdateFindingRequest.newBuilder()
.setFinding(finding)
.build();
ApiFuture<Finding> future = securityCenterClient.updateFindingCallable().futureCall(request);
// Do something
Finding response = future.get();
}
public final com.google.cloud.securitycenter.v1.OrganizationSettings updateOrganizationSettings(com.google.cloud.securitycenter.v1.OrganizationSettings organizationSettings)
Sample code:
try (SecurityCenterClient securityCenterClient = SecurityCenterClient.create()) {
OrganizationSettings organizationSettings = OrganizationSettings.newBuilder().build();
OrganizationSettings response = securityCenterClient.updateOrganizationSettings(organizationSettings);
}
organizationSettings
- The organization settings resource to update.ApiException
- if the remote call failspublic final com.google.cloud.securitycenter.v1.OrganizationSettings updateOrganizationSettings(com.google.cloud.securitycenter.v1.UpdateOrganizationSettingsRequest request)
Sample code:
try (SecurityCenterClient securityCenterClient = SecurityCenterClient.create()) {
OrganizationSettings organizationSettings = OrganizationSettings.newBuilder().build();
UpdateOrganizationSettingsRequest request = UpdateOrganizationSettingsRequest.newBuilder()
.setOrganizationSettings(organizationSettings)
.build();
OrganizationSettings response = securityCenterClient.updateOrganizationSettings(request);
}
request
- The request object containing all of the parameters for the API call.ApiException
- if the remote call failspublic final UnaryCallable<com.google.cloud.securitycenter.v1.UpdateOrganizationSettingsRequest,com.google.cloud.securitycenter.v1.OrganizationSettings> updateOrganizationSettingsCallable()
Sample code:
try (SecurityCenterClient securityCenterClient = SecurityCenterClient.create()) {
OrganizationSettings organizationSettings = OrganizationSettings.newBuilder().build();
UpdateOrganizationSettingsRequest request = UpdateOrganizationSettingsRequest.newBuilder()
.setOrganizationSettings(organizationSettings)
.build();
ApiFuture<OrganizationSettings> future = securityCenterClient.updateOrganizationSettingsCallable().futureCall(request);
// Do something
OrganizationSettings response = future.get();
}
public final com.google.cloud.securitycenter.v1.Source updateSource(com.google.cloud.securitycenter.v1.Source source)
Sample code:
try (SecurityCenterClient securityCenterClient = SecurityCenterClient.create()) {
Source source = Source.newBuilder().build();
Source response = securityCenterClient.updateSource(source);
}
source
- The source resource to update.ApiException
- if the remote call failspublic final com.google.cloud.securitycenter.v1.Source updateSource(com.google.cloud.securitycenter.v1.UpdateSourceRequest request)
Sample code:
try (SecurityCenterClient securityCenterClient = SecurityCenterClient.create()) {
Source source = Source.newBuilder().build();
UpdateSourceRequest request = UpdateSourceRequest.newBuilder()
.setSource(source)
.build();
Source response = securityCenterClient.updateSource(request);
}
request
- The request object containing all of the parameters for the API call.ApiException
- if the remote call failspublic final UnaryCallable<com.google.cloud.securitycenter.v1.UpdateSourceRequest,com.google.cloud.securitycenter.v1.Source> updateSourceCallable()
Sample code:
try (SecurityCenterClient securityCenterClient = SecurityCenterClient.create()) {
Source source = Source.newBuilder().build();
UpdateSourceRequest request = UpdateSourceRequest.newBuilder()
.setSource(source)
.build();
ApiFuture<Source> future = securityCenterClient.updateSourceCallable().futureCall(request);
// Do something
Source response = future.get();
}
public final com.google.cloud.securitycenter.v1.SecurityMarks updateSecurityMarks(com.google.cloud.securitycenter.v1.SecurityMarks securityMarks)
Sample code:
try (SecurityCenterClient securityCenterClient = SecurityCenterClient.create()) {
SecurityMarks securityMarks = SecurityMarks.newBuilder().build();
SecurityMarks response = securityCenterClient.updateSecurityMarks(securityMarks);
}
securityMarks
- The security marks resource to update.ApiException
- if the remote call failspublic final com.google.cloud.securitycenter.v1.SecurityMarks updateSecurityMarks(com.google.cloud.securitycenter.v1.UpdateSecurityMarksRequest request)
Sample code:
try (SecurityCenterClient securityCenterClient = SecurityCenterClient.create()) {
SecurityMarks securityMarks = SecurityMarks.newBuilder().build();
UpdateSecurityMarksRequest request = UpdateSecurityMarksRequest.newBuilder()
.setSecurityMarks(securityMarks)
.build();
SecurityMarks response = securityCenterClient.updateSecurityMarks(request);
}
request
- The request object containing all of the parameters for the API call.ApiException
- if the remote call failspublic final UnaryCallable<com.google.cloud.securitycenter.v1.UpdateSecurityMarksRequest,com.google.cloud.securitycenter.v1.SecurityMarks> updateSecurityMarksCallable()
Sample code:
try (SecurityCenterClient securityCenterClient = SecurityCenterClient.create()) {
SecurityMarks securityMarks = SecurityMarks.newBuilder().build();
UpdateSecurityMarksRequest request = UpdateSecurityMarksRequest.newBuilder()
.setSecurityMarks(securityMarks)
.build();
ApiFuture<SecurityMarks> future = securityCenterClient.updateSecurityMarksCallable().futureCall(request);
// Do something
SecurityMarks response = future.get();
}
public final void close()
close
in interface AutoCloseable
public void shutdown()
shutdown
in interface BackgroundResource
public boolean isShutdown()
isShutdown
in interface BackgroundResource
public boolean isTerminated()
isTerminated
in interface BackgroundResource
public void shutdownNow()
shutdownNow
in interface BackgroundResource
public boolean awaitTermination(long duration, TimeUnit unit) throws InterruptedException
awaitTermination
in interface BackgroundResource
InterruptedException
Copyright © 2019 Google LLC. All rights reserved.