From d06717e3036a23e181a00439b545a928806992df Mon Sep 17 00:00:00 2001 From: yoshi-automation Date: Fri, 19 Jul 2019 05:16:43 -0700 Subject: [PATCH] [CHANGE ME] Re-generated datacatalog to pick up changes in the API or client library generator. --- .../v1beta1/datacatalog_lookup_entry.py | 71 +++++++++++++++++++ .../datacatalog_lookup_entry_sql_resource.py | 70 ++++++++++++++++++ datacatalog/synth.metadata | 10 +-- 3 files changed, 146 insertions(+), 5 deletions(-) create mode 100644 datacatalog/samples/v1beta1/datacatalog_lookup_entry.py create mode 100644 datacatalog/samples/v1beta1/datacatalog_lookup_entry_sql_resource.py diff --git a/datacatalog/samples/v1beta1/datacatalog_lookup_entry.py b/datacatalog/samples/v1beta1/datacatalog_lookup_entry.py new file mode 100644 index 000000000000..189b4cb8edca --- /dev/null +++ b/datacatalog/samples/v1beta1/datacatalog_lookup_entry.py @@ -0,0 +1,71 @@ +# -*- coding: utf-8 -*- +# +# 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 +# +# https://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. + +# DO NOT EDIT! This is a generated sample ("Request", "datacatalog_lookup_entry") + +# To install the latest published package dependency, execute the following: +# pip install google-cloud-datacatalog + +# sample-metadata +# title: +# description: Lookup Entry +# usage: python3 samples/v1beta1/datacatalog_lookup_entry.py [--resource_name "[Full Resource Name]"] +import sys + +# [START datacatalog_lookup_entry] + +from google.cloud import datacatalog_v1beta1 +from google.cloud.datacatalog_v1beta1 import enums + + +def sample_lookup_entry(resource_name): + """ + Lookup Entry + + Args: + resource_name The full name of the Google Cloud Platform resource the Data + Catalog entry represents. + See: https://cloud.google.com/apis/design/resource_names#full_resource_name + Examples: + //bigquery.googleapis.com/projects/bigquery-public-data/datasets/new_york_taxi_trips/tables/taxi_zone_geom + //pubsub.googleapis.com/projects/pubsub-public-data/topics/taxirides-realtime + """ + + client = datacatalog_v1beta1.DataCatalogClient() + + # resource_name = '[Full Resource Name]' + response = client.lookup_entry(linked_resource=resource_name) + entry = response + print(u"Entry name: {}".format(entry.name)) + print(u"Entry type: {}".format(enums.EntryType(entry.type).name)) + print(u"Linked resource: {}".format(entry.linked_resource)) + + +# [END datacatalog_lookup_entry] + + +def main(): + import argparse + + parser = argparse.ArgumentParser() + parser.add_argument("--resource_name", type=str, default="[Full Resource Name]") + args = parser.parse_args() + + sample_lookup_entry(args.resource_name) + + +if __name__ == "__main__": + main() diff --git a/datacatalog/samples/v1beta1/datacatalog_lookup_entry_sql_resource.py b/datacatalog/samples/v1beta1/datacatalog_lookup_entry_sql_resource.py new file mode 100644 index 000000000000..f2928aafcaf8 --- /dev/null +++ b/datacatalog/samples/v1beta1/datacatalog_lookup_entry_sql_resource.py @@ -0,0 +1,70 @@ +# -*- coding: utf-8 -*- +# +# 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 +# +# https://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. + +# DO NOT EDIT! This is a generated sample ("Request", "datacatalog_lookup_entry_sql_resource") + +# To install the latest published package dependency, execute the following: +# pip install google-cloud-datacatalog + +# sample-metadata +# title: +# description: Lookup Entry using SQL resource +# usage: python3 samples/v1beta1/datacatalog_lookup_entry_sql_resource.py [--sql_name "[SQL Resource Name]"] +import sys + +# [START datacatalog_lookup_entry_sql_resource] + +from google.cloud import datacatalog_v1beta1 +from google.cloud.datacatalog_v1beta1 import enums + + +def sample_lookup_entry(sql_name): + """ + Lookup Entry using SQL resource + + Args: + sql_name The SQL name of the Google Cloud Platform resource the Data Catalog + entry represents. + Examples: + bigquery.table.`bigquery-public-data`.new_york_taxi_trips.taxi_zone_geom + pubsub.topic.`pubsub-public-data`.`taxirides-realtime` + """ + + client = datacatalog_v1beta1.DataCatalogClient() + + # sql_name = '[SQL Resource Name]' + response = client.lookup_entry(sql_resource=sql_name) + entry = response + print(u"Entry name: {}".format(entry.name)) + print(u"Entry type: {}".format(enums.EntryType(entry.type).name)) + print(u"Linked resource: {}".format(entry.linked_resource)) + + +# [END datacatalog_lookup_entry_sql_resource] + + +def main(): + import argparse + + parser = argparse.ArgumentParser() + parser.add_argument("--sql_name", type=str, default="[SQL Resource Name]") + args = parser.parse_args() + + sample_lookup_entry(args.sql_name) + + +if __name__ == "__main__": + main() diff --git a/datacatalog/synth.metadata b/datacatalog/synth.metadata index d1ee140082c0..12b15de5f630 100644 --- a/datacatalog/synth.metadata +++ b/datacatalog/synth.metadata @@ -1,19 +1,19 @@ { - "updateTime": "2019-07-12T12:17:15.741513Z", + "updateTime": "2019-07-19T12:16:42.822949Z", "sources": [ { "generator": { "name": "artman", - "version": "0.29.4", - "dockerImage": "googleapis/artman@sha256:63f21e83cb92680b7001dc381069e962c9e6dee314fd8365ac554c07c89221fb" + "version": "0.30.1", + "dockerImage": "googleapis/artman@sha256:f1a2e851e5e012c59e1da4125480bb19878f86a4e7fac4f375f2e819956b5aa3" } }, { "git": { "name": "googleapis", "remote": "https://github.com/googleapis/googleapis.git", - "sha": "47bd0c2ba33c28dd624a65dad382e02bb61d1618", - "internalRef": "257690259" + "sha": "f78612e8d008b9678252da84c035da12e92c0093", + "internalRef": "258869625" } }, {