-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add a sample python component to the repo
- Loading branch information
Showing
2 changed files
with
49 additions
and
0 deletions.
There are no files selected for viewing
21 changes: 21 additions & 0 deletions
21
docs/examples/sample-ggLitePython/artifacts/sample-ggLitePython/1.0.0/ggLitePython.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import boto3 | ||
|
||
|
||
def fetch_s3_bucket_list(): | ||
# Create an S3 client | ||
s3 = boto3.client('s3') | ||
# List S3 buckets | ||
response = s3.list_buckets() | ||
# Print the names of all buckets | ||
print("S3 Bucket Names:") | ||
for bucket in response['Buckets']: | ||
print(bucket['Name']) | ||
|
||
|
||
def main(): | ||
print("HELLO WORLD") | ||
fetch_s3_bucket_list() | ||
|
||
|
||
if __name__ == "__main__": | ||
main() |
28 changes: 28 additions & 0 deletions
28
docs/examples/sample-ggLitePython/recipes/sample-ggLitePython-1.0.0.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
--- | ||
RecipeFormatVersion: "2020-01-25" | ||
ComponentName: sample-ggLitePython | ||
ComponentVersion: 1.0.0 | ||
ComponentType: "aws.greengrass.generic" | ||
ComponentDescription: | ||
This example Python component for GGLite that lists all your s3 bucket names | ||
ComponentPublisher: AWS | ||
ComponentDependencies: | ||
aws.greengrass.TokenExchangeService: | ||
VersionRequirement: ">=0.0.0" | ||
DependencyType: "HARD" | ||
Manifests: | ||
- Platform: | ||
os: linux | ||
runtime: "*" | ||
Lifecycle: | ||
install: | ||
RequiresPrivilege: false | ||
Script: "python3 -m venv ./venv && . ./venv/bin/activate && python3 -m | ||
pip install\ | ||
\ boto3" | ||
run: | ||
RequiresPrivilege: false | ||
Script: | ||
". ./venv/bin/activate && python3 {artifacts:path}/ggLitePython.py" | ||
# Artifacts: | ||
# - Uri: "---" |