Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
236 changes: 236 additions & 0 deletions aws_doc_sdk_examples_tools/config/services.yaml

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions aws_doc_sdk_examples_tools/config/services_schema.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ service:
long: str()
short: str()
sort: regex('^[^&]\\w', name='non-entity')
sdk_id: str()
chapter_override: include('chapter_override', required=False)
expanded:
long: str(upper_start=True, end_punc=False, check_aws=False)
Expand Down
1 change: 1 addition & 0 deletions aws_doc_sdk_examples_tools/doc_gen.py
Original file line number Diff line number Diff line change
Expand Up @@ -281,6 +281,7 @@ def fill_missing_fields(self):
action = id_action
if service_id in self.services:
service_name = self.services[service_id].short
example.service_sdk_id = self.services[service_id].sdk_id
else:
service_name = service_id
example.fill_display_fields(self.categories, service_name, action)
Expand Down
1 change: 1 addition & 0 deletions aws_doc_sdk_examples_tools/doc_gen_cli_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ def mock_doc_gen(mock_example):
short="&AHI;",
sort="HealthImaging",
version="medical-imaging-2023-07-19",
sdk_id="Medical Imaging",
)
}
doc_gen.sdks = {
Expand Down
19 changes: 15 additions & 4 deletions aws_doc_sdk_examples_tools/doc_gen_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,9 @@
),
},
services={
"x": Service(long="AWS X", short="X", sort="aws x", version=1)
"x": Service(
long="AWS X", short="X", sort="aws x", version=1, sdk_id="AWSx"
)
},
),
DocGen(
Expand All @@ -53,7 +55,9 @@
),
},
services={
"y": Service(long="AWS Y", short="Y", sort="aws y", version=1)
"y": Service(
long="AWS Y", short="Y", sort="aws y", version=1, sdk_id="AWSy"
)
},
),
DocGen(
Expand All @@ -78,8 +82,12 @@
),
},
services={
"x": Service(long="AWS X", short="X", sort="aws x", version=1),
"y": Service(long="AWS Y", short="Y", sort="aws y", version=1),
"x": Service(
long="AWS X", short="X", sort="aws x", version=1, sdk_id="AWSx"
),
"y": Service(
long="AWS Y", short="Y", sort="aws y", version=1, sdk_id="AWSy"
),
},
),
)
Expand Down Expand Up @@ -135,6 +143,7 @@ def sample_doc_gen() -> DocGen:
),
sort="Amazon S3",
version="2006-03-01",
sdk_id="S3",
)
},
snippets={
Expand All @@ -152,6 +161,7 @@ def sample_doc_gen() -> DocGen:
"s3_PutObject",
file=Path("filea.txt"),
languages={},
service_sdk_id="S3",
services={"s3": set(["PutObject"])},
)
},
Expand Down Expand Up @@ -244,6 +254,7 @@ def test_doc_gen_encoder(sample_doc_gen: DocGen):
"id": "s3_PutObject",
"languages": {},
"service_main": None,
"service_sdk_id": "S3",
"services": {
"s3": {
"__set__": [
Expand Down
2 changes: 2 additions & 0 deletions aws_doc_sdk_examples_tools/metadata.py
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,8 @@ class Example:
# TODO document service_main and services. Not to be used by tributaries. Part of Cross Service.
# List of services used by the examples. Lines up with those in services.yaml.
service_main: Optional[str] = field(default=None)
# Main service sdk_id. Matches Smithy model svc_id in services.yaml.
service_sdk_id: Optional[str] = field(default="")
services: Dict[str, Set[str]] = field(default_factory=dict)
# HTML file names corresponding to the documentation pages in the Code Library
doc_filenames: Optional[DocFilenames] = field(default=None)
Expand Down
13 changes: 11 additions & 2 deletions aws_doc_sdk_examples_tools/metadata_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ def load(
),
sort="api-gateway",
version=1,
sdk_id="apigateway",
),
"medical-imaging": Service(
long="&AHIlong;",
Expand All @@ -61,6 +62,7 @@ def load(
),
sort="HealthImaging",
version=1,
sdk_id="Medical Imaging",
),
"sqs": Service(
long="&SQSlong;",
Expand All @@ -70,6 +72,7 @@ def load(
),
sort="sqs",
version=1,
sdk_id="SQS",
),
"s3": Service(
long="&S3long;",
Expand All @@ -79,13 +82,15 @@ def load(
),
sort="s3",
version=1,
sdk_id="S3",
),
"autogluon": Service(
long="AutoGluon Test",
short="AG Test",
expanded=ServiceExpanded(long="AutoGluon Test", short="AutoGluon Test"),
sort="autogluon",
version=1,
sdk_id="",
),
}
SDKS = {
Expand Down Expand Up @@ -1025,8 +1030,12 @@ def test_no_duplicate_title_abbrev():
),
},
services={
"svc": Service(long="Service", short="svc", version="1", sort="svc"),
"cvs": Service(long="CVS", short="cvs", version="2", sort="cvs"),
"svc": Service(
long="Service", short="svc", version="1", sort="svc", sdk_id="SVC"
),
"cvs": Service(
long="CVS", short="cvs", version="2", sort="cvs", sdk_id="CVS"
),
},
)
doc_gen.validate()
Expand Down
6 changes: 6 additions & 0 deletions aws_doc_sdk_examples_tools/services.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ class Service:
long: str
short: str
sort: str
sdk_id: str
version: Union[int, str]
expanded: Optional[ServiceExpanded] = field(default=None)
api_ref: Optional[str] = field(default=None)
Expand All @@ -50,6 +51,7 @@ def from_yaml(
sort = yaml.get("sort")
version = yaml.get("version")
api_ref = yaml.get("api_ref")
sdk_id = yaml.get("sdk_id")

if isinstance(long, metadata_errors.MetadataParseError):
errors.append(long)
Expand All @@ -75,6 +77,9 @@ def from_yaml(
version = "0"
if api_ref is None:
errors.append(metadata_errors.MissingField(field="api_ref"))
if sdk_id is None:
errors.append(metadata_errors.MissingField(field="sdk_id"))
sdk_id = ""

blurb = yaml.get("blurb")
caveat = yaml.get("caveat")
Expand All @@ -101,6 +106,7 @@ def from_yaml(
cls(
long=long,
short=short,
sdk_id=sdk_id,
expanded=expanded,
sort=sort,
api_ref=api_ref,
Expand Down
4 changes: 4 additions & 0 deletions aws_doc_sdk_examples_tools/services_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ def test_services():
assert examples == {
"s3": Service(
short="&S3;",
sdk_id="S3",
expanded=ServiceExpanded(
long="Amazon Simple Storage Service (Amazon S3)", short="Amazon S3"
),
Expand All @@ -83,6 +84,7 @@ def test_services():
"medical-imaging": Service(
short="&AHI;",
long="&AHIlong;",
sdk_id="Medical Imaging",
expanded=ServiceExpanded(
long="AWS HealthImaging",
short="HealthImaging",
Expand All @@ -93,6 +95,7 @@ def test_services():
"sqs": Service(
short="&SQS;",
long="&SQSlong;",
sdk_id="SQS",
expanded=ServiceExpanded(
long="Amazon Simple Queue Service (Amazon SQS)", short="Amazon SQS"
),
Expand All @@ -106,6 +109,7 @@ def test_services():
"textract": Service(
short="&TEXTRACT;",
long="&TEXTRACTlong;",
sdk_id="Textract",
expanded=ServiceExpanded(long="Amazon Textract", short="Amazon Textract"),
sort="Textract",
tags={"product_categories": set(["Category 1"])},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,5 @@ medical-imaging:
expanded:
long: AWS HealthImaging
short: HealthImaging
sdk_id: Medical Imaging
sort: HealthImaging
4 changes: 4 additions & 0 deletions aws_doc_sdk_examples_tools/test_resources/services.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
s3:
short: "&S3;"
long: "&S3long;"
sdk_id: "S3"
expanded:
long: Amazon Simple Storage Service (Amazon S3)
short: Amazon S3
Expand All @@ -16,6 +17,7 @@ s3:
medical-imaging:
short: "&AHI;"
long: "&AHIlong;"
sdk_id: "Medical Imaging"
expanded:
long: AWS HealthImaging
short: HealthImaging
Expand All @@ -24,6 +26,7 @@ medical-imaging:
sqs:
short: "&SQS;"
long: "&SQSlong;"
sdk_id: "SQS"
expanded:
long: Amazon Simple Queue Service (Amazon SQS)
short: Amazon SQS
Expand All @@ -35,6 +38,7 @@ sqs:
textract:
short: "&TEXTRACT;"
long: "&TEXTRACTlong;"
sdk_id: "Textract"
expanded:
long: Amazon Textract
short: Amazon Textract
Expand Down
Loading