Skip to content

Commit b3151fb

Browse files
committed
feat(firehose): Add Python Basics scenario and Hello example
1 parent b8e0fc6 commit b3151fb

6 files changed

Lines changed: 991 additions & 47 deletions

File tree

Lines changed: 157 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -1,95 +1,205 @@
1-
# zexi 0.4.0
2-
firehose_PutRecord:
1+
firehose_Hello:
2+
title: Hello &ADF;
3+
title_abbrev: Hello &ADF;
4+
synopsis: get started using &ADF;.
5+
category: Hello
36
languages:
4-
Java:
7+
Python:
58
versions:
6-
- sdk_version: 2
7-
github: javav2/example_code/firehose
9+
- sdk_version: 3
10+
github: python/example_code/firehose
811
excerpts:
912
- description:
1013
snippet_tags:
11-
- firehose.java2.put_record.main
14+
- python.example_code.firehose.Hello
15+
services:
16+
firehose: {ListDeliveryStreams}
17+
firehose_CreateDeliveryStream:
18+
title: Create a &ADF; delivery stream
19+
title_abbrev: Create a delivery stream
20+
synopsis: create an &ADF; delivery stream.
21+
category: Actions
22+
languages:
1223
Python:
1324
versions:
1425
- sdk_version: 3
1526
github: python/example_code/firehose
1627
excerpts:
1728
- description:
1829
snippet_tags:
19-
- python.example_code.firehose.init
20-
- python.example_code.firehose.put_record
21-
SAP ABAP:
30+
- python.example_code.firehose.FirehoseWrapper.decl
31+
- python.example_code.firehose.CreateDeliveryStream
32+
services:
33+
firehose: {CreateDeliveryStream}
34+
firehose_DescribeDeliveryStream:
35+
title: Describe a &ADF; delivery stream
36+
title_abbrev: Describe a delivery stream
37+
synopsis: describe an &ADF; delivery stream.
38+
category: Actions
39+
languages:
40+
Python:
2241
versions:
23-
- sdk_version: 1
24-
github: sap-abap/services/frh
42+
- sdk_version: 3
43+
github: python/example_code/firehose
2544
excerpts:
2645
- description:
2746
snippet_tags:
28-
- frh.abapv1.put_record
47+
- python.example_code.firehose.FirehoseWrapper.decl
48+
- python.example_code.firehose.DescribeDeliveryStream
2949
services:
30-
firehose: {PutRecord}
31-
firehose_PutRecordBatch:
50+
firehose: {DescribeDeliveryStream}
51+
firehose_TagDeliveryStream:
52+
title: Tag a &ADF; delivery stream
53+
title_abbrev: Tag a delivery stream
54+
synopsis: tag an &ADF; delivery stream.
55+
category: Actions
3256
languages:
33-
Java:
57+
Python:
3458
versions:
35-
- sdk_version: 2
36-
github: javav2/example_code/firehose
59+
- sdk_version: 3
60+
github: python/example_code/firehose
3761
excerpts:
3862
- description:
3963
snippet_tags:
40-
- firehose.java2.put_batch_records.main
41-
Rust:
64+
- python.example_code.firehose.FirehoseWrapper.decl
65+
- python.example_code.firehose.TagDeliveryStream
66+
services:
67+
firehose: {TagDeliveryStream}
68+
firehose_ListTagsForDeliveryStream:
69+
title: List tags for a &ADF; delivery stream
70+
title_abbrev: List tags for a delivery stream
71+
synopsis: list tags for an &ADF; delivery stream.
72+
category: Actions
73+
languages:
74+
Python:
4275
versions:
43-
- sdk_version: 1
44-
github: rustv1/examples/firehose
45-
sdkguide:
76+
- sdk_version: 3
77+
github: python/example_code/firehose
4678
excerpts:
4779
- description:
4880
snippet_tags:
49-
- firehose.rust.put_record_batch
81+
- python.example_code.firehose.FirehoseWrapper.decl
82+
- python.example_code.firehose.ListTagsForDeliveryStream
83+
services:
84+
firehose: {ListTagsForDeliveryStream}
85+
firehose_StartDeliveryStreamEncryption:
86+
title: Start encryption on a &ADF; delivery stream
87+
title_abbrev: Start delivery stream encryption
88+
synopsis: start server-side encryption on an &ADF; delivery stream.
89+
category: Actions
90+
languages:
5091
Python:
5192
versions:
5293
- sdk_version: 3
5394
github: python/example_code/firehose
5495
excerpts:
5596
- description:
5697
snippet_tags:
57-
- python.example_code.firehose.init
58-
- python.example_code.firehose.put_record_batch
59-
SAP ABAP:
98+
- python.example_code.firehose.FirehoseWrapper.decl
99+
- python.example_code.firehose.StartDeliveryStreamEncryption
100+
services:
101+
firehose: {StartDeliveryStreamEncryption}
102+
firehose_PutRecord:
103+
title: Put a record to a &ADF; delivery stream
104+
title_abbrev: Put a record
105+
synopsis: put a record to an &ADF; delivery stream.
106+
category: Actions
107+
languages:
108+
Python:
60109
versions:
61-
- sdk_version: 1
62-
github: sap-abap/services/frh
110+
- sdk_version: 3
111+
github: python/example_code/firehose
63112
excerpts:
64113
- description:
65114
snippet_tags:
66-
- frh.abapv1.put_record_batch
115+
- python.example_code.firehose.FirehoseWrapper.decl
116+
- python.example_code.firehose.PutRecord
117+
services:
118+
firehose: {PutRecord}
119+
firehose_PutRecordBatch:
120+
title: Put a batch of records to a &ADF; delivery stream
121+
title_abbrev: Put a record batch
122+
synopsis: put a batch of records to an &ADF; delivery stream.
123+
category: Actions
124+
languages:
125+
Python:
126+
versions:
127+
- sdk_version: 3
128+
github: python/example_code/firehose
129+
excerpts:
130+
- description:
131+
snippet_tags:
132+
- python.example_code.firehose.FirehoseWrapper.decl
133+
- python.example_code.firehose.PutRecordBatch
67134
services:
68135
firehose: {PutRecordBatch}
69-
firehose_Scenario_PutRecords:
70-
title: Use &FHlong; to process individual and batch records
71-
title_abbrev: Put records to &FH;
72-
synopsis: use &FH; to process individual and batch records.
73-
category: Scenarios
136+
firehose_UpdateDestination:
137+
title: Update destination of a &ADF; delivery stream
138+
title_abbrev: Update destination
139+
synopsis: update the destination of an &ADF; delivery stream.
140+
category: Actions
141+
languages:
142+
Python:
143+
versions:
144+
- sdk_version: 3
145+
github: python/example_code/firehose
146+
excerpts:
147+
- description:
148+
snippet_tags:
149+
- python.example_code.firehose.FirehoseWrapper.decl
150+
- python.example_code.firehose.UpdateDestination
151+
services:
152+
firehose: {UpdateDestination}
153+
firehose_ListDeliveryStreams:
154+
title: List &ADF; delivery streams
155+
title_abbrev: List delivery streams
156+
synopsis: list &ADF; delivery streams.
157+
category: Actions
158+
languages:
159+
Python:
160+
versions:
161+
- sdk_version: 3
162+
github: python/example_code/firehose
163+
excerpts:
164+
- description:
165+
snippet_tags:
166+
- python.example_code.firehose.FirehoseWrapper.decl
167+
- python.example_code.firehose.ListDeliveryStreams
168+
services:
169+
firehose: {ListDeliveryStreams}
170+
firehose_DeleteDeliveryStream:
171+
title: Delete a &ADF; delivery stream
172+
title_abbrev: Delete a delivery stream
173+
synopsis: delete an &ADF; delivery stream.
174+
category: Actions
74175
languages:
75-
Java:
176+
Python:
76177
versions:
77-
- sdk_version: 2
78-
github: javav2/example_code/firehose
178+
- sdk_version: 3
179+
github: python/example_code/firehose
79180
excerpts:
80-
- description: This example puts individual and batch records to &FH;.
181+
- description:
81182
snippet_tags:
82-
- firehose.java2.scenario.main
183+
- python.example_code.firehose.FirehoseWrapper.decl
184+
- python.example_code.firehose.DeleteDeliveryStream
185+
services:
186+
firehose: {DeleteDeliveryStream}
187+
firehose_Scenario:
188+
title: Learn &ADF; basics
189+
title_abbrev: Learn the basics
190+
synopsis: learn the basics of &ADF; by creating a delivery stream and managing it.
191+
category: Scenarios
192+
languages:
83193
Python:
84194
versions:
85195
- sdk_version: 3
86-
github: python/example_code/firehose/scenarios/firehose-put-actions
196+
github: python/example_code/firehose
87197
excerpts:
88-
- description: This script puts individual and batch records to &FH;.
89-
snippet_files:
90-
- python/example_code/firehose/scenarios/firehose-put-actions/firehose.py
91-
- description: This file contains config for the above script.
92-
snippet_files:
93-
- python/example_code/firehose/scenarios/firehose-put-actions/config.py
198+
- description: Create a Firehose wrapper class to manage operations.
199+
snippet_tags:
200+
- python.example_code.firehose.FirehoseWrapper.class
201+
- description: Run an interactive scenario demonstrating Firehose basics.
202+
snippet_tags:
203+
- python.example_code.firehose.FirehoseScenario
94204
services:
95-
firehose: {PutRecord, PutRecordBatch}
205+
firehose: {CreateDeliveryStream, DescribeDeliveryStream, TagDeliveryStream, ListTagsForDeliveryStream, StartDeliveryStreamEncryption, PutRecord, PutRecordBatch, UpdateDestination, ListDeliveryStreams, DeleteDeliveryStream}
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2+
# SPDX-License-Identifier: Apache-2.0
3+
4+
"""
5+
Purpose: Hello Amazon Data Firehose - Lists delivery streams in your account.
6+
"""
7+
8+
# snippet-start:[python.example_code.firehose.Hello]
9+
import boto3
10+
from botocore.exceptions import ClientError
11+
12+
13+
def hello_firehose(firehose_client):
14+
"""
15+
Use the AWS SDK for Python (Boto3) to create an Amazon Data Firehose client
16+
and list delivery streams in your account. This example uses the default
17+
settings specified in your shared credentials and config files.
18+
19+
:param firehose_client: A Boto3 Amazon Data Firehose client object.
20+
"""
21+
print("Hello, Amazon Data Firehose! Let's list your delivery streams:\n")
22+
try:
23+
response = firehose_client.list_delivery_streams(Limit=10)
24+
stream_names = response.get("DeliveryStreamNames", list())
25+
if stream_names:
26+
print(f" Found {len(stream_names)} delivery stream(s):")
27+
for name in stream_names:
28+
print(f" - {name}")
29+
if response.get("HasMoreDeliveryStreams", False):
30+
print(
31+
"\n Note: There are additional delivery streams not shown."
32+
)
33+
else:
34+
print(" No delivery streams found in the current region.")
35+
except ClientError as err:
36+
print(
37+
f" Couldn't list delivery streams. Error: "
38+
f"{err.response['Error']['Code']}: {err.response['Error']['Message']}"
39+
)
40+
raise
41+
42+
43+
if __name__ == "__main__":
44+
hello_firehose(boto3.client("firehose"))
45+
# snippet-end:[python.example_code.firehose.Hello]

0 commit comments

Comments
 (0)