Skip to content

Asset: Update Real Time Feed Sample Code with newest version #2623

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Dec 16, 2019
Merged
Show file tree
Hide file tree
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
6 changes: 3 additions & 3 deletions asset/cloud-client/quickstart_createfeed.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,15 @@

def create_feed(project_id, feed_id, asset_names, topic):
# [START asset_quickstart_create_feed]
from google.cloud import asset_v1p2beta1
from google.cloud.asset_v1p2beta1.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 feed_id = 'Feed ID you want to create'
# TODO asset_names = 'List of asset names the feed listen to'
# TODO topic = "Topic name of the feed"

client = asset_v1p2beta1.AssetServiceClient()
client = asset_v1.AssetServiceClient()
parent = "projects/{}".format(project_id)
feed = asset_service_pb2.Feed()
feed.asset_names.extend(asset_names)
Expand Down
4 changes: 2 additions & 2 deletions asset/cloud-client/quickstart_deletefeed.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,11 @@

def delete_feed(feed_name):
# [START asset_quickstart_delete_feed]
from google.cloud import asset_v1p2beta1
from google.cloud import asset_v1

# TODO feed_name = 'Feed name you want to delete'

client = asset_v1p2beta1.AssetServiceClient()
client = asset_v1.AssetServiceClient()
client.delete_feed(feed_name)
print('deleted_feed')
# [END asset_quickstart_delete_feed]
Expand Down
4 changes: 2 additions & 2 deletions asset/cloud-client/quickstart_getfeed.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,11 @@

def get_feed(feed_name):
# [START asset_quickstart_get_feed]
from google.cloud import asset_v1p2beta1
from google.cloud import asset_v1

# TODO feed_name = 'Feed Name you want to get'

client = asset_v1p2beta1.AssetServiceClient()
client = asset_v1.AssetServiceClient()
response = client.get_feed(feed_name)
print('gotten_feed: {}'.format(response))
# [START asset_quickstart_get_feed]
Expand Down
4 changes: 2 additions & 2 deletions asset/cloud-client/quickstart_listfeeds.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,11 @@

def list_feeds(parent_resource):
# [START asset_quickstart_list_feeds]
from google.cloud import asset_v1p2beta1
from google.cloud import asset_v1

# TODO parent_resource = 'Parent resource you want to list all feeds'

client = asset_v1p2beta1.AssetServiceClient()
client = asset_v1.AssetServiceClient()
response = client.list_feeds(parent_resource)
print('feeds: {}'.format(response.feeds))
# [END asset_quickstart_list_feeds]
Expand Down
6 changes: 3 additions & 3 deletions asset/cloud-client/quickstart_updatefeed.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,14 @@

def update_feed(feed_name, topic):
# [START asset_quickstart_update_feed]
from google.cloud import asset_v1p2beta1
from google.cloud.asset_v1p2beta1.proto import asset_service_pb2
from google.cloud import asset_v1
from google.cloud.asset_v1.proto import asset_service_pb2
from google.protobuf import field_mask_pb2

# TODO feed_name = 'Feed Name you want to update'
# TODO topic = "Topic name you want to update with"

client = asset_v1p2beta1.AssetServiceClient()
client = asset_v1.AssetServiceClient()
feed = asset_service_pb2.Feed()
feed.name = feed_name
feed.feed_output_config.pubsub_destination.topic = topic
Expand Down
2 changes: 1 addition & 1 deletion asset/cloud-client/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
google-cloud-storage==1.19.1
google-cloud-asset==0.4.1
google-cloud-asset==0.6.0
google-cloud-resource-manager==0.29.2
google-cloud-pubsub==1.0.2