From 080ec441db9361f15ae88b3cbca9cc2aaac6ed8a Mon Sep 17 00:00:00 2001 From: yoshi-automation Date: Tue, 29 Oct 2019 05:12:19 -0700 Subject: [PATCH] [CHANGE ME] Re-generated asset to pick up changes in the API or client library generator. --- .../asset_v1/gapic/asset_service_client.py | 6 +- asset/google/cloud/asset_v1/gapic/enums.py | 4 + .../cloud/asset_v1/proto/asset_service.proto | 87 +++++- .../cloud/asset_v1/proto/asset_service_pb2.py | 269 +++++++++++++++--- .../google/cloud/asset_v1/proto/assets.proto | 8 +- .../google/cloud/asset_v1/proto/assets_pb2.py | 25 +- asset/synth.metadata | 12 +- 7 files changed, 344 insertions(+), 67 deletions(-) diff --git a/asset/google/cloud/asset_v1/gapic/asset_service_client.py b/asset/google/cloud/asset_v1/gapic/asset_service_client.py index ab9078cc62c7..e4b3c18bc799 100644 --- a/asset/google/cloud/asset_v1/gapic/asset_service_client.py +++ b/asset/google/cloud/asset_v1/gapic/asset_service_client.py @@ -254,7 +254,7 @@ def export_assets( asset_types (list[str]): A list of asset types of which to take a snapshot for. For example: "compute.googleapis.com/Disk". If specified, only matching assets will be returned. See `Introduction to Cloud Asset - Inventory `__ + Inventory `__ for all supported asset types. content_type (~google.cloud.asset_v1.types.ContentType): Asset content type. If not specified, no content but the asset name will be returned. @@ -357,7 +357,7 @@ def batch_get_assets_history( parent (str): Required. The relative name of the root asset. It can only be an organization number (such as "organizations/123"), a project ID (such as "projects/my-project-id")", or a project number (such as "projects/12345"). - content_type (~google.cloud.asset_v1.types.ContentType): Required. The content type. + content_type (~google.cloud.asset_v1.types.ContentType): Optional. The content type. read_time_window (Union[dict, ~google.cloud.asset_v1.types.TimeWindow]): Optional. The time window for the asset history. Both start\_time and end\_time are optional and if set, it must be after 2018-10-02 UTC. If end\_time is not set, it is default to current timestamp. If start\_time @@ -372,7 +372,7 @@ def batch_get_assets_history( See `Resource Names `__ and `Resource Name - Format `__ + Format `__ for more info. The request becomes a no-op if the asset name list is empty, and the max diff --git a/asset/google/cloud/asset_v1/gapic/enums.py b/asset/google/cloud/asset_v1/gapic/enums.py index 780beae4ddef..38eb45ae0103 100644 --- a/asset/google/cloud/asset_v1/gapic/enums.py +++ b/asset/google/cloud/asset_v1/gapic/enums.py @@ -27,11 +27,15 @@ class ContentType(enum.IntEnum): CONTENT_TYPE_UNSPECIFIED (int): Unspecified content type. RESOURCE (int): Resource metadata. IAM_POLICY (int): The actual IAM policy set on a resource. + ORG_POLICY (int): The Cloud Organization Policy set on an asset. + ACCESS_POLICY (int): The Cloud Access context mananger Policy set on an asset. """ CONTENT_TYPE_UNSPECIFIED = 0 RESOURCE = 1 IAM_POLICY = 2 + ORG_POLICY = 4 + ACCESS_POLICY = 5 class NullValue(enum.IntEnum): diff --git a/asset/google/cloud/asset_v1/proto/asset_service.proto b/asset/google/cloud/asset_v1/proto/asset_service.proto index 0dfc2898b131..33dde9cd365b 100644 --- a/asset/google/cloud/asset_v1/proto/asset_service.proto +++ b/asset/google/cloud/asset_v1/proto/asset_service.proto @@ -18,8 +18,13 @@ syntax = "proto3"; package google.cloud.asset.v1; import "google/api/annotations.proto"; +import "google/api/client.proto"; +import "google/api/field_behavior.proto"; +import "google/api/resource.proto"; import "google/cloud/asset/v1/assets.proto"; import "google/longrunning/operations.proto"; +import "google/protobuf/empty.proto"; +import "google/protobuf/field_mask.proto"; import "google/protobuf/timestamp.proto"; option csharp_namespace = "Google.Cloud.Asset.V1"; @@ -29,9 +34,11 @@ option java_outer_classname = "AssetServiceProto"; option java_package = "com.google.cloud.asset.v1"; option php_namespace = "Google\\Cloud\\Asset\\V1"; - // Asset service definition. service AssetService { + option (google.api.default_host) = "cloudasset.googleapis.com"; + option (google.api.oauth_scopes) = "https://www.googleapis.com/auth/cloud-platform"; + // Exports assets with time and resource types to a given Cloud Storage // location. The output format is newline-delimited JSON. // This API implements the [google.longrunning.Operation][google.longrunning.Operation] API allowing you @@ -41,6 +48,10 @@ service AssetService { post: "/v1/{parent=*/*}:exportAssets" body: "*" }; + option (google.longrunning.operation_info) = { + response_type: "google.cloud.asset.v1.ExportAssetsResponse" + metadata_type: "google.cloud.asset.v1.ExportAssetsRequest" + }; } // Batch gets the update history of assets that overlap a time window. @@ -63,7 +74,12 @@ message ExportAssetsRequest { // organization number (such as "organizations/123"), a project ID (such as // "projects/my-project-id"), or a project number (such as "projects/12345"), // or a folder number (such as "folders/123"). - string parent = 1; + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "cloudasset.googleapis.com/Asset" + } + ]; // Timestamp to take an asset snapshot. This can only be set to a timestamp // between 2018-10-02 UTC (inclusive) and the current time. If not specified, @@ -73,9 +89,9 @@ message ExportAssetsRequest { google.protobuf.Timestamp read_time = 2; // A list of asset types of which to take a snapshot for. For example: - // "compute.googleapis.com/Disk". If specified, only matching assets will be returned. - // See [Introduction to Cloud Asset - // Inventory](https://cloud.google.com/resource-manager/docs/cloud-asset-inventory/overview) + // "compute.googleapis.com/Disk". If specified, only matching assets will be + // returned. See [Introduction to Cloud Asset + // Inventory](https://cloud.google.com/asset-inventory/docs/overview) // for all supported asset types. repeated string asset_types = 3; @@ -85,7 +101,7 @@ message ExportAssetsRequest { // Required. Output configuration indicating where the results will be output // to. All results will be in newline delimited JSON format. - OutputConfig output_config = 5; + OutputConfig output_config = 5 [(google.api.field_behavior) = REQUIRED]; } // The export asset response. This message is returned by the @@ -105,21 +121,27 @@ message BatchGetAssetsHistoryRequest { // Required. The relative name of the root asset. It can only be an // organization number (such as "organizations/123"), a project ID (such as // "projects/my-project-id")", or a project number (such as "projects/12345"). - string parent = 1; + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "cloudasset.googleapis.com/Asset" + } + ]; // A list of the full names of the assets. For example: // `//compute.googleapis.com/projects/my_project_123/zones/zone1/instances/instance1`. // See [Resource // Names](https://cloud.google.com/apis/design/resource_names#full_resource_name) - // and [Resource Name Format](https://cloud.google.com/resource-manager/docs/cloud-asset-inventory/resource-name-format) + // and [Resource Name + // Format](https://cloud.google.com/asset-inventory/docs/resource-name-format) // for more info. // // The request becomes a no-op if the asset name list is empty, and the max // size of the asset name list is 100 in one request. repeated string asset_names = 2; - // Required. The content type. - ContentType content_type = 3; + // Optional. The content type. + ContentType content_type = 3 [(google.api.field_behavior) = OPTIONAL]; // Optional. The time window for the asset history. Both start_time and // end_time are optional and if set, it must be after 2018-10-02 UTC. If @@ -127,7 +149,7 @@ message BatchGetAssetsHistoryRequest { // not set, the snapshot of the assets at end_time will be returned. The // returned results contain all temporal assets whose time window overlap with // read_time_window. - TimeWindow read_time_window = 4; + TimeWindow read_time_window = 4 [(google.api.field_behavior) = OPTIONAL]; } // Batch get assets history response. @@ -142,6 +164,12 @@ message OutputConfig { oneof destination { // Destination on Cloud Storage. GcsDestination gcs_destination = 1; + + // Destination on BigQuery. The output table stores the fields in asset + // proto as columns in BigQuery. The resource/iam_policy field is converted + // to a record with each field to a column, except metadata to a single JSON + // string. + BigQueryDestination bigquery_destination = 2; } } @@ -155,9 +183,40 @@ message GcsDestination { // Metadata](https://cloud.google.com/storage/docs/viewing-editing-metadata) // for more information. string uri = 1; + + // The uri prefix of all generated Cloud Storage objects. For example: + // "gs://bucket_name/object_name_prefix". Each object uri is in format: + // "gs://bucket_name/object_name_prefix// and only + // contains assets for that type. starts from 0. For example: + // "gs://bucket_name/object_name_prefix/compute.googleapis.com/Disk/0" is + // the first shard of output objects containing all + // compute.googleapis.com/Disk assets. An INVALID_ARGUMENT error will be + // returned if file with the same name "gs://bucket_name/object_name_prefix" + // already exists. + string uri_prefix = 2; } } +// A BigQuery destination. +message BigQueryDestination { + // Required. The BigQuery dataset in format + // "projects/projectId/datasets/datasetId", to which the snapshot result + // should be exported. If this dataset does not exist, the export call returns + // an error. + string dataset = 1 [(google.api.field_behavior) = REQUIRED]; + + // Required. The BigQuery table to which the snapshot result should be + // written. If this table does not exist, a new table with the given name + // will be created. + string table = 2 [(google.api.field_behavior) = REQUIRED]; + + // If the destination table already exists and this flag is `TRUE`, the + // table will be overwritten by the contents of assets snapshot. If the flag + // is not set and the destination table already exists, the export call + // returns an error. + bool force = 3; +} + // Asset content type. enum ContentType { // Unspecified content type. @@ -168,4 +227,10 @@ enum ContentType { // The actual IAM policy set on a resource. IAM_POLICY = 2; + + // The Cloud Organization Policy set on an asset. + ORG_POLICY = 4; + + // The Cloud Access context mananger Policy set on an asset. + ACCESS_POLICY = 5; } diff --git a/asset/google/cloud/asset_v1/proto/asset_service_pb2.py b/asset/google/cloud/asset_v1/proto/asset_service_pb2.py index 869d4dc3fee1..b382992b04c8 100644 --- a/asset/google/cloud/asset_v1/proto/asset_service_pb2.py +++ b/asset/google/cloud/asset_v1/proto/asset_service_pb2.py @@ -17,12 +17,17 @@ from google.api import annotations_pb2 as google_dot_api_dot_annotations__pb2 +from google.api import client_pb2 as google_dot_api_dot_client__pb2 +from google.api import field_behavior_pb2 as google_dot_api_dot_field__behavior__pb2 +from google.api import resource_pb2 as google_dot_api_dot_resource__pb2 from google.cloud.asset_v1.proto import ( assets_pb2 as google_dot_cloud_dot_asset__v1_dot_proto_dot_assets__pb2, ) from google.longrunning import ( operations_pb2 as google_dot_longrunning_dot_operations__pb2, ) +from google.protobuf import empty_pb2 as google_dot_protobuf_dot_empty__pb2 +from google.protobuf import field_mask_pb2 as google_dot_protobuf_dot_field__mask__pb2 from google.protobuf import timestamp_pb2 as google_dot_protobuf_dot_timestamp__pb2 @@ -34,12 +39,17 @@ "\n\031com.google.cloud.asset.v1B\021AssetServiceProtoP\001Z:google.golang.org/genproto/googleapis/cloud/asset/v1;asset\252\002\025Google.Cloud.Asset.V1\312\002\025Google\\Cloud\\Asset\\V1" ), serialized_pb=_b( - '\n/google/cloud/asset_v1/proto/asset_service.proto\x12\x15google.cloud.asset.v1\x1a\x1cgoogle/api/annotations.proto\x1a(google/cloud/asset_v1/proto/assets.proto\x1a#google/longrunning/operations.proto\x1a\x1fgoogle/protobuf/timestamp.proto"\xdf\x01\n\x13\x45xportAssetsRequest\x12\x0e\n\x06parent\x18\x01 \x01(\t\x12-\n\tread_time\x18\x02 \x01(\x0b\x32\x1a.google.protobuf.Timestamp\x12\x13\n\x0b\x61sset_types\x18\x03 \x03(\t\x12\x38\n\x0c\x63ontent_type\x18\x04 \x01(\x0e\x32".google.cloud.asset.v1.ContentType\x12:\n\routput_config\x18\x05 \x01(\x0b\x32#.google.cloud.asset.v1.OutputConfig"\x81\x01\n\x14\x45xportAssetsResponse\x12-\n\tread_time\x18\x01 \x01(\x0b\x32\x1a.google.protobuf.Timestamp\x12:\n\routput_config\x18\x02 \x01(\x0b\x32#.google.cloud.asset.v1.OutputConfig"\xba\x01\n\x1c\x42\x61tchGetAssetsHistoryRequest\x12\x0e\n\x06parent\x18\x01 \x01(\t\x12\x13\n\x0b\x61sset_names\x18\x02 \x03(\t\x12\x38\n\x0c\x63ontent_type\x18\x03 \x01(\x0e\x32".google.cloud.asset.v1.ContentType\x12;\n\x10read_time_window\x18\x04 \x01(\x0b\x32!.google.cloud.asset.v1.TimeWindow"U\n\x1d\x42\x61tchGetAssetsHistoryResponse\x12\x34\n\x06\x61ssets\x18\x01 \x03(\x0b\x32$.google.cloud.asset.v1.TemporalAsset"_\n\x0cOutputConfig\x12@\n\x0fgcs_destination\x18\x01 \x01(\x0b\x32%.google.cloud.asset.v1.GcsDestinationH\x00\x42\r\n\x0b\x64\x65stination"-\n\x0eGcsDestination\x12\r\n\x03uri\x18\x01 \x01(\tH\x00\x42\x0c\n\nobject_uri*I\n\x0b\x43ontentType\x12\x1c\n\x18\x43ONTENT_TYPE_UNSPECIFIED\x10\x00\x12\x0c\n\x08RESOURCE\x10\x01\x12\x0e\n\nIAM_POLICY\x10\x02\x32\xc9\x02\n\x0c\x41ssetService\x12\x83\x01\n\x0c\x45xportAssets\x12*.google.cloud.asset.v1.ExportAssetsRequest\x1a\x1d.google.longrunning.Operation"(\x82\xd3\xe4\x93\x02""\x1d/v1/{parent=*/*}:exportAssets:\x01*\x12\xb2\x01\n\x15\x42\x61tchGetAssetsHistory\x12\x33.google.cloud.asset.v1.BatchGetAssetsHistoryRequest\x1a\x34.google.cloud.asset.v1.BatchGetAssetsHistoryResponse".\x82\xd3\xe4\x93\x02(\x12&/v1/{parent=*/*}:batchGetAssetsHistoryB\x9c\x01\n\x19\x63om.google.cloud.asset.v1B\x11\x41ssetServiceProtoP\x01Z:google.golang.org/genproto/googleapis/cloud/asset/v1;asset\xaa\x02\x15Google.Cloud.Asset.V1\xca\x02\x15Google\\Cloud\\Asset\\V1b\x06proto3' + '\n/google/cloud/asset_v1/proto/asset_service.proto\x12\x15google.cloud.asset.v1\x1a\x1cgoogle/api/annotations.proto\x1a\x17google/api/client.proto\x1a\x1fgoogle/api/field_behavior.proto\x1a\x19google/api/resource.proto\x1a(google/cloud/asset_v1/proto/assets.proto\x1a#google/longrunning/operations.proto\x1a\x1bgoogle/protobuf/empty.proto\x1a google/protobuf/field_mask.proto\x1a\x1fgoogle/protobuf/timestamp.proto"\x8d\x02\n\x13\x45xportAssetsRequest\x12\x37\n\x06parent\x18\x01 \x01(\tB\'\xe0\x41\x02\xfa\x41!\x12\x1f\x63loudasset.googleapis.com/Asset\x12-\n\tread_time\x18\x02 \x01(\x0b\x32\x1a.google.protobuf.Timestamp\x12\x13\n\x0b\x61sset_types\x18\x03 \x03(\t\x12\x38\n\x0c\x63ontent_type\x18\x04 \x01(\x0e\x32".google.cloud.asset.v1.ContentType\x12?\n\routput_config\x18\x05 \x01(\x0b\x32#.google.cloud.asset.v1.OutputConfigB\x03\xe0\x41\x02"\x81\x01\n\x14\x45xportAssetsResponse\x12-\n\tread_time\x18\x01 \x01(\x0b\x32\x1a.google.protobuf.Timestamp\x12:\n\routput_config\x18\x02 \x01(\x0b\x32#.google.cloud.asset.v1.OutputConfig"\xed\x01\n\x1c\x42\x61tchGetAssetsHistoryRequest\x12\x37\n\x06parent\x18\x01 \x01(\tB\'\xe0\x41\x02\xfa\x41!\x12\x1f\x63loudasset.googleapis.com/Asset\x12\x13\n\x0b\x61sset_names\x18\x02 \x03(\t\x12=\n\x0c\x63ontent_type\x18\x03 \x01(\x0e\x32".google.cloud.asset.v1.ContentTypeB\x03\xe0\x41\x01\x12@\n\x10read_time_window\x18\x04 \x01(\x0b\x32!.google.cloud.asset.v1.TimeWindowB\x03\xe0\x41\x01"U\n\x1d\x42\x61tchGetAssetsHistoryResponse\x12\x34\n\x06\x61ssets\x18\x01 \x03(\x0b\x32$.google.cloud.asset.v1.TemporalAsset"\xab\x01\n\x0cOutputConfig\x12@\n\x0fgcs_destination\x18\x01 \x01(\x0b\x32%.google.cloud.asset.v1.GcsDestinationH\x00\x12J\n\x14\x62igquery_destination\x18\x02 \x01(\x0b\x32*.google.cloud.asset.v1.BigQueryDestinationH\x00\x42\r\n\x0b\x64\x65stination"C\n\x0eGcsDestination\x12\r\n\x03uri\x18\x01 \x01(\tH\x00\x12\x14\n\nuri_prefix\x18\x02 \x01(\tH\x00\x42\x0c\n\nobject_uri"N\n\x13\x42igQueryDestination\x12\x14\n\x07\x64\x61taset\x18\x01 \x01(\tB\x03\xe0\x41\x02\x12\x12\n\x05table\x18\x02 \x01(\tB\x03\xe0\x41\x02\x12\r\n\x05\x66orce\x18\x03 \x01(\x08*l\n\x0b\x43ontentType\x12\x1c\n\x18\x43ONTENT_TYPE_UNSPECIFIED\x10\x00\x12\x0c\n\x08RESOURCE\x10\x01\x12\x0e\n\nIAM_POLICY\x10\x02\x12\x0e\n\nORG_POLICY\x10\x04\x12\x11\n\rACCESS_POLICY\x10\x05\x32\xf3\x03\n\x0c\x41ssetService\x12\xde\x01\n\x0c\x45xportAssets\x12*.google.cloud.asset.v1.ExportAssetsRequest\x1a\x1d.google.longrunning.Operation"\x82\x01\x82\xd3\xe4\x93\x02""\x1d/v1/{parent=*/*}:exportAssets:\x01*\xca\x41W\n*google.cloud.asset.v1.ExportAssetsResponse\x12)google.cloud.asset.v1.ExportAssetsRequest\x12\xb2\x01\n\x15\x42\x61tchGetAssetsHistory\x12\x33.google.cloud.asset.v1.BatchGetAssetsHistoryRequest\x1a\x34.google.cloud.asset.v1.BatchGetAssetsHistoryResponse".\x82\xd3\xe4\x93\x02(\x12&/v1/{parent=*/*}:batchGetAssetsHistory\x1aM\xca\x41\x19\x63loudasset.googleapis.com\xd2\x41.https://www.googleapis.com/auth/cloud-platformB\x9c\x01\n\x19\x63om.google.cloud.asset.v1B\x11\x41ssetServiceProtoP\x01Z:google.golang.org/genproto/googleapis/cloud/asset/v1;asset\xaa\x02\x15Google.Cloud.Asset.V1\xca\x02\x15Google\\Cloud\\Asset\\V1b\x06proto3' ), dependencies=[ google_dot_api_dot_annotations__pb2.DESCRIPTOR, + google_dot_api_dot_client__pb2.DESCRIPTOR, + google_dot_api_dot_field__behavior__pb2.DESCRIPTOR, + google_dot_api_dot_resource__pb2.DESCRIPTOR, google_dot_cloud_dot_asset__v1_dot_proto_dot_assets__pb2.DESCRIPTOR, google_dot_longrunning_dot_operations__pb2.DESCRIPTOR, + google_dot_protobuf_dot_empty__pb2.DESCRIPTOR, + google_dot_protobuf_dot_field__mask__pb2.DESCRIPTOR, google_dot_protobuf_dot_timestamp__pb2.DESCRIPTOR, ], ) @@ -63,11 +73,17 @@ _descriptor.EnumValueDescriptor( name="IAM_POLICY", index=2, number=2, serialized_options=None, type=None ), + _descriptor.EnumValueDescriptor( + name="ORG_POLICY", index=3, number=4, serialized_options=None, type=None + ), + _descriptor.EnumValueDescriptor( + name="ACCESS_POLICY", index=4, number=5, serialized_options=None, type=None + ), ], containing_type=None, serialized_options=None, - serialized_start=994, - serialized_end=1067, + serialized_start=1418, + serialized_end=1526, ) _sym_db.RegisterEnumDescriptor(_CONTENTTYPE) @@ -75,6 +91,8 @@ CONTENT_TYPE_UNSPECIFIED = 0 RESOURCE = 1 IAM_POLICY = 2 +ORG_POLICY = 4 +ACCESS_POLICY = 5 _EXPORTASSETSREQUEST = _descriptor.Descriptor( @@ -99,7 +117,9 @@ containing_type=None, is_extension=False, extension_scope=None, - serialized_options=None, + serialized_options=_b( + "\340A\002\372A!\022\037cloudasset.googleapis.com/Asset" + ), file=DESCRIPTOR, ), _descriptor.FieldDescriptor( @@ -171,7 +191,7 @@ containing_type=None, is_extension=False, extension_scope=None, - serialized_options=None, + serialized_options=_b("\340A\002"), file=DESCRIPTOR, ), ], @@ -183,8 +203,8 @@ syntax="proto3", extension_ranges=[], oneofs=[], - serialized_start=217, - serialized_end=440, + serialized_start=365, + serialized_end=634, ) @@ -240,8 +260,8 @@ syntax="proto3", extension_ranges=[], oneofs=[], - serialized_start=443, - serialized_end=572, + serialized_start=637, + serialized_end=766, ) @@ -267,7 +287,9 @@ containing_type=None, is_extension=False, extension_scope=None, - serialized_options=None, + serialized_options=_b( + "\340A\002\372A!\022\037cloudasset.googleapis.com/Asset" + ), file=DESCRIPTOR, ), _descriptor.FieldDescriptor( @@ -303,7 +325,7 @@ containing_type=None, is_extension=False, extension_scope=None, - serialized_options=None, + serialized_options=_b("\340A\001"), file=DESCRIPTOR, ), _descriptor.FieldDescriptor( @@ -321,7 +343,7 @@ containing_type=None, is_extension=False, extension_scope=None, - serialized_options=None, + serialized_options=_b("\340A\001"), file=DESCRIPTOR, ), ], @@ -333,8 +355,8 @@ syntax="proto3", extension_ranges=[], oneofs=[], - serialized_start=575, - serialized_end=761, + serialized_start=769, + serialized_end=1006, ) @@ -372,8 +394,8 @@ syntax="proto3", extension_ranges=[], oneofs=[], - serialized_start=763, - serialized_end=848, + serialized_start=1008, + serialized_end=1093, ) @@ -401,7 +423,25 @@ extension_scope=None, serialized_options=None, file=DESCRIPTOR, - ) + ), + _descriptor.FieldDescriptor( + name="bigquery_destination", + full_name="google.cloud.asset.v1.OutputConfig.bigquery_destination", + 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=[], @@ -419,8 +459,8 @@ fields=[], ) ], - serialized_start=850, - serialized_end=945, + serialized_start=1096, + serialized_end=1267, ) @@ -448,7 +488,25 @@ extension_scope=None, serialized_options=None, file=DESCRIPTOR, - ) + ), + _descriptor.FieldDescriptor( + name="uri_prefix", + full_name="google.cloud.asset.v1.GcsDestination.uri_prefix", + index=1, + number=2, + type=9, + cpp_type=9, + label=1, + has_default_value=False, + default_value=_b("").decode("utf-8"), + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=None, + file=DESCRIPTOR, + ), ], extensions=[], nested_types=[], @@ -466,8 +524,83 @@ fields=[], ) ], - serialized_start=947, - serialized_end=992, + serialized_start=1269, + serialized_end=1336, +) + + +_BIGQUERYDESTINATION = _descriptor.Descriptor( + name="BigQueryDestination", + full_name="google.cloud.asset.v1.BigQueryDestination", + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name="dataset", + full_name="google.cloud.asset.v1.BigQueryDestination.dataset", + index=0, + number=1, + type=9, + cpp_type=9, + label=1, + has_default_value=False, + default_value=_b("").decode("utf-8"), + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=_b("\340A\002"), + file=DESCRIPTOR, + ), + _descriptor.FieldDescriptor( + name="table", + full_name="google.cloud.asset.v1.BigQueryDestination.table", + index=1, + number=2, + type=9, + cpp_type=9, + label=1, + has_default_value=False, + default_value=_b("").decode("utf-8"), + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=_b("\340A\002"), + file=DESCRIPTOR, + ), + _descriptor.FieldDescriptor( + name="force", + full_name="google.cloud.asset.v1.BigQueryDestination.force", + index=2, + number=3, + type=8, + cpp_type=7, + label=1, + has_default_value=False, + default_value=False, + 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=[], + serialized_options=None, + is_extendable=False, + syntax="proto3", + extension_ranges=[], + oneofs=[], + serialized_start=1338, + serialized_end=1416, ) _EXPORTASSETSREQUEST.fields_by_name[ @@ -487,18 +620,31 @@ "assets" ].message_type = google_dot_cloud_dot_asset__v1_dot_proto_dot_assets__pb2._TEMPORALASSET _OUTPUTCONFIG.fields_by_name["gcs_destination"].message_type = _GCSDESTINATION +_OUTPUTCONFIG.fields_by_name["bigquery_destination"].message_type = _BIGQUERYDESTINATION _OUTPUTCONFIG.oneofs_by_name["destination"].fields.append( _OUTPUTCONFIG.fields_by_name["gcs_destination"] ) _OUTPUTCONFIG.fields_by_name[ "gcs_destination" ].containing_oneof = _OUTPUTCONFIG.oneofs_by_name["destination"] +_OUTPUTCONFIG.oneofs_by_name["destination"].fields.append( + _OUTPUTCONFIG.fields_by_name["bigquery_destination"] +) +_OUTPUTCONFIG.fields_by_name[ + "bigquery_destination" +].containing_oneof = _OUTPUTCONFIG.oneofs_by_name["destination"] _GCSDESTINATION.oneofs_by_name["object_uri"].fields.append( _GCSDESTINATION.fields_by_name["uri"] ) _GCSDESTINATION.fields_by_name["uri"].containing_oneof = _GCSDESTINATION.oneofs_by_name[ "object_uri" ] +_GCSDESTINATION.oneofs_by_name["object_uri"].fields.append( + _GCSDESTINATION.fields_by_name["uri_prefix"] +) +_GCSDESTINATION.fields_by_name[ + "uri_prefix" +].containing_oneof = _GCSDESTINATION.oneofs_by_name["object_uri"] DESCRIPTOR.message_types_by_name["ExportAssetsRequest"] = _EXPORTASSETSREQUEST DESCRIPTOR.message_types_by_name["ExportAssetsResponse"] = _EXPORTASSETSRESPONSE DESCRIPTOR.message_types_by_name[ @@ -509,6 +655,7 @@ ] = _BATCHGETASSETSHISTORYRESPONSE DESCRIPTOR.message_types_by_name["OutputConfig"] = _OUTPUTCONFIG DESCRIPTOR.message_types_by_name["GcsDestination"] = _GCSDESTINATION +DESCRIPTOR.message_types_by_name["BigQueryDestination"] = _BIGQUERYDESTINATION DESCRIPTOR.enum_types_by_name["ContentType"] = _CONTENTTYPE _sym_db.RegisterFileDescriptor(DESCRIPTOR) @@ -539,9 +686,8 @@ A list of asset types of which to take a snapshot for. For example: "compute.googleapis.com/Disk". If specified, only matching assets will be returned. See `Introduction to Cloud - Asset Inventory `__ for all - supported asset types. + Asset Inventory `__ for all supported asset types. content_type: Asset content type. If not specified, no content but the asset name will be returned. @@ -600,13 +746,12 @@ te.googleapis.com/projects/my_project_123/zones/zone1/instance s/instance1``. See `Resource Names `__ and `Resource - Name Format `__ - for more info. The request becomes a no-op if the asset name - list is empty, and the max size of the asset name list is 100 - in one request. + Name Format `__ for more info. The + request becomes a no-op if the asset name list is empty, and + the max size of the asset name list is 100 in one request. content_type: - Required. The content type. + Optional. The content type. read_time_window: Optional. The time window for the asset history. Both start\_time and end\_time are optional and if set, it must be @@ -653,6 +798,11 @@ Asset export destination. gcs_destination: Destination on Cloud Storage. + bigquery_destination: + Destination on BigQuery. The output table stores the fields in + asset proto as columns in BigQuery. The resource/iam\_policy + field is converted to a record with each field to a column, + except metadata to a single JSON string. """, # @@protoc_insertion_point(class_scope:google.cloud.asset.v1.OutputConfig) ), @@ -677,23 +827,72 @@ See `Viewing and Editing Object Metadata `__ for more information. + uri_prefix: + The uri prefix of all generated Cloud Storage objects. For + example: "gs://bucket\_name/object\_name\_prefix". Each object + uri is in format: "gs://bucket\_name/object\_name\_prefix// + and only contains assets for that type. starts from 0. For + example: "gs://bucket\_name/object\_name\_prefix/compute.googl + eapis.com/Disk/0" is the first shard of output objects + containing all compute.googleapis.com/Disk assets. An + INVALID\_ARGUMENT error will be returned if file with the same + name "gs://bucket\_name/object\_name\_prefix" already exists. """, # @@protoc_insertion_point(class_scope:google.cloud.asset.v1.GcsDestination) ), ) _sym_db.RegisterMessage(GcsDestination) +BigQueryDestination = _reflection.GeneratedProtocolMessageType( + "BigQueryDestination", + (_message.Message,), + dict( + DESCRIPTOR=_BIGQUERYDESTINATION, + __module__="google.cloud.asset_v1.proto.asset_service_pb2", + __doc__="""A BigQuery destination. + + + Attributes: + dataset: + Required. The BigQuery dataset in format + "projects/projectId/datasets/datasetId", to which the snapshot + result should be exported. If this dataset does not exist, the + export call returns an error. + table: + Required. The BigQuery table to which the snapshot result + should be written. If this table does not exist, a new table + with the given name will be created. + force: + If the destination table already exists and this flag is + ``TRUE``, the table will be overwritten by the contents of + assets snapshot. If the flag is not set and the destination + table already exists, the export call returns an error. + """, + # @@protoc_insertion_point(class_scope:google.cloud.asset.v1.BigQueryDestination) + ), +) +_sym_db.RegisterMessage(BigQueryDestination) + DESCRIPTOR._options = None +_EXPORTASSETSREQUEST.fields_by_name["parent"]._options = None +_EXPORTASSETSREQUEST.fields_by_name["output_config"]._options = None +_BATCHGETASSETSHISTORYREQUEST.fields_by_name["parent"]._options = None +_BATCHGETASSETSHISTORYREQUEST.fields_by_name["content_type"]._options = None +_BATCHGETASSETSHISTORYREQUEST.fields_by_name["read_time_window"]._options = None +_BIGQUERYDESTINATION.fields_by_name["dataset"]._options = None +_BIGQUERYDESTINATION.fields_by_name["table"]._options = None _ASSETSERVICE = _descriptor.ServiceDescriptor( name="AssetService", full_name="google.cloud.asset.v1.AssetService", file=DESCRIPTOR, index=0, - serialized_options=None, - serialized_start=1070, - serialized_end=1399, + serialized_options=_b( + "\312A\031cloudasset.googleapis.com\322A.https://www.googleapis.com/auth/cloud-platform" + ), + serialized_start=1529, + serialized_end=2028, methods=[ _descriptor.MethodDescriptor( name="ExportAssets", @@ -703,7 +902,7 @@ input_type=_EXPORTASSETSREQUEST, output_type=google_dot_longrunning_dot_operations__pb2._OPERATION, serialized_options=_b( - '\202\323\344\223\002""\035/v1/{parent=*/*}:exportAssets:\001*' + '\202\323\344\223\002""\035/v1/{parent=*/*}:exportAssets:\001*\312AW\n*google.cloud.asset.v1.ExportAssetsResponse\022)google.cloud.asset.v1.ExportAssetsRequest' ), ), _descriptor.MethodDescriptor( diff --git a/asset/google/cloud/asset_v1/proto/assets.proto b/asset/google/cloud/asset_v1/proto/assets.proto index f6a8108c0bd2..e689b761822c 100644 --- a/asset/google/cloud/asset_v1/proto/assets.proto +++ b/asset/google/cloud/asset_v1/proto/assets.proto @@ -18,11 +18,13 @@ syntax = "proto3"; package google.cloud.asset.v1; import "google/api/annotations.proto"; +import "google/api/resource.proto"; import "google/iam/v1/policy.proto"; import "google/protobuf/any.proto"; import "google/protobuf/struct.proto"; import "google/protobuf/timestamp.proto"; +option cc_enable_arenas = true; option csharp_namespace = "Google.Cloud.Asset.V1"; option go_package = "google.golang.org/genproto/googleapis/cloud/asset/v1;asset"; option java_multiple_files = true; @@ -30,7 +32,6 @@ option java_outer_classname = "AssetProto"; option java_package = "com.google.cloud.asset.v1"; option php_namespace = "Google\\Cloud\\Asset\\V1"; - // Temporal asset. In addition to the asset, the temporal asset includes the // status of the asset and valid from and to time of it. message TemporalAsset { @@ -57,6 +58,11 @@ message TimeWindow { // Cloud asset. This includes all Google Cloud Platform resources, // Cloud IAM policies, and other non-GCP assets. message Asset { + option (google.api.resource) = { + type: "cloudasset.googleapis.com/Asset" + pattern: "*" + }; + // The full name of the asset. For example: // `//compute.googleapis.com/projects/my_project_123/zones/zone1/instances/instance1`. // See [Resource diff --git a/asset/google/cloud/asset_v1/proto/assets_pb2.py b/asset/google/cloud/asset_v1/proto/assets_pb2.py index 99fba5cde79d..0b37f61584ae 100644 --- a/asset/google/cloud/asset_v1/proto/assets_pb2.py +++ b/asset/google/cloud/asset_v1/proto/assets_pb2.py @@ -16,6 +16,7 @@ from google.api import annotations_pb2 as google_dot_api_dot_annotations__pb2 +from google.api import resource_pb2 as google_dot_api_dot_resource__pb2 from google.iam.v1 import iam_policy_pb2 as google_dot_iam_dot_v1_dot_policy__pb2 from google.protobuf import any_pb2 as google_dot_protobuf_dot_any__pb2 from google.protobuf import struct_pb2 as google_dot_protobuf_dot_struct__pb2 @@ -27,13 +28,14 @@ package="google.cloud.asset.v1", syntax="proto3", serialized_options=_b( - "\n\031com.google.cloud.asset.v1B\nAssetProtoP\001Z:google.golang.org/genproto/googleapis/cloud/asset/v1;asset\252\002\025Google.Cloud.Asset.V1\312\002\025Google\\Cloud\\Asset\\V1" + "\n\031com.google.cloud.asset.v1B\nAssetProtoP\001Z:google.golang.org/genproto/googleapis/cloud/asset/v1;asset\370\001\001\252\002\025Google.Cloud.Asset.V1\312\002\025Google\\Cloud\\Asset\\V1" ), serialized_pb=_b( - '\n(google/cloud/asset_v1/proto/assets.proto\x12\x15google.cloud.asset.v1\x1a\x1cgoogle/api/annotations.proto\x1a\x1agoogle/iam/v1/policy.proto\x1a\x19google/protobuf/any.proto\x1a\x1cgoogle/protobuf/struct.proto\x1a\x1fgoogle/protobuf/timestamp.proto"\x80\x01\n\rTemporalAsset\x12\x31\n\x06window\x18\x01 \x01(\x0b\x32!.google.cloud.asset.v1.TimeWindow\x12\x0f\n\x07\x64\x65leted\x18\x02 \x01(\x08\x12+\n\x05\x61sset\x18\x03 \x01(\x0b\x32\x1c.google.cloud.asset.v1.Asset"j\n\nTimeWindow\x12.\n\nstart_time\x18\x01 \x01(\x0b\x32\x1a.google.protobuf.Timestamp\x12,\n\x08\x65nd_time\x18\x02 \x01(\x0b\x32\x1a.google.protobuf.Timestamp"\x87\x01\n\x05\x41sset\x12\x0c\n\x04name\x18\x01 \x01(\t\x12\x12\n\nasset_type\x18\x02 \x01(\t\x12\x31\n\x08resource\x18\x03 \x01(\x0b\x32\x1f.google.cloud.asset.v1.Resource\x12)\n\niam_policy\x18\x04 \x01(\x0b\x32\x15.google.iam.v1.Policy"\xa0\x01\n\x08Resource\x12\x0f\n\x07version\x18\x01 \x01(\t\x12\x1e\n\x16\x64iscovery_document_uri\x18\x02 \x01(\t\x12\x16\n\x0e\x64iscovery_name\x18\x03 \x01(\t\x12\x14\n\x0cresource_url\x18\x04 \x01(\t\x12\x0e\n\x06parent\x18\x05 \x01(\t\x12%\n\x04\x64\x61ta\x18\x06 \x01(\x0b\x32\x17.google.protobuf.StructB\x95\x01\n\x19\x63om.google.cloud.asset.v1B\nAssetProtoP\x01Z:google.golang.org/genproto/googleapis/cloud/asset/v1;asset\xaa\x02\x15Google.Cloud.Asset.V1\xca\x02\x15Google\\Cloud\\Asset\\V1b\x06proto3' + '\n(google/cloud/asset_v1/proto/assets.proto\x12\x15google.cloud.asset.v1\x1a\x1cgoogle/api/annotations.proto\x1a\x19google/api/resource.proto\x1a\x1agoogle/iam/v1/policy.proto\x1a\x19google/protobuf/any.proto\x1a\x1cgoogle/protobuf/struct.proto\x1a\x1fgoogle/protobuf/timestamp.proto"\x80\x01\n\rTemporalAsset\x12\x31\n\x06window\x18\x01 \x01(\x0b\x32!.google.cloud.asset.v1.TimeWindow\x12\x0f\n\x07\x64\x65leted\x18\x02 \x01(\x08\x12+\n\x05\x61sset\x18\x03 \x01(\x0b\x32\x1c.google.cloud.asset.v1.Asset"j\n\nTimeWindow\x12.\n\nstart_time\x18\x01 \x01(\x0b\x32\x1a.google.protobuf.Timestamp\x12,\n\x08\x65nd_time\x18\x02 \x01(\x0b\x32\x1a.google.protobuf.Timestamp"\xb0\x01\n\x05\x41sset\x12\x0c\n\x04name\x18\x01 \x01(\t\x12\x12\n\nasset_type\x18\x02 \x01(\t\x12\x31\n\x08resource\x18\x03 \x01(\x0b\x32\x1f.google.cloud.asset.v1.Resource\x12)\n\niam_policy\x18\x04 \x01(\x0b\x32\x15.google.iam.v1.Policy:\'\xea\x41$\n\x1f\x63loudasset.googleapis.com/Asset\x12\x01*"\xa0\x01\n\x08Resource\x12\x0f\n\x07version\x18\x01 \x01(\t\x12\x1e\n\x16\x64iscovery_document_uri\x18\x02 \x01(\t\x12\x16\n\x0e\x64iscovery_name\x18\x03 \x01(\t\x12\x14\n\x0cresource_url\x18\x04 \x01(\t\x12\x0e\n\x06parent\x18\x05 \x01(\t\x12%\n\x04\x64\x61ta\x18\x06 \x01(\x0b\x32\x17.google.protobuf.StructB\x98\x01\n\x19\x63om.google.cloud.asset.v1B\nAssetProtoP\x01Z:google.golang.org/genproto/googleapis/cloud/asset/v1;asset\xf8\x01\x01\xaa\x02\x15Google.Cloud.Asset.V1\xca\x02\x15Google\\Cloud\\Asset\\V1b\x06proto3' ), dependencies=[ google_dot_api_dot_annotations__pb2.DESCRIPTOR, + google_dot_api_dot_resource__pb2.DESCRIPTOR, google_dot_iam_dot_v1_dot_policy__pb2.DESCRIPTOR, google_dot_protobuf_dot_any__pb2.DESCRIPTOR, google_dot_protobuf_dot_struct__pb2.DESCRIPTOR, @@ -112,8 +114,8 @@ syntax="proto3", extension_ranges=[], oneofs=[], - serialized_start=216, - serialized_end=344, + serialized_start=243, + serialized_end=371, ) @@ -169,8 +171,8 @@ syntax="proto3", extension_ranges=[], oneofs=[], - serialized_start=346, - serialized_end=452, + serialized_start=373, + serialized_end=479, ) @@ -257,13 +259,13 @@ extensions=[], nested_types=[], enum_types=[], - serialized_options=None, + serialized_options=_b("\352A$\n\037cloudasset.googleapis.com/Asset\022\001*"), is_extendable=False, syntax="proto3", extension_ranges=[], oneofs=[], - serialized_start=455, - serialized_end=590, + serialized_start=482, + serialized_end=658, ) @@ -391,8 +393,8 @@ syntax="proto3", extension_ranges=[], oneofs=[], - serialized_start=593, - serialized_end=753, + serialized_start=661, + serialized_end=821, ) _TEMPORALASSET.fields_by_name["window"].message_type = _TIMEWINDOW @@ -541,4 +543,5 @@ DESCRIPTOR._options = None +_ASSET._options = None # @@protoc_insertion_point(module_scope) diff --git a/asset/synth.metadata b/asset/synth.metadata index 2a27fdfa4cf0..630bcf259589 100644 --- a/asset/synth.metadata +++ b/asset/synth.metadata @@ -1,26 +1,26 @@ { - "updateTime": "2019-08-06T12:11:34.528326Z", + "updateTime": "2019-10-29T12:12:19.326302Z", "sources": [ { "generator": { "name": "artman", - "version": "0.32.1", - "dockerImage": "googleapis/artman@sha256:a684d40ba9a4e15946f5f2ca6b4bd9fe301192f522e9de4fff622118775f309b" + "version": "0.40.3", + "dockerImage": "googleapis/artman@sha256:c805f50525f5f557886c94ab76f56eaa09cb1da58c3ee95111fd34259376621a" } }, { "git": { "name": "googleapis", "remote": "https://github.com/googleapis/googleapis.git", - "sha": "e699b0cba64ffddfae39633417180f1f65875896", - "internalRef": "261759677" + "sha": "532773acbed8d09451dafb3d403ab1823e6a6e1e", + "internalRef": "277177415" } }, { "template": { "name": "python_library", "origin": "synthtool.gcp", - "version": "2019.5.2" + "version": "2019.10.17" } } ],