SecurityCenterClient(
transport=None,
channel=None,
credentials=None,
client_config=None,
client_info=None,
client_options=None,
)
V1 APIs for Security Center service.
Methods
SecurityCenterClient
SecurityCenterClient(
transport=None,
channel=None,
credentials=None,
client_config=None,
client_info=None,
client_options=None,
)
Constructor.
Parameters | |
---|---|
Name | Description |
channel |
grpc.Channel
DEPRECATED. A |
credentials |
google.auth.credentials.Credentials
The authorization credentials to attach to requests. These credentials identify this application to the service. If none are specified, the client will attempt to ascertain the credentials from the environment. This argument is mutually exclusive with providing a transport instance to |
client_config |
dict
DEPRECATED. A dictionary of call options for each method. If not specified, the default configuration is used. |
client_info |
google.api_core.gapic_v1.client_info.ClientInfo
The client info used to send a user-agent string along with API requests. If |
client_options |
Union[dict, google.api_core.client_options.ClientOptions]
Client options used to set user options on the client. API Endpoint should be set through client_options. |
asset_security_marks_path
asset_security_marks_path(organization, asset)
Return a fully-qualified asset_security_marks string.
create_finding
create_finding(parent, finding_id, finding, retry=<_MethodDefault._DEFAULT_VALUE: <object object>>, timeout=<_MethodDefault._DEFAULT_VALUE: <object object>>, metadata=None)
Creates a finding. The corresponding source must exist for finding creation to succeed.
.. rubric:: Example
from google.cloud import securitycenter_v1
client = securitycenter_v1.SecurityCenterClient()
parent = client.source_path('[ORGANIZATION]', '[SOURCE]')
TODO: Initialize
finding_id
:finding_id = ''
TODO: Initialize
finding
:finding = {}
response = client.create_finding(parent, finding_id, finding)
Parameters | |
---|---|
Name | Description |
parent |
str
Required. Resource name of the new finding's parent. Its format should be "organizations/[organization_id]/sources/[source_id]". |
finding_id |
str
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 |
Union[dict, Finding]
Required. The Finding being created. The name and security_marks will be ignored as they are both output only fields on this resource. If a dict is provided, it must be of the same form as the protobuf message Finding |
retry |
Optional[google.api_core.retry.Retry]
A retry object used to retry requests. If |
timeout |
Optional[float]
The amount of time, in seconds, to wait for the request to complete. Note that if |
metadata |
Optional[Sequence[Tuple[str, str]]]
Additional metadata that is provided to the method. |
Exceptions | |
---|---|
Type | Description |
google.api_core.exceptions.GoogleAPICallError | If the request failed for any reason. |
google.api_core.exceptions.RetryError | If the request failed due to a retryable error and retry attempts failed. |
ValueError | If the parameters are invalid. |
create_notification_config
create_notification_config(parent, config_id, notification_config, retry=<_MethodDefault._DEFAULT_VALUE: <object object>>, timeout=<_MethodDefault._DEFAULT_VALUE: <object object>>, metadata=None)
Creates a notification config.
.. rubric:: Example
from google.cloud import securitycenter_v1
client = securitycenter_v1.SecurityCenterClient()
parent = client.organization_path('[ORGANIZATION]')
TODO: Initialize
config_id
:config_id = ''
TODO: Initialize
notification_config
:notification_config = {}
response = client.create_notification_config(parent, config_id, notification_config)
Parameters | |
---|---|
Name | Description |
parent |
str
Required. Resource name of the new notification config's parent. Its format is "organizations/[organization_id]". |
config_id |
str
Required. Unique identifier provided by the client within the parent scope. It must be between 1 and 128 characters, and contains alphanumeric characters, underscores or hyphens only. |
notification_config |
Union[dict, NotificationConfig]
Required. The notification config being created. The name and the service account will be ignored as they are both output only fields on this resource. If a dict is provided, it must be of the same form as the protobuf message NotificationConfig |
retry |
Optional[google.api_core.retry.Retry]
A retry object used to retry requests. If |
timeout |
Optional[float]
The amount of time, in seconds, to wait for the request to complete. Note that if |
metadata |
Optional[Sequence[Tuple[str, str]]]
Additional metadata that is provided to the method. |
Exceptions | |
---|---|
Type | Description |
google.api_core.exceptions.GoogleAPICallError | If the request failed for any reason. |
google.api_core.exceptions.RetryError | If the request failed due to a retryable error and retry attempts failed. |
ValueError | If the parameters are invalid. |
create_source
create_source(parent, source, retry=<_MethodDefault._DEFAULT_VALUE: <object object>>, timeout=<_MethodDefault._DEFAULT_VALUE: <object object>>, metadata=None)
Creates a source.
.. rubric:: Example
from google.cloud import securitycenter_v1
client = securitycenter_v1.SecurityCenterClient()
parent = client.organization_path('[ORGANIZATION]')
TODO: Initialize
source
:source = {}
response = client.create_source(parent, source)
Parameters | |
---|---|
Name | Description |
parent |
str
Required. Resource name of the new source's parent. Its format should be "organizations/[organization_id]". |
source |
Union[dict, Source]
Required. The Source being created, only the display_name and description will be used. All other fields will be ignored. If a dict is provided, it must be of the same form as the protobuf message Source |
retry |
Optional[google.api_core.retry.Retry]
A retry object used to retry requests. If |
timeout |
Optional[float]
The amount of time, in seconds, to wait for the request to complete. Note that if |
metadata |
Optional[Sequence[Tuple[str, str]]]
Additional metadata that is provided to the method. |
Exceptions | |
---|---|
Type | Description |
google.api_core.exceptions.GoogleAPICallError | If the request failed for any reason. |
google.api_core.exceptions.RetryError | If the request failed due to a retryable error and retry attempts failed. |
ValueError | If the parameters are invalid. |
delete_notification_config
delete_notification_config(name, retry=<_MethodDefault._DEFAULT_VALUE: <object object>>, timeout=<_MethodDefault._DEFAULT_VALUE: <object object>>, metadata=None)
Deletes a notification config.
.. rubric:: Example
from google.cloud import securitycenter_v1
client = securitycenter_v1.SecurityCenterClient()
name = client.notification_config_path('[ORGANIZATION]', '[NOTIFICATION_CONFIG]')
client.delete_notification_config(name)
Parameters | |
---|---|
Name | Description |
name |
str
Required. Name of the notification config to delete. Its format is "organizations/[organization_id]/notificationConfigs/[config_id]". |
retry |
Optional[google.api_core.retry.Retry]
A retry object used to retry requests. If |
timeout |
Optional[float]
The amount of time, in seconds, to wait for the request to complete. Note that if |
metadata |
Optional[Sequence[Tuple[str, str]]]
Additional metadata that is provided to the method. |
Exceptions | |
---|---|
Type | Description |
google.api_core.exceptions.GoogleAPICallError | If the request failed for any reason. |
google.api_core.exceptions.RetryError | If the request failed due to a retryable error and retry attempts failed. |
ValueError | If the parameters are invalid. |
finding_path
finding_path(organization, source, finding)
Return a fully-qualified finding string.
finding_security_marks_path
finding_security_marks_path(organization, source, finding)
Return a fully-qualified finding_security_marks string.
from_service_account_file
from_service_account_file(filename, *args, **kwargs)
Creates an instance of this client using the provided credentials file.
Parameter | |
---|---|
Name | Description |
filename |
str
The path to the service account private key json file. |
Returns | |
---|---|
Type | Description |
SecurityCenterClient | The constructed client. |
from_service_account_json
from_service_account_json(filename, *args, **kwargs)
Creates an instance of this client using the provided credentials file.
Parameter | |
---|---|
Name | Description |
filename |
str
The path to the service account private key json file. |
Returns | |
---|---|
Type | Description |
SecurityCenterClient | The constructed client. |
get_iam_policy
get_iam_policy(resource, options_=None, retry=<_MethodDefault._DEFAULT_VALUE: <object object>>, timeout=<_MethodDefault._DEFAULT_VALUE: <object object>>, metadata=None)
Gets the access control policy on the specified Source.
.. rubric:: Example
from google.cloud import securitycenter_v1
client = securitycenter_v1.SecurityCenterClient()
TODO: Initialize
resource
:resource = ''
response = client.get_iam_policy(resource)
Parameters | |
---|---|
Name | Description |
resource |
str
REQUIRED: The resource for which the policy is being requested. See the operation documentation for the appropriate value for this field. |
options_ |
Union[dict, GetPolicyOptions]
OPTIONAL: A |
retry |
Optional[google.api_core.retry.Retry]
A retry object used to retry requests. If |
timeout |
Optional[float]
The amount of time, in seconds, to wait for the request to complete. Note that if |
metadata |
Optional[Sequence[Tuple[str, str]]]
Additional metadata that is provided to the method. |
Exceptions | |
---|---|
Type | Description |
google.api_core.exceptions.GoogleAPICallError | If the request failed for any reason. |
google.api_core.exceptions.RetryError | If the request failed due to a retryable error and retry attempts failed. |
ValueError | If the parameters are invalid. |
get_notification_config
get_notification_config(name, retry=<_MethodDefault._DEFAULT_VALUE: <object object>>, timeout=<_MethodDefault._DEFAULT_VALUE: <object object>>, metadata=None)
Gets a notification config.
.. rubric:: Example
from google.cloud import securitycenter_v1
client = securitycenter_v1.SecurityCenterClient()
name = client.notification_config_path('[ORGANIZATION]', '[NOTIFICATION_CONFIG]')
response = client.get_notification_config(name)
Parameters | |
---|---|
Name | Description |
name |
str
Required. Name of the notification config to get. Its format is "organizations/[organization_id]/notificationConfigs/[config_id]". |
retry |
Optional[google.api_core.retry.Retry]
A retry object used to retry requests. If |
timeout |
Optional[float]
The amount of time, in seconds, to wait for the request to complete. Note that if |
metadata |
Optional[Sequence[Tuple[str, str]]]
Additional metadata that is provided to the method. |
Exceptions | |
---|---|
Type | Description |
google.api_core.exceptions.GoogleAPICallError | If the request failed for any reason. |
google.api_core.exceptions.RetryError | If the request failed due to a retryable error and retry attempts failed. |
ValueError | If the parameters are invalid. |
get_organization_settings
get_organization_settings(name, retry=<_MethodDefault._DEFAULT_VALUE: <object object>>, timeout=<_MethodDefault._DEFAULT_VALUE: <object object>>, metadata=None)
Gets the settings for an organization.
.. rubric:: Example
from google.cloud import securitycenter_v1
client = securitycenter_v1.SecurityCenterClient()
name = client.organization_settings_path('[ORGANIZATION]')
response = client.get_organization_settings(name)
Parameters | |
---|---|
Name | Description |
name |
str
Required. Name of the organization to get organization settings for. Its format is "organizations/[organization_id]/organizationSettings". |
retry |
Optional[google.api_core.retry.Retry]
A retry object used to retry requests. If |
timeout |
Optional[float]
The amount of time, in seconds, to wait for the request to complete. Note that if |
metadata |
Optional[Sequence[Tuple[str, str]]]
Additional metadata that is provided to the method. |
Exceptions | |
---|---|
Type | Description |
google.api_core.exceptions.GoogleAPICallError | If the request failed for any reason. |
google.api_core.exceptions.RetryError | If the request failed due to a retryable error and retry attempts failed. |
ValueError | If the parameters are invalid. |
get_source
get_source(name, retry=<_MethodDefault._DEFAULT_VALUE: <object object>>, timeout=<_MethodDefault._DEFAULT_VALUE: <object object>>, metadata=None)
Gets a source.
.. rubric:: Example
from google.cloud import securitycenter_v1
client = securitycenter_v1.SecurityCenterClient()
name = client.source_path('[ORGANIZATION]', '[SOURCE]')
response = client.get_source(name)
Parameters | |
---|---|
Name | Description |
name |
str
Required. Relative resource name of the source. Its format is "organizations/[organization_id]/source/[source_id]". |
retry |
Optional[google.api_core.retry.Retry]
A retry object used to retry requests. If |
timeout |
Optional[float]
The amount of time, in seconds, to wait for the request to complete. Note that if |
metadata |
Optional[Sequence[Tuple[str, str]]]
Additional metadata that is provided to the method. |
Exceptions | |
---|---|
Type | Description |
google.api_core.exceptions.GoogleAPICallError | If the request failed for any reason. |
google.api_core.exceptions.RetryError | If the request failed due to a retryable error and retry attempts failed. |
ValueError | If the parameters are invalid. |
group_assets
group_assets(parent, group_by, filter_=None, compare_duration=None, read_time=None, page_size=None, retry=<_MethodDefault._DEFAULT_VALUE: <object object>>, timeout=<_MethodDefault._DEFAULT_VALUE: <object object>>, metadata=None)
Filters an organization's assets and groups them by their specified properties.
.. rubric:: Example
from google.cloud import securitycenter_v1
client = securitycenter_v1.SecurityCenterClient()
parent = client.organization_path('[ORGANIZATION]')
TODO: Initialize
group_by
:group_by = ''
Iterate over all results
for element in client.group_assets(parent, group_by): ... # process element ... pass
Alternatively:
Iterate over results one page at a time
for page in client.group_assets(parent, group_by).pages: ... for element in page: ... # process element ... pass
Parameters | |
---|---|
Name | Description |
parent |
str
Required. Name of the organization to groupBy. Its format is "organizations/[organization_id]". |
group_by |
str
Required. Expression that defines what assets fields to use for grouping. The string value should follow SQL syntax: comma separated list of fields. For example: "security_center_properties.resource_project,security_center_properties.project". The following fields are supported when compare_duration is not set: - security_center_properties.resource_project - security_center_properties.resource_project_display_name - security_center_properties.resource_type - security_center_properties.resource_parent - security_center_properties.resource_parent_display_name The following fields are supported when compare_duration is set: - security_center_properties.resource_type - security_center_properties.resource_project_display_name - security_center_properties.resource_parent_display_name |
filter_ |
str
Expression that defines the filter to apply across assets. The expression is a list of zero or more restrictions combined via logical operators |
compare_duration |
Union[dict, Duration]
When compare_duration is set, the GroupResult's "state_change" property is updated to indicate whether the asset was added, removed, or remained present during the compare_duration period of time that precedes the read_time. This is the time between (read_time - compare_duration) and read_time. The state change value is derived based on the presence of the asset at the two points in time. Intermediate state changes between the two times don't affect the result. For example, the results aren't affected if the asset is removed and re-created again. Possible "state_change" values when compare_duration is specified: - "ADDED": indicates that the asset was not present at the start of compare_duration, but present at reference_time. - "REMOVED": indicates that the asset was present at the start of compare_duration, but not present at reference_time. - "ACTIVE": indicates that the asset was present at both the start and the end of the time period defined by compare_duration and reference_time. If compare_duration is not specified, then the only possible state_change is "UNUSED", which will be the state_change set for all assets present at read_time. If this field is set then |
read_time |
Union[dict, Timestamp]
Time used as a reference point when filtering assets. The filter is limited to assets existing at the supplied time and their values are those at that specific time. Absence of this field will default to the API's version of NOW. If a dict is provided, it must be of the same form as the protobuf message Timestamp |
page_size |
int
The maximum number of resources contained in the underlying API response. If page streaming is performed per- resource, this parameter does not affect the return value. If page streaming is performed per-page, this determines the maximum number of resources in a page. |
retry |
Optional[google.api_core.retry.Retry]
A retry object used to retry requests. If |
timeout |
Optional[float]
The amount of time, in seconds, to wait for the request to complete. Note that if |
metadata |
Optional[Sequence[Tuple[str, str]]]
Additional metadata that is provided to the method. |
Exceptions | |
---|---|
Type | Description |
google.api_core.exceptions.GoogleAPICallError | If the request failed for any reason. |
google.api_core.exceptions.RetryError | If the request failed due to a retryable error and retry attempts failed. |
ValueError | If the parameters are invalid. |
group_findings
group_findings(parent, group_by, filter_=None, read_time=None, compare_duration=None, page_size=None, retry=<_MethodDefault._DEFAULT_VALUE: <object object>>, timeout=<_MethodDefault._DEFAULT_VALUE: <object object>>, metadata=None)
Filters an organization or source's findings and groups them by their specified properties.
To group across all sources provide a -
as the source id. Example:
/v1/organizations/{organization_id}/sources/-/findings
.. rubric:: Example
from google.cloud import securitycenter_v1
client = securitycenter_v1.SecurityCenterClient()
parent = client.source_path('[ORGANIZATION]', '[SOURCE]')
TODO: Initialize
group_by
:group_by = ''
Iterate over all results
for element in client.group_findings(parent, group_by): ... # process element ... pass
Alternatively:
Iterate over results one page at a time
for page in client.group_findings(parent, group_by).pages: ... for element in page: ... # process element ... pass
Parameters | |
---|---|
Name | Description |
parent |
str
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 |
group_by |
str
Required. Expression that defines what assets fields to use for grouping (including |
filter_ |
str
Expression that defines the filter to apply across findings. The expression is a list of one or more restrictions combined via logical operators |
read_time |
Union[dict, Timestamp]
Time used as a reference point when filtering findings. The filter is limited to findings existing at the supplied time and their values are those at that specific time. Absence of this field will default to the API's version of NOW. If a dict is provided, it must be of the same form as the protobuf message Timestamp |
compare_duration |
Union[dict, Duration]
When compare_duration is set, the GroupResult's "state_change" attribute is updated to indicate whether the finding had its state changed, the finding's state remained unchanged, or if the finding was added during the compare_duration period of time that precedes the read_time. This is the time between (read_time - compare_duration) and read_time. The state_change value is derived based on the presence and state of the finding at the two points in time. Intermediate state changes between the two times don't affect the result. For example, the results aren't affected if the finding is made inactive and then active again. Possible "state_change" values when compare_duration is specified: - "CHANGED": indicates that the finding was present and matched the given filter at the start of compare_duration, but changed its state at read_time. - "UNCHANGED": indicates that the finding was present and matched the given filter at the start of compare_duration and did not change state at read_time. - "ADDED": indicates that the finding did not match the given filter or was not present at the start of compare_duration, but was present at read_time. - "REMOVED": indicates that the finding was present and matched the filter at the start of compare_duration, but did not match the filter at read_time. If compare_duration is not specified, then the only possible state_change is "UNUSED", which will be the state_change set for all findings present at read_time. If this field is set then |
page_size |
int
The maximum number of resources contained in the underlying API response. If page streaming is performed per- resource, this parameter does not affect the return value. If page streaming is performed per-page, this determines the maximum number of resources in a page. |
retry |
Optional[google.api_core.retry.Retry]
A retry object used to retry requests. If |
timeout |
Optional[float]
The amount of time, in seconds, to wait for the request to complete. Note that if |
metadata |
Optional[Sequence[Tuple[str, str]]]
Additional metadata that is provided to the method. |
Exceptions | |
---|---|
Type | Description |
google.api_core.exceptions.GoogleAPICallError | If the request failed for any reason. |
google.api_core.exceptions.RetryError | If the request failed due to a retryable error and retry attempts failed. |
ValueError | If the parameters are invalid. |
list_assets
list_assets(parent, filter_=None, order_by=None, read_time=None, compare_duration=None, field_mask=None, page_size=None, retry=<_MethodDefault._DEFAULT_VALUE: <object object>>, timeout=<_MethodDefault._DEFAULT_VALUE: <object object>>, metadata=None)
Lists an organization's assets.
.. rubric:: Example
from google.cloud import securitycenter_v1
client = securitycenter_v1.SecurityCenterClient()
parent = client.organization_path('[ORGANIZATION]')
Iterate over all results
for element in client.list_assets(parent): ... # process element ... pass
Alternatively:
Iterate over results one page at a time
for page in client.list_assets(parent).pages: ... for element in page: ... # process element ... pass
Parameters | |
---|---|
Name | Description |
parent |
str
Required. Name of the organization assets should belong to. Its format is "organizations/[organization_id]". |
filter_ |
str
Expression that defines the filter to apply across assets. The expression is a list of zero or more restrictions combined via logical operators |
order_by |
str
Expression that defines what fields and order to use for sorting. The string value should follow SQL syntax: comma separated list of fields. For example: "name,resource_properties.a_property". The default sorting order is ascending. To specify descending order for a field, a suffix " desc" should be appended to the field name. For example: "name desc,resource_properties.a_property". Redundant space characters in the syntax are insignificant. "name desc,resource_properties.a_property" and " name desc , resource_properties.a_property " are equivalent. The following fields are supported: name update_time resource_properties security_marks.marks security_center_properties.resource_name security_center_properties.resource_display_name security_center_properties.resource_parent security_center_properties.resource_parent_display_name security_center_properties.resource_project security_center_properties.resource_project_display_name security_center_properties.resource_type |
read_time |
Union[dict, Timestamp]
Time used as a reference point when filtering assets. The filter is limited to assets existing at the supplied time and their values are those at that specific time. Absence of this field will default to the API's version of NOW. If a dict is provided, it must be of the same form as the protobuf message Timestamp |
compare_duration |
Union[dict, Duration]
When compare_duration is set, the ListAssetsResult's "state_change" attribute is updated to indicate whether the asset was added, removed, or remained present during the compare_duration period of time that precedes the read_time. This is the time between (read_time - compare_duration) and read_time. The state_change value is derived based on the presence of the asset at the two points in time. Intermediate state changes between the two times don't affect the result. For example, the results aren't affected if the asset is removed and re-created again. Possible "state_change" values when compare_duration is specified: - "ADDED": indicates that the asset was not present at the start of compare_duration, but present at read_time. - "REMOVED": indicates that the asset was present at the start of compare_duration, but not present at read_time. - "ACTIVE": indicates that the asset was present at both the start and the end of the time period defined by compare_duration and read_time. If compare_duration is not specified, then the only possible state_change is "UNUSED", which will be the state_change set for all assets present at read_time. If a dict is provided, it must be of the same form as the protobuf message Duration |
field_mask |
Union[dict, FieldMask]
Optional. A field mask to specify the ListAssetsResult fields to be listed in the response. An empty field mask will list all fields. If a dict is provided, it must be of the same form as the protobuf message FieldMask |
page_size |
int
The maximum number of resources contained in the underlying API response. If page streaming is performed per- resource, this parameter does not affect the return value. If page streaming is performed per-page, this determines the maximum number of resources in a page. |
retry |
Optional[google.api_core.retry.Retry]
A retry object used to retry requests. If |
timeout |
Optional[float]
The amount of time, in seconds, to wait for the request to complete. Note that if |
metadata |
Optional[Sequence[Tuple[str, str]]]
Additional metadata that is provided to the method. |
Exceptions | |
---|---|
Type | Description |
google.api_core.exceptions.GoogleAPICallError | If the request failed for any reason. |
google.api_core.exceptions.RetryError | If the request failed due to a retryable error and retry attempts failed. |
ValueError | If the parameters are invalid. |
list_findings
list_findings(parent, filter_=None, order_by=None, read_time=None, compare_duration=None, field_mask=None, page_size=None, retry=<_MethodDefault._DEFAULT_VALUE: <object object>>, timeout=<_MethodDefault._DEFAULT_VALUE: <object object>>, metadata=None)
Lists an organization or source's findings.
To list across all sources provide a -
as the source id. Example:
/v1/organizations/{organization_id}/sources/-/findings
.. rubric:: Example
from google.cloud import securitycenter_v1
client = securitycenter_v1.SecurityCenterClient()
parent = client.source_path('[ORGANIZATION]', '[SOURCE]')
Iterate over all results
for element in client.list_findings(parent): ... # process element ... pass
Alternatively:
Iterate over results one page at a time
for page in client.list_findings(parent).pages: ... for element in page: ... # process element ... pass
Parameters | |
---|---|
Name | Description |
parent |
str
Required. Name of the source the findings belong to. Its format is "organizations/[organization_id]/sources/[source_id]". To list across all sources provide a source_id of |
filter_ |
str
Expression that defines the filter to apply across findings. The expression is a list of one or more restrictions combined via logical operators |
order_by |
str
Expression that defines what fields and order to use for sorting. The string value should follow SQL syntax: comma separated list of fields. For example: "name,resource_properties.a_property". The default sorting order is ascending. To specify descending order for a field, a suffix " desc" should be appended to the field name. For example: "name desc,source_properties.a_property". Redundant space characters in the syntax are insignificant. "name desc,source_properties.a_property" and " name desc , source_properties.a_property " are equivalent. The following fields are supported: name parent state category resource_name event_time source_properties security_marks.marks |
read_time |
Union[dict, Timestamp]
Time used as a reference point when filtering findings. The filter is limited to findings existing at the supplied time and their values are those at that specific time. Absence of this field will default to the API's version of NOW. If a dict is provided, it must be of the same form as the protobuf message Timestamp |
compare_duration |
Union[dict, Duration]
When compare_duration is set, the ListFindingsResult's "state_change" attribute is updated to indicate whether the finding had its state changed, the finding's state remained unchanged, or if the finding was added in any state during the compare_duration period of time that precedes the read_time. This is the time between (read_time - compare_duration) and read_time. The state_change value is derived based on the presence and state of the finding at the two points in time. Intermediate state changes between the two times don't affect the result. For example, the results aren't affected if the finding is made inactive and then active again. Possible "state_change" values when compare_duration is specified: - "CHANGED": indicates that the finding was present and matched the given filter at the start of compare_duration, but changed its state at read_time. - "UNCHANGED": indicates that the finding was present and matched the given filter at the start of compare_duration and did not change state at read_time. - "ADDED": indicates that the finding did not match the given filter or was not present at the start of compare_duration, but was present at read_time. - "REMOVED": indicates that the finding was present and matched the filter at the start of compare_duration, but did not match the filter at read_time. If compare_duration is not specified, then the only possible state_change is "UNUSED", which will be the state_change set for all findings present at read_time. If a dict is provided, it must be of the same form as the protobuf message Duration |
field_mask |
Union[dict, FieldMask]
Optional. A field mask to specify the Finding fields to be listed in the response. An empty field mask will list all fields. If a dict is provided, it must be of the same form as the protobuf message FieldMask |
page_size |
int
The maximum number of resources contained in the underlying API response. If page streaming is performed per- resource, this parameter does not affect the return value. If page streaming is performed per-page, this determines the maximum number of resources in a page. |
retry |
Optional[google.api_core.retry.Retry]
A retry object used to retry requests. If |
timeout |
Optional[float]
The amount of time, in seconds, to wait for the request to complete. Note that if |
metadata |
Optional[Sequence[Tuple[str, str]]]
Additional metadata that is provided to the method. |
Exceptions | |
---|---|
Type | Description |
google.api_core.exceptions.GoogleAPICallError | If the request failed for any reason. |
google.api_core.exceptions.RetryError | If the request failed due to a retryable error and retry attempts failed. |
ValueError | If the parameters are invalid. |
list_notification_configs
list_notification_configs(parent, page_size=None, retry=<_MethodDefault._DEFAULT_VALUE: <object object>>, timeout=<_MethodDefault._DEFAULT_VALUE: <object object>>, metadata=None)
Lists notification configs.
.. rubric:: Example
from google.cloud import securitycenter_v1
client = securitycenter_v1.SecurityCenterClient()
parent = client.organization_path('[ORGANIZATION]')
Iterate over all results
for element in client.list_notification_configs(parent): ... # process element ... pass
Alternatively:
Iterate over results one page at a time
for page in client.list_notification_configs(parent).pages: ... for element in page: ... # process element ... pass
Parameters | |
---|---|
Name | Description |
parent |
str
Required. Name of the organization to list notification configs. Its format is "organizations/[organization_id]". |
page_size |
int
The maximum number of resources contained in the underlying API response. If page streaming is performed per- resource, this parameter does not affect the return value. If page streaming is performed per-page, this determines the maximum number of resources in a page. |
retry |
Optional[google.api_core.retry.Retry]
A retry object used to retry requests. If |
timeout |
Optional[float]
The amount of time, in seconds, to wait for the request to complete. Note that if |
metadata |
Optional[Sequence[Tuple[str, str]]]
Additional metadata that is provided to the method. |
Exceptions | |
---|---|
Type | Description |
google.api_core.exceptions.GoogleAPICallError | If the request failed for any reason. |
google.api_core.exceptions.RetryError | If the request failed due to a retryable error and retry attempts failed. |
ValueError | If the parameters are invalid. |
list_sources
list_sources(parent, page_size=None, retry=<_MethodDefault._DEFAULT_VALUE: <object object>>, timeout=<_MethodDefault._DEFAULT_VALUE: <object object>>, metadata=None)
Lists all sources belonging to an organization.
.. rubric:: Example
from google.cloud import securitycenter_v1
client = securitycenter_v1.SecurityCenterClient()
parent = client.organization_path('[ORGANIZATION]')
Iterate over all results
for element in client.list_sources(parent): ... # process element ... pass
Alternatively:
Iterate over results one page at a time
for page in client.list_sources(parent).pages: ... for element in page: ... # process element ... pass
Parameters | |
---|---|
Name | Description |
parent |
str
Required. Resource name of the parent of sources to list. Its format should be "organizations/[organization_id]". |
page_size |
int
The maximum number of resources contained in the underlying API response. If page streaming is performed per- resource, this parameter does not affect the return value. If page streaming is performed per-page, this determines the maximum number of resources in a page. |
retry |
Optional[google.api_core.retry.Retry]
A retry object used to retry requests. If |
timeout |
Optional[float]
The amount of time, in seconds, to wait for the request to complete. Note that if |
metadata |
Optional[Sequence[Tuple[str, str]]]
Additional metadata that is provided to the method. |
Exceptions | |
---|---|
Type | Description |
google.api_core.exceptions.GoogleAPICallError | If the request failed for any reason. |
google.api_core.exceptions.RetryError | If the request failed due to a retryable error and retry attempts failed. |
ValueError | If the parameters are invalid. |
notification_config_path
notification_config_path(organization, notification_config)
Return a fully-qualified notification_config string.
organization_path
organization_path(organization)
Return a fully-qualified organization string.
organization_settings_path
organization_settings_path(organization)
Return a fully-qualified organization_settings string.
run_asset_discovery
run_asset_discovery(parent, retry=<_MethodDefault._DEFAULT_VALUE: <object object>>, timeout=<_MethodDefault._DEFAULT_VALUE: <object object>>, metadata=None)
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.
.. rubric:: Example
from google.cloud import securitycenter_v1
client = securitycenter_v1.SecurityCenterClient()
parent = client.organization_path('[ORGANIZATION]')
response = client.run_asset_discovery(parent)
def callback(operation_future): ... # Handle result. ... result = operation_future.result()
response.add_done_callback(callback)
Handle metadata.
metadata = response.metadata()
Parameters | |
---|---|
Name | Description |
parent |
str
Required. Name of the organization to run asset discovery for. Its format is "organizations/[organization_id]". |
retry |
Optional[google.api_core.retry.Retry]
A retry object used to retry requests. If |
timeout |
Optional[float]
The amount of time, in seconds, to wait for the request to complete. Note that if |
metadata |
Optional[Sequence[Tuple[str, str]]]
Additional metadata that is provided to the method. |
Exceptions | |
---|---|
Type | Description |
google.api_core.exceptions.GoogleAPICallError | If the request failed for any reason. |
google.api_core.exceptions.RetryError | If the request failed due to a retryable error and retry attempts failed. |
ValueError | If the parameters are invalid. |
set_finding_state
set_finding_state(name, state, start_time, retry=<_MethodDefault._DEFAULT_VALUE: <object object>>, timeout=<_MethodDefault._DEFAULT_VALUE: <object object>>, metadata=None)
Updates the state of a finding.
.. rubric:: Example
from google.cloud import securitycenter_v1 from google.cloud.securitycenter_v1 import enums
client = securitycenter_v1.SecurityCenterClient()
name = client.finding_path('[ORGANIZATION]', '[SOURCE]', '[FINDING]')
TODO: Initialize
state
:state = enums.Finding.State.STATE_UNSPECIFIED
TODO: Initialize
start_time
:start_time = {}
response = client.set_finding_state(name, state, start_time)
Parameters | |
---|---|
Name | Description |
name |
str
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 |
State
Required. The desired State of the finding. |
start_time |
Union[dict, Timestamp]
Required. The time at which the updated state takes effect. If a dict is provided, it must be of the same form as the protobuf message Timestamp |
retry |
Optional[google.api_core.retry.Retry]
A retry object used to retry requests. If |
timeout |
Optional[float]
The amount of time, in seconds, to wait for the request to complete. Note that if |
metadata |
Optional[Sequence[Tuple[str, str]]]
Additional metadata that is provided to the method. |
Exceptions | |
---|---|
Type | Description |
google.api_core.exceptions.GoogleAPICallError | If the request failed for any reason. |
google.api_core.exceptions.RetryError | If the request failed due to a retryable error and retry attempts failed. |
ValueError | If the parameters are invalid. |
set_iam_policy
set_iam_policy(resource, policy, retry=<_MethodDefault._DEFAULT_VALUE: <object object>>, timeout=<_MethodDefault._DEFAULT_VALUE: <object object>>, metadata=None)
Sets the access control policy on the specified Source.
.. rubric:: Example
from google.cloud import securitycenter_v1
client = securitycenter_v1.SecurityCenterClient()
TODO: Initialize
resource
:resource = ''
TODO: Initialize
policy
:policy = {}
response = client.set_iam_policy(resource, policy)
Parameters | |
---|---|
Name | Description |
resource |
str
REQUIRED: The resource for which the policy is being specified. See the operation documentation for the appropriate value for this field. |
policy |
Union[dict, Policy]
REQUIRED: The complete policy to be applied to the |
retry |
Optional[google.api_core.retry.Retry]
A retry object used to retry requests. If |
timeout |
Optional[float]
The amount of time, in seconds, to wait for the request to complete. Note that if |
metadata |
Optional[Sequence[Tuple[str, str]]]
Additional metadata that is provided to the method. |
Exceptions | |
---|---|
Type | Description |
google.api_core.exceptions.GoogleAPICallError | If the request failed for any reason. |
google.api_core.exceptions.RetryError | If the request failed due to a retryable error and retry attempts failed. |
ValueError | If the parameters are invalid. |
source_path
source_path(organization, source)
Return a fully-qualified source string.
test_iam_permissions
test_iam_permissions(resource, permissions, retry=<_MethodDefault._DEFAULT_VALUE: <object object>>, timeout=<_MethodDefault._DEFAULT_VALUE: <object object>>, metadata=None)
Returns the permissions that a caller has on the specified source.
.. rubric:: Example
from google.cloud import securitycenter_v1
client = securitycenter_v1.SecurityCenterClient()
TODO: Initialize
resource
:resource = ''
TODO: Initialize
permissions
:permissions = []
response = client.test_iam_permissions(resource, permissions)
Parameters | |
---|---|
Name | Description |
resource |
str
REQUIRED: The resource for which the policy detail is being requested. See the operation documentation for the appropriate value for this field. |
permissions |
list[str]
The set of permissions to check for the |
retry |
Optional[google.api_core.retry.Retry]
A retry object used to retry requests. If |
timeout |
Optional[float]
The amount of time, in seconds, to wait for the request to complete. Note that if |
metadata |
Optional[Sequence[Tuple[str, str]]]
Additional metadata that is provided to the method. |
Exceptions | |
---|---|
Type | Description |
google.api_core.exceptions.GoogleAPICallError | If the request failed for any reason. |
google.api_core.exceptions.RetryError | If the request failed due to a retryable error and retry attempts failed. |
ValueError | If the parameters are invalid. |
topic_path
topic_path(project, topic)
Return a fully-qualified topic string.
update_finding
update_finding(finding, update_mask=None, retry=<_MethodDefault._DEFAULT_VALUE: <object object>>, timeout=<_MethodDefault._DEFAULT_VALUE: <object object>>, metadata=None)
Creates or updates a finding. The corresponding source must exist for a finding creation to succeed.
.. rubric:: Example
from google.cloud import securitycenter_v1
client = securitycenter_v1.SecurityCenterClient()
TODO: Initialize
finding
:finding = {}
response = client.update_finding(finding)
Parameters | |
---|---|
Name | Description |
finding |
Union[dict, 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 be alphanumeric and less than or equal to 32 characters and greater than 0 characters in length. If a dict is provided, it must be of the same form as the protobuf message Finding |
update_mask |
Union[dict, FieldMask]
The FieldMask to use when updating the finding resource. This field should not be specified when creating a finding. When updating a finding, an empty mask is treated as updating all mutable fields and replacing source_properties. Individual source_properties can be added/updated by using "source_properties." in the field mask. If a dict is provided, it must be of the same form as the protobuf message FieldMask |
retry |
Optional[google.api_core.retry.Retry]
A retry object used to retry requests. If |
timeout |
Optional[float]
The amount of time, in seconds, to wait for the request to complete. Note that if |
metadata |
Optional[Sequence[Tuple[str, str]]]
Additional metadata that is provided to the method. |
Exceptions | |
---|---|
Type | Description |
google.api_core.exceptions.GoogleAPICallError | If the request failed for any reason. |
google.api_core.exceptions.RetryError | If the request failed due to a retryable error and retry attempts failed. |
ValueError | If the parameters are invalid. |
update_notification_config
update_notification_config(notification_config, update_mask=None, retry=<_MethodDefault._DEFAULT_VALUE: <object object>>, timeout=<_MethodDefault._DEFAULT_VALUE: <object object>>, metadata=None)
Updates a notification config.
.. rubric:: Example
from google.cloud import securitycenter_v1
client = securitycenter_v1.SecurityCenterClient()
TODO: Initialize
notification_config
:notification_config = {}
response = client.update_notification_config(notification_config)
Parameters | |
---|---|
Name | Description |
notification_config |
Union[dict, NotificationConfig]
Required. The notification config to update. If a dict is provided, it must be of the same form as the protobuf message NotificationConfig |
update_mask |
Union[dict, FieldMask]
The FieldMask to use when updating the notification config. If empty all mutable fields will be updated. If a dict is provided, it must be of the same form as the protobuf message FieldMask |
retry |
Optional[google.api_core.retry.Retry]
A retry object used to retry requests. If |
timeout |
Optional[float]
The amount of time, in seconds, to wait for the request to complete. Note that if |
metadata |
Optional[Sequence[Tuple[str, str]]]
Additional metadata that is provided to the method. |
Exceptions | |
---|---|
Type | Description |
google.api_core.exceptions.GoogleAPICallError | If the request failed for any reason. |
google.api_core.exceptions.RetryError | If the request failed due to a retryable error and retry attempts failed. |
ValueError | If the parameters are invalid. |
update_organization_settings
update_organization_settings(organization_settings, update_mask=None, retry=<_MethodDefault._DEFAULT_VALUE: <object object>>, timeout=<_MethodDefault._DEFAULT_VALUE: <object object>>, metadata=None)
Updates an organization's settings.
.. rubric:: Example
from google.cloud import securitycenter_v1
client = securitycenter_v1.SecurityCenterClient()
TODO: Initialize
organization_settings
:organization_settings = {}
response = client.update_organization_settings(organization_settings)
Parameters | |
---|---|
Name | Description |
organization_settings |
Union[dict, OrganizationSettings]
Required. The organization settings resource to update. If a dict is provided, it must be of the same form as the protobuf message OrganizationSettings |
update_mask |
Union[dict, FieldMask]
The FieldMask to use when updating the settings resource. If empty all mutable fields will be updated. If a dict is provided, it must be of the same form as the protobuf message FieldMask |
retry |
Optional[google.api_core.retry.Retry]
A retry object used to retry requests. If |
timeout |
Optional[float]
The amount of time, in seconds, to wait for the request to complete. Note that if |
metadata |
Optional[Sequence[Tuple[str, str]]]
Additional metadata that is provided to the method. |
Exceptions | |
---|---|
Type | Description |
google.api_core.exceptions.GoogleAPICallError | If the request failed for any reason. |
google.api_core.exceptions.RetryError | If the request failed due to a retryable error and retry attempts failed. |
ValueError | If the parameters are invalid. |
update_security_marks
update_security_marks(security_marks, update_mask=None, start_time=None, retry=<_MethodDefault._DEFAULT_VALUE: <object object>>, timeout=<_MethodDefault._DEFAULT_VALUE: <object object>>, metadata=None)
Updates security marks.
.. rubric:: Example
from google.cloud import securitycenter_v1
client = securitycenter_v1.SecurityCenterClient()
TODO: Initialize
security_marks
:security_marks = {}
response = client.update_security_marks(security_marks)
Parameters | |
---|---|
Name | Description |
security_marks |
Union[dict, SecurityMarks]
Required. The security marks resource to update. If a dict is provided, it must be of the same form as the protobuf message SecurityMarks |
update_mask |
Union[dict, FieldMask]
The FieldMask to use when updating the security marks resource. The field mask must not contain duplicate fields. If empty or set to "marks", all marks will be replaced. Individual marks can be updated using "marks.<mark_key>". If a dict is provided, it must be of the same form as the protobuf message FieldMask |
start_time |
Union[dict, Timestamp]
The time at which the updated SecurityMarks take effect. If not set uses current server time. Updates will be applied to the SecurityMarks that are active immediately preceding this time. If a dict is provided, it must be of the same form as the protobuf message Timestamp |
retry |
Optional[google.api_core.retry.Retry]
A retry object used to retry requests. If |
timeout |
Optional[float]
The amount of time, in seconds, to wait for the request to complete. Note that if |
metadata |
Optional[Sequence[Tuple[str, str]]]
Additional metadata that is provided to the method. |
Exceptions | |
---|---|
Type | Description |
google.api_core.exceptions.GoogleAPICallError | If the request failed for any reason. |
google.api_core.exceptions.RetryError | If the request failed due to a retryable error and retry attempts failed. |
ValueError | If the parameters are invalid. |
update_source
update_source(source, update_mask=None, retry=<_MethodDefault._DEFAULT_VALUE: <object object>>, timeout=<_MethodDefault._DEFAULT_VALUE: <object object>>, metadata=None)
Updates a source.
.. rubric:: Example
from google.cloud import securitycenter_v1
client = securitycenter_v1.SecurityCenterClient()
TODO: Initialize
source
:source = {}
response = client.update_source(source)
Parameters | |
---|---|
Name | Description |
source |
Union[dict, Source]
Required. The source resource to update. If a dict is provided, it must be of the same form as the protobuf message Source |
update_mask |
Union[dict, FieldMask]
The FieldMask to use when updating the source resource. If empty all mutable fields will be updated. If a dict is provided, it must be of the same form as the protobuf message FieldMask |
retry |
Optional[google.api_core.retry.Retry]
A retry object used to retry requests. If |
timeout |
Optional[float]
The amount of time, in seconds, to wait for the request to complete. Note that if |
metadata |
Optional[Sequence[Tuple[str, str]]]
Additional metadata that is provided to the method. |
Exceptions | |
---|---|
Type | Description |
google.api_core.exceptions.GoogleAPICallError | If the request failed for any reason. |
google.api_core.exceptions.RetryError | If the request failed due to a retryable error and retry attempts failed. |
ValueError | If the parameters are invalid. |