Class SecurityCenterClient (0.4.0)

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
NameDescription
channel grpc.Channel

DEPRECATED. A Channel instance through which to make calls. This argument is mutually exclusive with credentials; providing both will raise an exception.

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 transport; doing so will raise an exception.

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 None, then default info will be used. Generally, you only need to set this if you're developing your own client library.

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_path

asset_path(organization, asset)

Return a fully-qualified asset string.

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
NameDescription
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 None is specified, requests will be retried using a default configuration.

timeout Optional[float]

The amount of time, in seconds, to wait for the request to complete. Note that if retry is specified, the timeout applies to each individual attempt.

metadata Optional[Sequence[Tuple[str, str]]]

Additional metadata that is provided to the method.

Exceptions
TypeDescription
google.api_core.exceptions.GoogleAPICallErrorIf the request failed for any reason.
google.api_core.exceptions.RetryErrorIf the request failed due to a retryable error and retry attempts failed.
ValueErrorIf 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
NameDescription
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 None is specified, requests will be retried using a default configuration.

timeout Optional[float]

The amount of time, in seconds, to wait for the request to complete. Note that if retry is specified, the timeout applies to each individual attempt.

metadata Optional[Sequence[Tuple[str, str]]]

Additional metadata that is provided to the method.

Exceptions
TypeDescription
google.api_core.exceptions.GoogleAPICallErrorIf the request failed for any reason.
google.api_core.exceptions.RetryErrorIf the request failed due to a retryable error and retry attempts failed.
ValueErrorIf 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
NameDescription
filename str

The path to the service account private key json file.

Returns
TypeDescription
SecurityCenterClientThe 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
NameDescription
filename str

The path to the service account private key json file.

Returns
TypeDescription
SecurityCenterClientThe 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()

resource = client.source_path('[ORGANIZATION]', '[SOURCE]')

response = client.get_iam_policy(resource)

Parameters
NameDescription
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 GetPolicyOptions object for specifying options to GetIamPolicy. This field is only used by Cloud IAM. If a dict is provided, it must be of the same form as the protobuf message GetPolicyOptions

retry Optional[google.api_core.retry.Retry]

A retry object used to retry requests. If None is specified, requests will be retried using a default configuration.

timeout Optional[float]

The amount of time, in seconds, to wait for the request to complete. Note that if retry is specified, the timeout applies to each individual attempt.

metadata Optional[Sequence[Tuple[str, str]]]

Additional metadata that is provided to the method.

Exceptions
TypeDescription
google.api_core.exceptions.GoogleAPICallErrorIf the request failed for any reason.
google.api_core.exceptions.RetryErrorIf the request failed due to a retryable error and retry attempts failed.
ValueErrorIf 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
NameDescription
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 None is specified, requests will be retried using a default configuration.

timeout Optional[float]

The amount of time, in seconds, to wait for the request to complete. Note that if retry is specified, the timeout applies to each individual attempt.

metadata Optional[Sequence[Tuple[str, str]]]

Additional metadata that is provided to the method.

Exceptions
TypeDescription
google.api_core.exceptions.GoogleAPICallErrorIf the request failed for any reason.
google.api_core.exceptions.RetryErrorIf the request failed due to a retryable error and retry attempts failed.
ValueErrorIf 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
NameDescription
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 None is specified, requests will be retried using a default configuration.

timeout Optional[float]

The amount of time, in seconds, to wait for the request to complete. Note that if retry is specified, the timeout applies to each individual attempt.

metadata Optional[Sequence[Tuple[str, str]]]

Additional metadata that is provided to the method.

Exceptions
TypeDescription
google.api_core.exceptions.GoogleAPICallErrorIf the request failed for any reason.
google.api_core.exceptions.RetryErrorIf the request failed due to a retryable error and retry attempts failed.
ValueErrorIf 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
NameDescription
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 AND and OR. Parentheses are supported, and OR has higher precedence than AND. Restrictions have the form and may have a - character in front of them to indicate negation. The fields map to those defined in the Asset resource. Examples include: - name - security_center_properties.resource_name - resource_properties.a_property - security_marks.marks.marka The supported operators are: - = for all value types. - >, <, >=, <= for integer values. - :, meaning substring matching, for strings. The supported value types are: - string literals in quotes. - integer literals without quotes. - boolean literals true and false without quotes. The following field and operator combinations are supported: - name: = - update_time: =, >, <, >=, <= Usage: This should be milliseconds since epoch or an RFC3339 string. Examples: "update_time = "2019-06-10T16:07:18-07:00"" "update_time = 1560208038000" - create_time: =, >, <, >=, <= Usage: This should be milliseconds since epoch or an RFC3339 string. Examples: "create_time = "2019-06-10T16:07:18-07:00"" "create_time = 1560208038000" - iam_policy.policy_blob: =, : - resource_properties: =, :, >, <, >=, <= - security_marks.marks: =, : - security_center_properties.resource_name: =, : - security_center_properties.resource_display_name: =, : - security_center_properties.resource_type: =, : - 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_owners: =, : For example, resource_properties.size = 100 is a valid filter string.

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 state_change must be a specified field in group_by. If a dict is provided, it must be of the same form as the protobuf message Duration

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 None is specified, requests will be retried using a default configuration.

timeout Optional[float]

The amount of time, in seconds, to wait for the request to complete. Note that if retry is specified, the timeout applies to each individual attempt.

metadata Optional[Sequence[Tuple[str, str]]]

Additional metadata that is provided to the method.

Exceptions
TypeDescription
google.api_core.exceptions.GoogleAPICallErrorIf the request failed for any reason.
google.api_core.exceptions.RetryErrorIf the request failed due to a retryable error and retry attempts failed.
ValueErrorIf 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
NameDescription
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 -. For example: organizations/{organization_id}/sources/-

group_by str

Required. 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

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 AND and OR. Parentheses are supported, and OR has higher precedence than AND. Restrictions have the form and may have a - character in front of them to indicate negation. Examples include: - name - source_properties.a_property - security_marks.marks.marka The supported operators are: - = for all value types. - >, <, >=, <= for integer values. - :, meaning substring matching, for strings. The supported value types are: - string literals in quotes. - integer literals without quotes. - boolean literals true and false without quotes. The following field and operator combinations are supported: - name: = - parent: =, : - resource_name: =, : - state: =, : - category: =, : - external_uri: =, : - event_time: =, >, <, >=, <= Usage: This should be milliseconds since epoch or an RFC3339 string. Examples: "event_time = "2019-06-10T16:07:18-07:00"" "event_time = 1560208038000" - security_marks.marks: =, : - source_properties: =, :, >, <, >=, <= For example, source_properties.size = 100 is a valid filter string.

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 at the start of compare_duration, but changed its state at read_time. - "UNCHANGED": indicates that the finding was present at the start of compare_duration and did not change state at read_time. - "ADDED": indicates that the finding was not present at the start of compare_duration, but was present 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 state_change must be a specified field in group_by. If a dict is provided, it must be of the same form as the protobuf message Duration

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 None is specified, requests will be retried using a default configuration.

timeout Optional[float]

The amount of time, in seconds, to wait for the request to complete. Note that if retry is specified, the timeout applies to each individual attempt.

metadata Optional[Sequence[Tuple[str, str]]]

Additional metadata that is provided to the method.

Exceptions
TypeDescription
google.api_core.exceptions.GoogleAPICallErrorIf the request failed for any reason.
google.api_core.exceptions.RetryErrorIf the request failed due to a retryable error and retry attempts failed.
ValueErrorIf 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
NameDescription
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 AND and OR. Parentheses are supported, and OR has higher precedence than AND. Restrictions have the form and may have a - character in front of them to indicate negation. The fields map to those defined in the Asset resource. Examples include: - name - security_center_properties.resource_name - resource_properties.a_property - security_marks.marks.marka The supported operators are: - = for all value types. - >, <, >=, <= for integer values. - :, meaning substring matching, for strings. The supported value types are: - string literals in quotes. - integer literals without quotes. - boolean literals true and false without quotes. The following are the allowed field and operator combinations: - name: = - update_time: =, >, <, >=, <= Usage: This should be milliseconds since epoch or an RFC3339 string. Examples: "update_time = "2019-06-10T16:07:18-07:00"" "update_time = 1560208038000" - create_time: =, >, <, >=, <= Usage: This should be milliseconds since epoch or an RFC3339 string. Examples: "create_time = "2019-06-10T16:07:18-07:00"" "create_time = 1560208038000" - iam_policy.policy_blob: =, : - resource_properties: =, :, >, <, >=, <= - security_marks.marks: =, : - security_center_properties.resource_name: =, : - security_center_properties.resource_display_name: =, : - security_center_properties.resource_type: =, : - 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_owners: =, : For example, resource_properties.size = 100 is a valid filter string.

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 None is specified, requests will be retried using a default configuration.

timeout Optional[float]

The amount of time, in seconds, to wait for the request to complete. Note that if retry is specified, the timeout applies to each individual attempt.

metadata Optional[Sequence[Tuple[str, str]]]

Additional metadata that is provided to the method.

Exceptions
TypeDescription
google.api_core.exceptions.GoogleAPICallErrorIf the request failed for any reason.
google.api_core.exceptions.RetryErrorIf the request failed due to a retryable error and retry attempts failed.
ValueErrorIf 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
NameDescription
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 -. For example: organizations/{organization_id}/sources/-

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 AND and OR. Parentheses are supported, and OR has higher precedence than AND. Restrictions have the form and may have a - character in front of them to indicate negation. Examples include: - name - source_properties.a_property - security_marks.marks.marka The supported operators are: - = for all value types. - >, <, >=, <= for integer values. - :, meaning substring matching, for strings. The supported value types are: - string literals in quotes. - integer literals without quotes. - boolean literals true and false without quotes. The following field and operator combinations are supported: name: = parent: =, : resource_name: =, : state: =, : category: =, : external_uri: =, : event_time: =, >, <, >=, <= Usage: This should be milliseconds since epoch or an RFC3339 string. Examples: "event_time = "2019-06-10T16:07:18-07:00"" "event_time = 1560208038000" security_marks.marks: =, : source_properties: =, :, >, <, >=, <= For example, source_properties.size = 100 is a valid filter string.

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 at the start of compare_duration, but changed its state at read_time. - "UNCHANGED": indicates that the finding was present at the start of compare_duration and did not change state at read_time. - "ADDED": indicates that the finding was not present at the start of compare_duration, but was present 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 None is specified, requests will be retried using a default configuration.

timeout Optional[float]

The amount of time, in seconds, to wait for the request to complete. Note that if retry is specified, the timeout applies to each individual attempt.

metadata Optional[Sequence[Tuple[str, str]]]

Additional metadata that is provided to the method.

Exceptions
TypeDescription
google.api_core.exceptions.GoogleAPICallErrorIf the request failed for any reason.
google.api_core.exceptions.RetryErrorIf the request failed due to a retryable error and retry attempts failed.
ValueErrorIf 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
NameDescription
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 None is specified, requests will be retried using a default configuration.

timeout Optional[float]

The amount of time, in seconds, to wait for the request to complete. Note that if retry is specified, the timeout applies to each individual attempt.

metadata Optional[Sequence[Tuple[str, str]]]

Additional metadata that is provided to the method.

Exceptions
TypeDescription
google.api_core.exceptions.GoogleAPICallErrorIf the request failed for any reason.
google.api_core.exceptions.RetryErrorIf the request failed due to a retryable error and retry attempts failed.
ValueErrorIf the parameters are invalid.

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.

organization_sources_path

organization_sources_path(organization)

Return a fully-qualified organization_sources 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
NameDescription
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 None is specified, requests will be retried using a default configuration.

timeout Optional[float]

The amount of time, in seconds, to wait for the request to complete. Note that if retry is specified, the timeout applies to each individual attempt.

metadata Optional[Sequence[Tuple[str, str]]]

Additional metadata that is provided to the method.

Exceptions
TypeDescription
google.api_core.exceptions.GoogleAPICallErrorIf the request failed for any reason.
google.api_core.exceptions.RetryErrorIf the request failed due to a retryable error and retry attempts failed.
ValueErrorIf 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
NameDescription
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 None is specified, requests will be retried using a default configuration.

timeout Optional[float]

The amount of time, in seconds, to wait for the request to complete. Note that if retry is specified, the timeout applies to each individual attempt.

metadata Optional[Sequence[Tuple[str, str]]]

Additional metadata that is provided to the method.

Exceptions
TypeDescription
google.api_core.exceptions.GoogleAPICallErrorIf the request failed for any reason.
google.api_core.exceptions.RetryErrorIf the request failed due to a retryable error and retry attempts failed.
ValueErrorIf 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()

resource = client.source_path('[ORGANIZATION]', '[SOURCE]')

TODO: Initialize policy:

policy = {}

response = client.set_iam_policy(resource, policy)

Parameters
NameDescription
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 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. If a dict is provided, it must be of the same form as the protobuf message Policy

retry Optional[google.api_core.retry.Retry]

A retry object used to retry requests. If None is specified, requests will be retried using a default configuration.

timeout Optional[float]

The amount of time, in seconds, to wait for the request to complete. Note that if retry is specified, the timeout applies to each individual attempt.

metadata Optional[Sequence[Tuple[str, str]]]

Additional metadata that is provided to the method.

Exceptions
TypeDescription
google.api_core.exceptions.GoogleAPICallErrorIf the request failed for any reason.
google.api_core.exceptions.RetryErrorIf the request failed due to a retryable error and retry attempts failed.
ValueErrorIf 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()

resource = client.source_path('[ORGANIZATION]', '[SOURCE]')

TODO: Initialize permissions:

permissions = []

response = client.test_iam_permissions(resource, permissions)

Parameters
NameDescription
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 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__.

retry Optional[google.api_core.retry.Retry]

A retry object used to retry requests. If None is specified, requests will be retried using a default configuration.

timeout Optional[float]

The amount of time, in seconds, to wait for the request to complete. Note that if retry is specified, the timeout applies to each individual attempt.

metadata Optional[Sequence[Tuple[str, str]]]

Additional metadata that is provided to the method.

Exceptions
TypeDescription
google.api_core.exceptions.GoogleAPICallErrorIf the request failed for any reason.
google.api_core.exceptions.RetryErrorIf the request failed due to a retryable error and retry attempts failed.
ValueErrorIf the parameters are invalid.

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
NameDescription
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 None is specified, requests will be retried using a default configuration.

timeout Optional[float]

The amount of time, in seconds, to wait for the request to complete. Note that if retry is specified, the timeout applies to each individual attempt.

metadata Optional[Sequence[Tuple[str, str]]]

Additional metadata that is provided to the method.

Exceptions
TypeDescription
google.api_core.exceptions.GoogleAPICallErrorIf the request failed for any reason.
google.api_core.exceptions.RetryErrorIf the request failed due to a retryable error and retry attempts failed.
ValueErrorIf 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
NameDescription
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 None is specified, requests will be retried using a default configuration.

timeout Optional[float]

The amount of time, in seconds, to wait for the request to complete. Note that if retry is specified, the timeout applies to each individual attempt.

metadata Optional[Sequence[Tuple[str, str]]]

Additional metadata that is provided to the method.

Exceptions
TypeDescription
google.api_core.exceptions.GoogleAPICallErrorIf the request failed for any reason.
google.api_core.exceptions.RetryErrorIf the request failed due to a retryable error and retry attempts failed.
ValueErrorIf 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
NameDescription
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 None is specified, requests will be retried using a default configuration.

timeout Optional[float]

The amount of time, in seconds, to wait for the request to complete. Note that if retry is specified, the timeout applies to each individual attempt.

metadata Optional[Sequence[Tuple[str, str]]]

Additional metadata that is provided to the method.

Exceptions
TypeDescription
google.api_core.exceptions.GoogleAPICallErrorIf the request failed for any reason.
google.api_core.exceptions.RetryErrorIf the request failed due to a retryable error and retry attempts failed.
ValueErrorIf 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
NameDescription
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 None is specified, requests will be retried using a default configuration.

timeout Optional[float]

The amount of time, in seconds, to wait for the request to complete. Note that if retry is specified, the timeout applies to each individual attempt.

metadata Optional[Sequence[Tuple[str, str]]]

Additional metadata that is provided to the method.

Exceptions
TypeDescription
google.api_core.exceptions.GoogleAPICallErrorIf the request failed for any reason.
google.api_core.exceptions.RetryErrorIf the request failed due to a retryable error and retry attempts failed.
ValueErrorIf the parameters are invalid.