Skip to content

Commit 308efb1

Browse files
yoshi-automationbusunkim96
authored andcommitted
Add get_entry sample (via synth). (#8725)
1 parent b854c2b commit 308efb1

2 files changed

Lines changed: 82 additions & 3 deletions

File tree

Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
# -*- coding: utf-8 -*-
2+
#
3+
# Copyright 2019 Google LLC
4+
#
5+
# Licensed under the Apache License, Version 2.0 (the "License");
6+
# you may not use this file except in compliance with the License.
7+
# You may obtain a copy of the License at
8+
#
9+
# https://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing, software
12+
# distributed under the License is distributed on an "AS IS" BASIS,
13+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
# See the License for the specific language governing permissions and
15+
# limitations under the License.
16+
17+
# DO NOT EDIT! This is a generated sample ("Request", "datacatalog_get_entry")
18+
19+
# To install the latest published package dependency, execute the following:
20+
# pip install google-cloud-datacatalog
21+
22+
# sample-metadata
23+
# title:
24+
# description: Get Entry
25+
# usage: python3 samples/v1beta1/datacatalog_get_entry.py [--project_id "[Google Cloud Project ID]"] [--location_id "[Google Cloud Location ID]"] [--entry_group_id "[Entry Group ID]"] [--entry_id "[Entry ID]"]
26+
import sys
27+
28+
# [START datacatalog_get_entry]
29+
30+
from google.cloud import datacatalog_v1beta1
31+
from google.cloud.datacatalog_v1beta1 import enums
32+
33+
34+
def sample_get_entry(project_id, location_id, entry_group_id, entry_id):
35+
"""
36+
Get Entry
37+
38+
Args:
39+
project_id Your Google Cloud project ID
40+
location_id Google Cloud region, e.g. us-central1
41+
entry_group_id ID of the Entry Group, e.g. @bigquery, @pubsub, my_entry_group
42+
entry_id ID of the Entry
43+
"""
44+
45+
client = datacatalog_v1beta1.DataCatalogClient()
46+
47+
# project_id = '[Google Cloud Project ID]'
48+
# location_id = '[Google Cloud Location ID]'
49+
# entry_group_id = '[Entry Group ID]'
50+
# entry_id = '[Entry ID]'
51+
name = client.entry_path(project_id, location_id, entry_group_id, entry_id)
52+
53+
response = client.get_entry(name)
54+
entry = response
55+
print(u"Entry name: {}".format(entry.name))
56+
print(u"Entry type: {}".format(enums.EntryType(entry.type).name))
57+
print(u"Linked resource: {}".format(entry.linked_resource))
58+
59+
60+
# [END datacatalog_get_entry]
61+
62+
63+
def main():
64+
import argparse
65+
66+
parser = argparse.ArgumentParser()
67+
parser.add_argument("--project_id", type=str, default="[Google Cloud Project ID]")
68+
parser.add_argument("--location_id", type=str, default="[Google Cloud Location ID]")
69+
parser.add_argument("--entry_group_id", type=str, default="[Entry Group ID]")
70+
parser.add_argument("--entry_id", type=str, default="[Entry ID]")
71+
args = parser.parse_args()
72+
73+
sample_get_entry(
74+
args.project_id, args.location_id, args.entry_group_id, args.entry_id
75+
)
76+
77+
78+
if __name__ == "__main__":
79+
main()

packages/google-cloud-datacatalog/synth.metadata

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"updateTime": "2019-07-19T12:16:42.822949Z",
2+
"updateTime": "2019-07-20T12:17:02.340446Z",
33
"sources": [
44
{
55
"generator": {
@@ -12,8 +12,8 @@
1212
"git": {
1313
"name": "googleapis",
1414
"remote": "https://github.com/googleapis/googleapis.git",
15-
"sha": "f78612e8d008b9678252da84c035da12e92c0093",
16-
"internalRef": "258869625"
15+
"sha": "184ab77f4cee62332f8f9a689c70c9bea441f836",
16+
"internalRef": "259048326"
1717
}
1818
},
1919
{

0 commit comments

Comments
 (0)