diff --git a/securitycenter/google/cloud/securitycenter_v1/gapic/enums.py b/securitycenter/google/cloud/securitycenter_v1/gapic/enums.py index b97e452584d6..123b5f5e0961 100644 --- a/securitycenter/google/cloud/securitycenter_v1/gapic/enums.py +++ b/securitycenter/google/cloud/securitycenter_v1/gapic/enums.py @@ -128,3 +128,22 @@ class InclusionMode(enum.IntEnum): INCLUSION_MODE_UNSPECIFIED = 0 INCLUDE_ONLY = 1 EXCLUDE = 2 + + +class RunAssetDiscoveryResponse(object): + class State(enum.IntEnum): + """ + The state of an asset discovery run. + + Attributes: + STATE_UNSPECIFIED (int): Asset discovery run state was unspecified. + COMPLETED (int): Asset discovery run completed successfully. + SUPERSEDED (int): Asset discovery run was cancelled with tasks still pending, as another + run for the same organization was started with a higher priority. + TERMINATED (int): Asset discovery run was killed and terminated. + """ + + STATE_UNSPECIFIED = 0 + COMPLETED = 1 + SUPERSEDED = 2 + TERMINATED = 3 diff --git a/securitycenter/google/cloud/securitycenter_v1/gapic/security_center_client.py b/securitycenter/google/cloud/securitycenter_v1/gapic/security_center_client.py index be86b5c8f793..0ea1ed24538e 100644 --- a/securitycenter/google/cloud/securitycenter_v1/gapic/security_center_client.py +++ b/securitycenter/google/cloud/securitycenter_v1/gapic/security_center_client.py @@ -38,6 +38,7 @@ ) from google.cloud.securitycenter_v1.proto import finding_pb2 from google.cloud.securitycenter_v1.proto import organization_settings_pb2 +from google.cloud.securitycenter_v1.proto import run_asset_discovery_response_pb2 from google.cloud.securitycenter_v1.proto import security_marks_pb2 from google.cloud.securitycenter_v1.proto import securitycenter_service_pb2 from google.cloud.securitycenter_v1.proto import securitycenter_service_pb2_grpc @@ -444,8 +445,7 @@ def get_iam_policy( Args: resource (str): REQUIRED: The resource for which the policy is being requested. - ``resource`` is usually specified as a path. For example, a Project - resource is specified as ``projects/{project}``. + See the operation documentation for the appropriate value for this field. retry (Optional[google.api_core.retry.Retry]): A retry object used to retry requests. If ``None`` is specified, requests will not be retried. @@ -1648,7 +1648,7 @@ def run_asset_discovery( return google.api_core.operation.from_gapic( operation, self.transport._operations_client, - empty_pb2.Empty, + run_asset_discovery_response_pb2.RunAssetDiscoveryResponse, metadata_type=empty_pb2.Empty, ) @@ -1764,8 +1764,7 @@ def set_iam_policy( Args: resource (str): REQUIRED: The resource for which the policy is being specified. - ``resource`` is usually specified as a path. For example, a Project - resource is specified as ``projects/{project}``. + See the operation documentation for the appropriate value for this field. policy (Union[dict, ~google.cloud.securitycenter_v1.types.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) @@ -1846,8 +1845,7 @@ def test_iam_permissions( Args: resource (str): REQUIRED: The resource for which the policy detail is being requested. - ``resource`` is usually specified as a path. For example, a Project - resource is specified as ``projects/{project}``. + 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 diff --git a/securitycenter/google/cloud/securitycenter_v1/proto/run_asset_discovery_response.proto b/securitycenter/google/cloud/securitycenter_v1/proto/run_asset_discovery_response.proto new file mode 100644 index 000000000000..1cbba38e713a --- /dev/null +++ b/securitycenter/google/cloud/securitycenter_v1/proto/run_asset_discovery_response.proto @@ -0,0 +1,54 @@ +// Copyright 2019 Google LLC. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + +syntax = "proto3"; + +package google.cloud.securitycenter.v1; + +import "google/protobuf/duration.proto"; +import "google/protobuf/timestamp.proto"; +import "google/api/annotations.proto"; + +option csharp_namespace = "Google.Cloud.SecurityCenter.V1"; +option go_package = "google.golang.org/genproto/googleapis/cloud/securitycenter/v1;securitycenter"; +option java_multiple_files = true; +option java_package = "com.google.cloud.securitycenter.v1"; +option php_namespace = "Google\\Cloud\\SecurityCenter\\V1"; +option ruby_package = "Google::Cloud::SecurityCenter::V1"; + +// Response of asset discovery run +message RunAssetDiscoveryResponse { + // The state of an asset discovery run. + enum State { + // Asset discovery run state was unspecified. + STATE_UNSPECIFIED = 0; + + // Asset discovery run completed successfully. + COMPLETED = 1; + + // Asset discovery run was cancelled with tasks still pending, as another + // run for the same organization was started with a higher priority. + SUPERSEDED = 2; + + // Asset discovery run was killed and terminated. + TERMINATED = 3; + } + + // The state of an asset discovery run. + State state = 1; + + // The duration between asset discovery run start and end + google.protobuf.Duration duration = 2; +} diff --git a/securitycenter/google/cloud/securitycenter_v1/proto/run_asset_discovery_response_pb2.py b/securitycenter/google/cloud/securitycenter_v1/proto/run_asset_discovery_response_pb2.py new file mode 100644 index 000000000000..447d1c4ad733 --- /dev/null +++ b/securitycenter/google/cloud/securitycenter_v1/proto/run_asset_discovery_response_pb2.py @@ -0,0 +1,162 @@ +# -*- coding: utf-8 -*- +# Generated by the protocol buffer compiler. DO NOT EDIT! +# source: google/cloud/securitycenter_v1/proto/run_asset_discovery_response.proto + +import sys + +_b = sys.version_info[0] < 3 and (lambda x: x) or (lambda x: x.encode("latin1")) +from google.protobuf import descriptor as _descriptor +from google.protobuf import message as _message +from google.protobuf import reflection as _reflection +from google.protobuf import symbol_database as _symbol_database + +# @@protoc_insertion_point(imports) + +_sym_db = _symbol_database.Default() + + +from google.protobuf import duration_pb2 as google_dot_protobuf_dot_duration__pb2 +from google.protobuf import timestamp_pb2 as google_dot_protobuf_dot_timestamp__pb2 +from google.api import annotations_pb2 as google_dot_api_dot_annotations__pb2 + + +DESCRIPTOR = _descriptor.FileDescriptor( + name="google/cloud/securitycenter_v1/proto/run_asset_discovery_response.proto", + package="google.cloud.securitycenter.v1", + syntax="proto3", + serialized_options=_b( + '\n"com.google.cloud.securitycenter.v1P\001ZLgoogle.golang.org/genproto/googleapis/cloud/securitycenter/v1;securitycenter\252\002\036Google.Cloud.SecurityCenter.V1\312\002\036Google\\Cloud\\SecurityCenter\\V1\352\002!Google::Cloud::SecurityCenter::V1' + ), + serialized_pb=_b( + '\nGgoogle/cloud/securitycenter_v1/proto/run_asset_discovery_response.proto\x12\x1egoogle.cloud.securitycenter.v1\x1a\x1egoogle/protobuf/duration.proto\x1a\x1fgoogle/protobuf/timestamp.proto\x1a\x1cgoogle/api/annotations.proto"\xe7\x01\n\x19RunAssetDiscoveryResponse\x12N\n\x05state\x18\x01 \x01(\x0e\x32?.google.cloud.securitycenter.v1.RunAssetDiscoveryResponse.State\x12+\n\x08\x64uration\x18\x02 \x01(\x0b\x32\x19.google.protobuf.Duration"M\n\x05State\x12\x15\n\x11STATE_UNSPECIFIED\x10\x00\x12\r\n\tCOMPLETED\x10\x01\x12\x0e\n\nSUPERSEDED\x10\x02\x12\x0e\n\nTERMINATED\x10\x03\x42\xda\x01\n"com.google.cloud.securitycenter.v1P\x01ZLgoogle.golang.org/genproto/googleapis/cloud/securitycenter/v1;securitycenter\xaa\x02\x1eGoogle.Cloud.SecurityCenter.V1\xca\x02\x1eGoogle\\Cloud\\SecurityCenter\\V1\xea\x02!Google::Cloud::SecurityCenter::V1b\x06proto3' + ), + dependencies=[ + google_dot_protobuf_dot_duration__pb2.DESCRIPTOR, + google_dot_protobuf_dot_timestamp__pb2.DESCRIPTOR, + google_dot_api_dot_annotations__pb2.DESCRIPTOR, + ], +) + + +_RUNASSETDISCOVERYRESPONSE_STATE = _descriptor.EnumDescriptor( + name="State", + full_name="google.cloud.securitycenter.v1.RunAssetDiscoveryResponse.State", + filename=None, + file=DESCRIPTOR, + values=[ + _descriptor.EnumValueDescriptor( + name="STATE_UNSPECIFIED", + index=0, + number=0, + serialized_options=None, + type=None, + ), + _descriptor.EnumValueDescriptor( + name="COMPLETED", index=1, number=1, serialized_options=None, type=None + ), + _descriptor.EnumValueDescriptor( + name="SUPERSEDED", index=2, number=2, serialized_options=None, type=None + ), + _descriptor.EnumValueDescriptor( + name="TERMINATED", index=3, number=3, serialized_options=None, type=None + ), + ], + containing_type=None, + serialized_options=None, + serialized_start=357, + serialized_end=434, +) +_sym_db.RegisterEnumDescriptor(_RUNASSETDISCOVERYRESPONSE_STATE) + + +_RUNASSETDISCOVERYRESPONSE = _descriptor.Descriptor( + name="RunAssetDiscoveryResponse", + full_name="google.cloud.securitycenter.v1.RunAssetDiscoveryResponse", + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name="state", + full_name="google.cloud.securitycenter.v1.RunAssetDiscoveryResponse.state", + index=0, + number=1, + type=14, + cpp_type=8, + label=1, + has_default_value=False, + default_value=0, + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=None, + file=DESCRIPTOR, + ), + _descriptor.FieldDescriptor( + name="duration", + full_name="google.cloud.securitycenter.v1.RunAssetDiscoveryResponse.duration", + index=1, + number=2, + type=11, + cpp_type=10, + label=1, + has_default_value=False, + default_value=None, + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=None, + file=DESCRIPTOR, + ), + ], + extensions=[], + nested_types=[], + enum_types=[_RUNASSETDISCOVERYRESPONSE_STATE], + serialized_options=None, + is_extendable=False, + syntax="proto3", + extension_ranges=[], + oneofs=[], + serialized_start=203, + serialized_end=434, +) + +_RUNASSETDISCOVERYRESPONSE.fields_by_name[ + "state" +].enum_type = _RUNASSETDISCOVERYRESPONSE_STATE +_RUNASSETDISCOVERYRESPONSE.fields_by_name[ + "duration" +].message_type = google_dot_protobuf_dot_duration__pb2._DURATION +_RUNASSETDISCOVERYRESPONSE_STATE.containing_type = _RUNASSETDISCOVERYRESPONSE +DESCRIPTOR.message_types_by_name[ + "RunAssetDiscoveryResponse" +] = _RUNASSETDISCOVERYRESPONSE +_sym_db.RegisterFileDescriptor(DESCRIPTOR) + +RunAssetDiscoveryResponse = _reflection.GeneratedProtocolMessageType( + "RunAssetDiscoveryResponse", + (_message.Message,), + dict( + DESCRIPTOR=_RUNASSETDISCOVERYRESPONSE, + __module__="google.cloud.securitycenter_v1.proto.run_asset_discovery_response_pb2", + __doc__="""Response of asset discovery run + + + Attributes: + state: + The state of an asset discovery run. + duration: + The duration between asset discovery run start and end + """, + # @@protoc_insertion_point(class_scope:google.cloud.securitycenter.v1.RunAssetDiscoveryResponse) + ), +) +_sym_db.RegisterMessage(RunAssetDiscoveryResponse) + + +DESCRIPTOR._options = None +# @@protoc_insertion_point(module_scope) diff --git a/securitycenter/google/cloud/securitycenter_v1/proto/run_asset_discovery_response_pb2_grpc.py b/securitycenter/google/cloud/securitycenter_v1/proto/run_asset_discovery_response_pb2_grpc.py new file mode 100644 index 000000000000..07cb78fe03a9 --- /dev/null +++ b/securitycenter/google/cloud/securitycenter_v1/proto/run_asset_discovery_response_pb2_grpc.py @@ -0,0 +1,2 @@ +# Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT! +import grpc diff --git a/securitycenter/google/cloud/securitycenter_v1/types.py b/securitycenter/google/cloud/securitycenter_v1/types.py index dadbf8255fc2..1352e0fb5c2f 100644 --- a/securitycenter/google/cloud/securitycenter_v1/types.py +++ b/securitycenter/google/cloud/securitycenter_v1/types.py @@ -22,6 +22,7 @@ from google.cloud.securitycenter_v1.proto import asset_pb2 from google.cloud.securitycenter_v1.proto import finding_pb2 from google.cloud.securitycenter_v1.proto import organization_settings_pb2 +from google.cloud.securitycenter_v1.proto import run_asset_discovery_response_pb2 from google.cloud.securitycenter_v1.proto import security_marks_pb2 from google.cloud.securitycenter_v1.proto import securitycenter_service_pb2 from google.cloud.securitycenter_v1.proto import source_pb2 @@ -34,6 +35,7 @@ from google.protobuf import struct_pb2 from google.protobuf import timestamp_pb2 from google.rpc import status_pb2 +from google.type import expr_pb2 _shared_modules = [ iam_policy_pb2, @@ -45,12 +47,14 @@ struct_pb2, timestamp_pb2, status_pb2, + expr_pb2, ] _local_modules = [ asset_pb2, finding_pb2, organization_settings_pb2, + run_asset_discovery_response_pb2, security_marks_pb2, securitycenter_service_pb2, source_pb2, diff --git a/securitycenter/google/cloud/securitycenter_v1beta1/gapic/security_center_client.py b/securitycenter/google/cloud/securitycenter_v1beta1/gapic/security_center_client.py index c8113e7d587c..6b66a443e5bc 100644 --- a/securitycenter/google/cloud/securitycenter_v1beta1/gapic/security_center_client.py +++ b/securitycenter/google/cloud/securitycenter_v1beta1/gapic/security_center_client.py @@ -86,46 +86,46 @@ def from_service_account_file(cls, filename, *args, **kwargs): from_service_account_json = from_service_account_file @classmethod - def organization_path(cls, organization): - """Return a fully-qualified organization string.""" + def asset_security_marks_path(cls, organization, asset): + """Return a fully-qualified asset_security_marks string.""" return google.api_core.path_template.expand( - "organizations/{organization}", organization=organization + "organizations/{organization}/assets/{asset}/securityMarks", + organization=organization, + asset=asset, ) @classmethod - def source_path(cls, organization, source): - """Return a fully-qualified source string.""" + def finding_path(cls, organization, source, finding): + """Return a fully-qualified finding string.""" return google.api_core.path_template.expand( - "organizations/{organization}/sources/{source}", + "organizations/{organization}/sources/{source}/findings/{finding}", organization=organization, source=source, + finding=finding, ) @classmethod - def organization_settings_path(cls, organization): - """Return a fully-qualified organization_settings string.""" + def organization_path(cls, organization): + """Return a fully-qualified organization string.""" return google.api_core.path_template.expand( - "organizations/{organization}/organizationSettings", - organization=organization, + "organizations/{organization}", organization=organization ) @classmethod - def finding_path(cls, organization, source, finding): - """Return a fully-qualified finding string.""" + def organization_settings_path(cls, organization): + """Return a fully-qualified organization_settings string.""" return google.api_core.path_template.expand( - "organizations/{organization}/sources/{source}/findings/{finding}", + "organizations/{organization}/organizationSettings", organization=organization, - source=source, - finding=finding, ) @classmethod - def asset_security_marks_path(cls, organization, asset): - """Return a fully-qualified asset_security_marks string.""" + def source_path(cls, organization, source): + """Return a fully-qualified source string.""" return google.api_core.path_template.expand( - "organizations/{organization}/assets/{asset}/securityMarks", + "organizations/{organization}/sources/{source}", organization=organization, - asset=asset, + source=source, ) def __init__( @@ -418,8 +418,7 @@ def get_iam_policy( Args: resource (str): REQUIRED: The resource for which the policy is being requested. - ``resource`` is usually specified as a path. For example, a Project - resource is specified as ``projects/{project}``. + See the operation documentation for the appropriate value for this field. retry (Optional[google.api_core.retry.Retry]): A retry object used to retry requests. If ``None`` is specified, requests will not be retried. @@ -1625,8 +1624,7 @@ def set_iam_policy( Args: resource (str): REQUIRED: The resource for which the policy is being specified. - ``resource`` is usually specified as a path. For example, a Project - resource is specified as ``projects/{project}``. + See the operation documentation for the appropriate value for this field. policy (Union[dict, ~google.cloud.securitycenter_v1beta1.types.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) @@ -1707,8 +1705,7 @@ def test_iam_permissions( Args: resource (str): REQUIRED: The resource for which the policy detail is being requested. - ``resource`` is usually specified as a path. For example, a Project - resource is specified as ``projects/{project}``. + 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 diff --git a/securitycenter/google/cloud/securitycenter_v1beta1/types.py b/securitycenter/google/cloud/securitycenter_v1beta1/types.py index 1302ede894ff..1948068fd0c3 100644 --- a/securitycenter/google/cloud/securitycenter_v1beta1/types.py +++ b/securitycenter/google/cloud/securitycenter_v1beta1/types.py @@ -34,6 +34,7 @@ from google.protobuf import struct_pb2 from google.protobuf import timestamp_pb2 from google.rpc import status_pb2 +from google.type import expr_pb2 _shared_modules = [ iam_policy_pb2, @@ -45,6 +46,7 @@ struct_pb2, timestamp_pb2, status_pb2, + expr_pb2, ] _local_modules = [ diff --git a/securitycenter/synth.metadata b/securitycenter/synth.metadata index 822e4ca5d65d..27199c433f47 100644 --- a/securitycenter/synth.metadata +++ b/securitycenter/synth.metadata @@ -1,26 +1,26 @@ { - "updateTime": "2019-04-23T12:26:49.316584Z", + "updateTime": "2019-05-18T12:33:08.827411Z", "sources": [ { "generator": { "name": "artman", - "version": "0.17.0", - "dockerImage": "googleapis/artman@sha256:c58f4ec3838eb4e0718eb1bccc6512bd6850feaa85a360a9e38f6f848ec73bc2" + "version": "0.19.0", + "dockerImage": "googleapis/artman@sha256:d3df563538225ac6caac45d8ad86499500211d1bcb2536955a6dbda15e1b368e" } }, { "git": { "name": "googleapis", "remote": "https://github.com/googleapis/googleapis.git", - "sha": "547e19e7df398e9290e8e3674d7351efc500f9b0", - "internalRef": "244712781" + "sha": "64f0053af0c24d817ec44278c8b4513f6cfd77ff", + "internalRef": "248810317" } }, { "template": { "name": "python_library", "origin": "synthtool.gcp", - "version": "2019.4.10" + "version": "2019.5.2" } } ], diff --git a/securitycenter/tests/unit/gapic/v1/test_security_center_client_v1.py b/securitycenter/tests/unit/gapic/v1/test_security_center_client_v1.py index c394e4f44f57..97306de51c67 100644 --- a/securitycenter/tests/unit/gapic/v1/test_security_center_client_v1.py +++ b/securitycenter/tests/unit/gapic/v1/test_security_center_client_v1.py @@ -24,13 +24,13 @@ from google.cloud.securitycenter_v1 import enums from google.cloud.securitycenter_v1.proto import finding_pb2 from google.cloud.securitycenter_v1.proto import organization_settings_pb2 +from google.cloud.securitycenter_v1.proto import run_asset_discovery_response_pb2 from google.cloud.securitycenter_v1.proto import security_marks_pb2 from google.cloud.securitycenter_v1.proto import securitycenter_service_pb2 from google.cloud.securitycenter_v1.proto import source_pb2 from google.iam.v1 import iam_policy_pb2 from google.iam.v1 import policy_pb2 from google.longrunning import operations_pb2 -from google.protobuf import empty_pb2 from google.protobuf import timestamp_pb2 @@ -558,7 +558,9 @@ def test_list_sources_exception(self): def test_run_asset_discovery(self): # Setup Expected Response expected_response = {} - expected_response = empty_pb2.Empty(**expected_response) + expected_response = run_asset_discovery_response_pb2.RunAssetDiscoveryResponse( + **expected_response + ) operation = operations_pb2.Operation( name="operations/test_run_asset_discovery", done=True )