Skip to content
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

adding schemas-cli-examples #8985

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from

Conversation

onkabes
Copy link

@onkabes onkabes commented Oct 17, 2024

Issue #, if available:

Description of changes:

Adding example CLI commands for Amazon EventBridge Schemas: https://docs.aws.amazon.com/cli/latest/reference/schemas/

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@elysahall elysahall self-requested a review October 21, 2024 16:23
@elysahall elysahall self-assigned this Oct 21, 2024
@elysahall elysahall added documentation This is a problem with documentation. pr:work-in-progress This PR is a draft and needs further work. labels Oct 21, 2024
Copy link
Collaborator

@elysahall elysahall left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@onkabes
Thank you for your submission! There were a few issues that affected all of your examples, such as fixing your indententation. Please fix these formatting issues and push your updates.

@elysahall elysahall removed their assignment Nov 13, 2024
@onkabes onkabes force-pushed the schemas-cli-docs-v1 branch 2 times, most recently from a867cff to 574facb Compare December 5, 2024 15:16
@codecov-commenter
Copy link

codecov-commenter commented Dec 10, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 0.08%. Comparing base (52985a2) to head (574facb).
Report is 203 commits behind head on develop.

Additional details and impacted files
@@            Coverage Diff             @@
##           develop   #8985      +/-   ##
==========================================
- Coverage     0.08%   0.08%   -0.01%     
==========================================
  Files          210     210              
  Lines        16952   16978      +26     
==========================================
  Hits            14      14              
- Misses       16938   16964      +26     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Collaborator

@elysahall elysahall left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM sending for maintainer review.

@elysahall elysahall added pr:needs-review This PR needs a review from a Member. and removed pr:work-in-progress This PR is a draft and needs further work. labels Jan 8, 2025
@ashovlin ashovlin self-assigned this Jan 13, 2025
Output::

{
"Content": "{\n \"openapi\": \"3.0.0\",\n \"info\": {\n \"version\": \"1.0.0\",\n \"title\": \"Event\"\n },\n \"paths\": {},\n \"components\": {\n \"schemas\": {\n \"Event\": {\n \"type\": \"object\",\n \"properties\": {\n \"ordinal\": {\n \"type\": \"number\",\n \"format\": \"int64\"\n },\n \"name\": {\n \"type\": \"string\"\n },\n \"description\": {\n \"type\": \"string\"\n },\n \"price\": {\n \"type\": \"number\",\n \"format\": \"double\"\n },\n \"address\": {\n \"type\": \"string\"\n },\n \"comments\": {\n \"type\": \"array\",\n \"items\": {\n \"type\": \"string\"\n }\n },\n \"created_at\": {\n \"type\": \"string\",\n \"format\": \"date-time\"\n }\n }\n }\n }\n }\n}",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are the \n expected to be part of the output? Just checking that they weren't the result of copy+paste or something similar.

Running it for an AWS schema, I see the JSON on one line without the newlines.

aws schemas describe-schema --registry-name aws.events --schema-name aws.a4b@RoomStateChange
{
    "Content": "{ \"openapi\": \"3.0.0\", \"info\": { \"version\": \"1.0.0\", \"title\": \"RoomStateChange\" }, \"paths\": {}, \"components\": { \"schemas\": { \"AWSEvent\": { \"type\": \"object\", \"required\": [ \"detail-type\", \"resources\", \"detail\", \"id\", \"source\", \"time\", \"region\", \"account\" ], \"x-amazon-events-detail-type\": \"Room State Change\", \"x-amazon-events-source\": \"aws.a4b\", \"properties\": { \"detail\": { \"$ref\": \"#/components/schemas/RoomStateChange\" }, \"account\": { \"type\": \"string\" }, \"detail-type\": { \"type\": \"string\" }, \"id\": { \"type\": \"string\" }, \"region\": { \"type\": \"string\" }, \"resources\": { \"type\": \"array\", \"items\": { \"type\": \"string\" } }, \"source\": { \"type\": \"string\" }, \"time\": { \"type\": \"string\", \"format\": \"date-time\" } } }, \"RoomStateChange\": { \"type\": \"object\", \"required\": [ \"mode\", \"calendar-event\", \"event-type\", \"version\" ], \"properties\": { \"calendar-event\": { \"$ref\": \"#/components/schemas/Calendar-event\" }, \"event-type\": { \"type\": \"string\" }, \"mode\": { \"type\": \"string\" }, \"version\": { \"type\": \"string\" } } }, \"Calendar-event\": { \"type\": \"object\", \"required\": [ \"profileArn\", \"calendarId\", \"provider\", \"startTime\", \"endTime\", \"id\", \"roomArn\" ], \"properties\": { \"calendarId\": { \"type\": \"string\" }, \"checkInTime\": { \"type\": \"string\", \"format\": \"date-time\" }, \"endTime\": { \"type\": \"string\", \"format\": \"date-time\" }, \"id\": { \"type\": \"string\" }, \"profileArn\": { \"type\": \"string\" }, \"provider\": { \"type\": \"string\" }, \"releaseTime\": { \"type\": \"string\", \"format\": \"date-time\" }, \"roomArn\": { \"type\": \"string\" }, \"startTime\": { \"type\": \"string\", \"format\": \"date-time\" } } } } } }",
    "Description": "Schema for event type RoomStateChange, published by AWS service aws.a4b",
    "LastModified": "2020-10-22T16:03:09+00:00",
    "SchemaArn": "",
    "SchemaName": "aws.a4b@RoomStateChange",
    "SchemaVersion": "1",
    "Tags": {},
    "Type": "OpenApi3",
    "VersionCreatedDate": "2020-10-22T16:03:09+00:00"
}

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it's important to still have the \" escaping in the Content value, if that's what the service is returning.

Output::

{
"Policy": "{\n \"Version\": \"2012-10-17\",\n \"Statement\": [{\n \"Sid\": \"AllowReadWrite\",\n \"Effect\": \"Allow\",\n \"Principal\": {\n \"AWS\": \"*\"\n },\n \"Action\": \"schemas:*\",\n \"Resource\": [\"arn:aws:schemas:us-east-1:012345678912:registry/example-registry\", \"arn:aws:schemas:us-east-1:012345678912:schema/example-registry*\"]\n }]\n}\n",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as #8985 (comment)

Comment on lines 3 to 15
The following ``update-discoverer`` example updates an existing discoverer on the Event Bus. You can change the description, or you can enable or disable discovering schemas on cross-012345678912 Events. ::

aws schemas update-discoverer \
--discoverer-id example-discoverer-id \
--no-cross-012345678912

Output::

{
"DiscovererArn": "arn:aws:schemas:us-east-1:012345678912:discoverer/example-discoverer-id",
"DiscovererId": "example-discoverer-id",
"SourceArn": "arn:aws:events:us-east-1:012345678912:event-bus/example-event-bus",
"State": "STOPPED",
"Cross012345678912": false,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like "account" may have been replaced with 012345678912 in three places.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm still seeing cross-012345678912 and Cross012345678912 instead of cross-account and CrossAccount.

Comment on lines 3 to 9
The following ``update-registry`` example waits for a new code binding to be created from the put-code-binding API. ::

aws schemas wait code-binding-exists \
--registry-name example-registry \
--schema-name example-schema \
--schema-version 6 \
--language Python36
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's a mismatch between the command in the code block and that in the description.

Copy link
Member

@ashovlin ashovlin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks pretty good, left a few comments.

@onkabes onkabes force-pushed the schemas-cli-docs-v1 branch from 6d0fedc to 15d278f Compare February 2, 2025 06:32
@onkabes
Copy link
Author

onkabes commented Feb 2, 2025

requested changes have been made

Copy link
Member

@ashovlin ashovlin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Replied to a few comments that don't appear resolved yet. It looks like some changes may not have been pushed up? Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation This is a problem with documentation. pr:needs-review This PR needs a review from a Member.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants