Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 4 additions & 5 deletions asset/cloud-client/quickstart_batchgetassetshistory.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,19 +20,18 @@

def batch_get_assets_history(project_id, asset_names):
# [START asset_quickstart_batch_get_assets_history]
from google.cloud import asset_v1beta1
from google.cloud.asset_v1beta1.proto import assets_pb2
from google.cloud.asset_v1beta1 import enums
from google.cloud import asset_v1
from google.cloud.asset_v1.proto import assets_pb2
from google.cloud.asset_v1 import enums

# TODO project_id = 'Your Google Cloud Project ID'
# TODO asset_names = 'Your asset names list, e.g.:
# ["//storage.googleapis.com/[BUCKET_NAME]",]'

client = asset_v1beta1.AssetServiceClient()
client = asset_v1.AssetServiceClient()
parent = client.project_path(project_id)
content_type = enums.ContentType.RESOURCE
read_time_window = assets_pb2.TimeWindow()
read_time_window.start_time.GetCurrentTime()
response = client.batch_get_assets_history(
parent, content_type, read_time_window, asset_names)
print('assets: {}'.format(response.assets))
Expand Down
6 changes: 3 additions & 3 deletions asset/cloud-client/quickstart_exportassets.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,13 @@

def export_assets(project_id, dump_file_path):
# [START asset_quickstart_export_assets]
from google.cloud import asset_v1beta1
from google.cloud.asset_v1beta1.proto import asset_service_pb2
from google.cloud import asset_v1
from google.cloud.asset_v1.proto import asset_service_pb2

# TODO project_id = 'Your Google Cloud Project ID'
# TODO dump_file_path = 'Your asset dump file path'

client = asset_v1beta1.AssetServiceClient()
client = asset_v1.AssetServiceClient()
parent = client.project_path(project_id)
output_config = asset_service_pb2.OutputConfig()
output_config.gcs_destination.uri = dump_file_path
Expand Down
2 changes: 1 addition & 1 deletion asset/cloud-client/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
google-cloud-storage==1.13.2
google-cloud-asset==0.1.2
google-cloud-asset==0.2.0