As of January 1, 2020 this library no longer supports Python 2 on the latest released version. Library versions released prior to that date will continue to be available. For more information please visit Python 2 support on Google Cloud.

Client for Cloud Security Command Center API

class google.cloud.securitycenter_v1beta1.SecurityCenterClient(transport=None, channel=None, credentials=None, client_config=None, client_info=None, client_options=None)[source]

V1 Beta APIs for Security Center service.

Constructor.

Parameters
  • (Union[SecurityCenterGrpcTransport, (transport) – Callable[[~.Credentials, type], ~.SecurityCenterGrpcTransport]): A transport instance, responsible for actually making the API calls. The default transport uses the gRPC protocol. This argument may also be a callable which returns a transport instance. Callables will be sent the credentials as the first argument and the default transport class as the second argument.

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

classmethod asset_security_marks_path(organization, asset)[source]

Return a fully-qualified asset_security_marks string.

create_finding(parent, finding_id, finding, retry=<object object>, timeout=<object object>, metadata=None)[source]

Creates a finding. The corresponding source must exist for finding creation to succeed.

Example

>>> from google.cloud import securitycenter_v1beta1
>>>
>>> client = securitycenter_v1beta1.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
  • 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.

Returns

A Finding instance.

Raises
create_source(parent, source, retry=<object object>, timeout=<object object>, metadata=None)[source]

Creates a source.

Example

>>> from google.cloud import securitycenter_v1beta1
>>>
>>> client = securitycenter_v1beta1.SecurityCenterClient()
>>>
>>> parent = client.organization_path('[ORGANIZATION]')
>>>
>>> # TODO: Initialize `source`:
>>> source = {}
>>>
>>> response = client.create_source(parent, source)
Parameters
  • 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.

Returns

A Source instance.

Raises
enums = <module 'google.cloud.securitycenter_v1beta1.gapic.enums' from '/tmpfs/src/github/python-securitycenter/google/cloud/securitycenter_v1beta1/gapic/enums.py'>
classmethod finding_path(organization, source, finding)[source]

Return a fully-qualified finding string.

classmethod finding_security_marks_path(organization, source, finding)[source]

Return a fully-qualified finding_security_marks string.

classmethod from_service_account_file(filename, *args, **kwargs)[source]

Creates an instance of this client using the provided credentials file.

Parameters
  • filename (str) – The path to the service account private key json file.

  • args – Additional arguments to pass to the constructor.

  • kwargs – Additional arguments to pass to the constructor.

Returns

The constructed client.

Return type

SecurityCenterClient

classmethod from_service_account_json(filename, *args, **kwargs)

Creates an instance of this client using the provided credentials file.

Parameters
  • filename (str) – The path to the service account private key json file.

  • args – Additional arguments to pass to the constructor.

  • kwargs – Additional arguments to pass to the constructor.

Returns

The constructed client.

Return type

SecurityCenterClient

get_iam_policy(resource, options_=None, retry=<object object>, timeout=<object object>, metadata=None)[source]

Gets the access control policy on the specified Source.

Example

>>> from google.cloud import securitycenter_v1beta1
>>>
>>> client = securitycenter_v1beta1.SecurityCenterClient()
>>>
>>> resource = client.source_path('[ORGANIZATION]', '[SOURCE]')
>>>
>>> response = client.get_iam_policy(resource)
Parameters
  • 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.

Returns

A Policy instance.

Raises
get_organization_settings(name, retry=<object object>, timeout=<object object>, metadata=None)[source]

Gets the settings for an organization.

Example

>>> from google.cloud import securitycenter_v1beta1
>>>
>>> client = securitycenter_v1beta1.SecurityCenterClient()
>>>
>>> name = client.organization_settings_path('[ORGANIZATION]')
>>>
>>> response = client.get_organization_settings(name)
Parameters
  • 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.

Returns

A OrganizationSettings instance.

Raises
get_source(name, retry=<object object>, timeout=<object object>, metadata=None)[source]

Gets a source.

Example

>>> from google.cloud import securitycenter_v1beta1
>>>
>>> client = securitycenter_v1beta1.SecurityCenterClient()
>>>
>>> name = client.source_path('[ORGANIZATION]', '[SOURCE]')
>>>
>>> response = client.get_source(name)
Parameters
  • 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.

Returns

A Source instance.

Raises
group_assets(parent, group_by, filter_=None, compare_duration=None, read_time=None, page_size=None, retry=<object object>, timeout=<object object>, metadata=None)[source]

Filters an organization’s assets and groups them by their specified properties.

Example

>>> from google.cloud import securitycenter_v1beta1
>>>
>>> client = securitycenter_v1beta1.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
  • 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_type

    • security_center_properties.resource_parent

    The following fields are supported when compare_duration is set:

    • security_center_properties.resource_type

  • 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 not supported, and OR has higher precedence than AND.

    Restrictions have the form <field> <operator> <value> 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.

    For example, resource_properties.size = 100 is a valid filter string.

  • compare_duration (Union[dict, Duration]) –

    When compare_duration is set, the Asset’s “state” 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 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” values when compare_duration is specified:

    • ”ADDED”: indicates that the asset was not present before 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.

    This field is ignored if state is not a 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.

Returns

A PageIterator instance. An iterable of GroupResult instances. You can also iterate over the pages of the response using its pages property.

Raises
group_findings(parent, group_by, filter_=None, read_time=None, page_size=None, retry=<object object>, timeout=<object object>, metadata=None)[source]

Filters an organization or source’s findings and groups them by their specified properties.

To group across all sources provide a - as the source id. Example: /v1beta1/organizations/{organization_id}/sources/-/findings

Example

>>> from google.cloud import securitycenter_v1beta1
>>>
>>> client = securitycenter_v1beta1.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
  • 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). 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

  • 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 not supported, and OR has higher precedence than AND.

    Restrictions have the form <field> <operator> <value> 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.

    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

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

Returns

A PageIterator instance. An iterable of GroupResult instances. You can also iterate over the pages of the response using its pages property.

Raises
list_assets(parent, filter_=None, order_by=None, read_time=None, compare_duration=None, field_mask=None, page_size=None, retry=<object object>, timeout=<object object>, metadata=None)[source]

Lists an organization’s assets.

Example

>>> from google.cloud import securitycenter_v1beta1
>>>
>>> client = securitycenter_v1beta1.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
  • 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 not supported, and OR has higher precedence than AND.

    Restrictions have the form <field> <operator> <value> 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.

    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.

  • 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 ListAssetResult’s “state” 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 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” values when compare_duration is specified:

    • ”ADDED”: indicates that the asset was not present before 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 is “UNUSED”, which indicates that the asset is 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.

Returns

A PageIterator instance. An iterable of ListAssetsResult instances. You can also iterate over the pages of the response using its pages property.

Raises
list_findings(parent, filter_=None, order_by=None, read_time=None, field_mask=None, page_size=None, retry=<object object>, timeout=<object object>, metadata=None)[source]

Lists an organization or source’s findings.

To list across all sources provide a - as the source id. Example: /v1beta1/organizations/{organization_id}/sources/-/findings

Example

>>> from google.cloud import securitycenter_v1beta1
>>>
>>> client = securitycenter_v1beta1.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
  • 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 not supported, and OR has higher precedence than AND.

    Restrictions have the form <field> <operator> <value> 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.

    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.

  • 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

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

Returns

A PageIterator instance. An iterable of Finding instances. You can also iterate over the pages of the response using its pages property.

Raises
list_sources(parent, page_size=None, retry=<object object>, timeout=<object object>, metadata=None)[source]

Lists all sources belonging to an organization.

Example

>>> from google.cloud import securitycenter_v1beta1
>>>
>>> client = securitycenter_v1beta1.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
  • 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.

Returns

A PageIterator instance. An iterable of Source instances. You can also iterate over the pages of the response using its pages property.

Raises
classmethod organization_path(organization)[source]

Return a fully-qualified organization string.

classmethod organization_settings_path(organization)[source]

Return a fully-qualified organization_settings string.

run_asset_discovery(parent, retry=<object object>, timeout=<object object>, metadata=None)[source]

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.

Example

>>> from google.cloud import securitycenter_v1beta1
>>>
>>> client = securitycenter_v1beta1.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
  • 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.

Returns

A _OperationFuture instance.

Raises
set_finding_state(name, state, start_time, retry=<object object>, timeout=<object object>, metadata=None)[source]

Updates the state of a finding.

Example

>>> from google.cloud import securitycenter_v1beta1
>>> from google.cloud.securitycenter_v1beta1 import enums
>>>
>>> client = securitycenter_v1beta1.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 (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.

Returns

A Finding instance.

Raises
set_iam_policy(resource, policy, retry=<object object>, timeout=<object object>, metadata=None)[source]

Sets the access control policy on the specified Source.

Example

>>> from google.cloud import securitycenter_v1beta1
>>>
>>> client = securitycenter_v1beta1.SecurityCenterClient()
>>>
>>> resource = client.source_path('[ORGANIZATION]', '[SOURCE]')
>>>
>>> # TODO: Initialize `policy`:
>>> policy = {}
>>>
>>> response = client.set_iam_policy(resource, policy)
Parameters
  • 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.

Returns

A Policy instance.

Raises
classmethod source_path(organization, source)[source]

Return a fully-qualified source string.

test_iam_permissions(resource, permissions, retry=<object object>, timeout=<object object>, metadata=None)[source]

Returns the permissions that a caller has on the specified source.

Example

>>> from google.cloud import securitycenter_v1beta1
>>>
>>> client = securitycenter_v1beta1.SecurityCenterClient()
>>>
>>> resource = client.source_path('[ORGANIZATION]', '[SOURCE]')
>>>
>>> # TODO: Initialize `permissions`:
>>> permissions = []
>>>
>>> response = client.test_iam_permissions(resource, permissions)
Parameters
  • 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.

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

Returns

A TestIamPermissionsResponse instance.

Raises
update_finding(finding, update_mask=None, retry=<object object>, timeout=<object object>, metadata=None)[source]

Creates or updates a finding. The corresponding source must exist for a finding creation to succeed.

Example

>>> from google.cloud import securitycenter_v1beta1
>>>
>>> client = securitycenter_v1beta1.SecurityCenterClient()
>>>
>>> # TODO: Initialize `finding`:
>>> finding = {}
>>>
>>> response = client.update_finding(finding)
Parameters
  • 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 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.

    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.

Returns

A Finding instance.

Raises
update_organization_settings(organization_settings, update_mask=None, retry=<object object>, timeout=<object object>, metadata=None)[source]

Updates an organization’s settings.

Example

>>> from google.cloud import securitycenter_v1beta1
>>>
>>> client = securitycenter_v1beta1.SecurityCenterClient()
>>>
>>> # TODO: Initialize `organization_settings`:
>>> organization_settings = {}
>>>
>>> response = client.update_organization_settings(organization_settings)
Parameters
  • 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 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.

Returns

A OrganizationSettings instance.

Raises
update_security_marks(security_marks, update_mask=None, start_time=None, retry=<object object>, timeout=<object object>, metadata=None)[source]

Updates security marks.

Example

>>> from google.cloud import securitycenter_v1beta1
>>>
>>> client = securitycenter_v1beta1.SecurityCenterClient()
>>>
>>> # TODO: Initialize `security_marks`:
>>> security_marks = {}
>>>
>>> response = client.update_security_marks(security_marks)
Parameters
  • 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.

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

Returns

A SecurityMarks instance.

Raises
update_source(source, update_mask=None, retry=<object object>, timeout=<object object>, metadata=None)[source]

Updates a source.

Example

>>> from google.cloud import securitycenter_v1beta1
>>>
>>> client = securitycenter_v1beta1.SecurityCenterClient()
>>>
>>> # TODO: Initialize `source`:
>>> source = {}
>>>
>>> response = client.update_source(source)
Parameters
  • 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 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.

Returns

A Source instance.

Raises