Skip to content
Merged
Changes from all commits
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
14 changes: 7 additions & 7 deletions asset/quickstart.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,16 +16,16 @@ def export_assets project_id:, dump_file_path:
# [START asset_quickstart_export_assets]
require "google/cloud/asset"

asset_service_client = Google::Cloud::Asset.new version: :v1beta1
asset_service_client = Google::Cloud::Asset.new version: :v1
# project_id = 'YOUR_PROJECT_ID'
# Assets dump file path, e.g.: gs://[YOUR_BUCKET]/[YOUR_ASSETS_FILE]
# dump_file_path = 'YOUR_ASSET_DUMP_FILE_PATH'
formatted_parent =
Google::Cloud::Asset::V1beta1::AssetServiceClient.project_path(
Google::Cloud::Asset::V1::AssetServiceClient.project_path(
project_id
)
output_config = Google::Cloud::Asset::V1beta1::OutputConfig.new(
gcs_destination: Google::Cloud::Asset::V1beta1::GcsDestination.new(
output_config = Google::Cloud::Asset::V1::OutputConfig.new(
gcs_destination: Google::Cloud::Asset::V1::GcsDestination.new(
uri: dump_file_path
)
)
Expand All @@ -50,14 +50,14 @@ def batch_get_history project_id:, asset_names:
# asset names, e.g.: //storage.googleapis.com/[YOUR_BUCKET_NAME]
# asset_names = [ASSET_NAMES, COMMMA_DELIMTTED]
formatted_parent =
Google::Cloud::Asset::V1beta1::AssetServiceClient.project_path project_id
Google::Cloud::Asset::V1::AssetServiceClient.project_path project_id

content_type = :RESOURCE
read_time_window = Google::Cloud::Asset::V1beta1::TimeWindow.new(
read_time_window = Google::Cloud::Asset::V1::TimeWindow.new(
start_time: Google::Protobuf::Timestamp.new(seconds: Time.now.getutc.to_i)
)

asset_service_client = Google::Cloud::Asset.new version: :v1beta1
asset_service_client = Google::Cloud::Asset.new version: :v1
response = asset_service_client.batch_get_assets_history(
formatted_parent, content_type, read_time_window, asset_names: asset_names
)
Expand Down