Skip to content

Commit eac0be7

Browse files
authored
Tools: Writeme canonical titles (#6382)
* Fix some WRITEME issues and generate titles for Actions: * Open files with utf-8 encoding. * Case-insensitive README filename comparison. * Render titles for actions in READMEs. * Fixed WRITEME to check for combined language and version. * Remove case-insensitive README lookup, rename wrong case Readme.md to README.md.
1 parent a676b79 commit eac0be7

File tree

389 files changed

+2828
-2836
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

389 files changed

+2828
-2836
lines changed

Diff for: .doc_gen/metadata/application-auto-scaling_metadata.yaml

+3-3
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ application-autoscaling_RegisterScalableTarget:
1414
snippet_tags:
1515
- appautoscale.java2.enable.main
1616
services:
17-
application-autoscaling: {RegisterScalableTarget}
17+
application-auto-scaling: {RegisterScalableTarget}
1818
application-autoscaling_DeleteScalingPolicy:
1919
title: Disable a resource that is scaled using an &APP-ASlong; SDK
2020
title_abbrev: Disables a resource
@@ -30,7 +30,7 @@ application-autoscaling_DeleteScalingPolicy:
3030
snippet_tags:
3131
- appautoscale.java2.disable.main
3232
services:
33-
application-autoscaling: {DeleteScalingPolicy}
33+
application-auto-scaling: {DeleteScalingPolicy}
3434
application-autoscaling_DescribeScalingPolicies:
3535
title: Describe &APP-AS; scaling policies using an &AWS; SDK
3636
title_abbrev: Describes scaling policies
@@ -47,5 +47,5 @@ application-autoscaling_DescribeScalingPolicies:
4747
snippet_tags:
4848
- applicationautoscaling.rust.describe-scaling-policies
4949
services:
50-
application-autoscaling: {DescribeScalingPolicies}
50+
application-auto-scaling: {DescribeScalingPolicies}
5151

Diff for: .doc_gen/metadata/services.yaml

+4-35
Original file line numberDiff line numberDiff line change
@@ -103,21 +103,6 @@ apigatewayv2:
103103
tags:
104104
product_categories: {'Networking & Content Delivery'}
105105
version: '2018-11-29'
106-
application-autoscaling:
107-
long: '&APP-ASlong;'
108-
short: '&APP-AS;'
109-
sort: Application Auto Scaling
110-
expanded:
111-
long: AWS Application Auto Scaling
112-
short: Application Auto Scaling
113-
blurb: configures auto scaling for resources beyond just EC2, either with scaling policies or with scheduled scaling.
114-
guide:
115-
subtitle: User Guide
116-
url: autoscaling/application/userguide/what-is-application-auto-scaling.html
117-
api_ref: autoscaling/application/APIReference/Welcome.html
118-
tags:
119-
product_categories: {'Management & Governance'}
120-
version: application-autoscaling-2016-02-06
121106
app-mesh:
122107
api_ref: app-mesh/latest/APIReference/Welcome.html
123108
blurb: ''
@@ -150,7 +135,7 @@ appconfig:
150135
version: '2019-10-09'
151136
application-auto-scaling:
152137
api_ref: autoscaling/application/APIReference/Welcome.html
153-
blurb: ''
138+
blurb: configures auto scaling for resources beyond just EC2, either with scaling policies or with scheduled scaling.
154139
expanded:
155140
long: Application Auto Scaling
156141
short: Application Auto Scaling
@@ -161,8 +146,8 @@ application-auto-scaling:
161146
short: '&APP-AS;'
162147
sort: Application Auto Scaling
163148
tags:
164-
product_categories: {}
165-
version: '2016-02-06'
149+
product_categories: {'Management & Governance'}
150+
version: application-autoscaling-2016-02-06
166151
application-discovery-service:
167152
api_ref: application-discovery/latest/APIReference/Welcome.html
168153
blurb: ''
@@ -486,7 +471,7 @@ cloudsearch-domain:
486471
version: '2013-01-01'
487472
cloudtrail:
488473
api_ref: awscloudtrail/latest/APIReference/Welcome.html
489-
blurb: ''
474+
blurb: helps you monitor your AWS deployments in the cloud by getting a history of AWS API calls for your account.
490475
expanded:
491476
long: AWS CloudTrail
492477
short: CloudTrail
@@ -3055,22 +3040,6 @@ transcribe:
30553040
tags:
30563041
product_categories: {'Machine Learning & AI'}
30573042
version: transcribe-2017-10-26
3058-
transcribe-medical:
3059-
long: '&TSCMlong;'
3060-
short: '&TSCM;'
3061-
sort: Transcribe Medical
3062-
expanded:
3063-
long: Amazon Transcribe Medical
3064-
short: Amazon Transcribe Medical
3065-
blurb: is an automatic speech recognition (ASR) service designed for medical professionals who want to transcribe
3066-
medical-related speech, such as physician-dictated notes, drug safety monitoring, telemedicine appointments, or physician-patient conversations.
3067-
guide:
3068-
subtitle: Developer Guide
3069-
url: transcribe/latest/dg/transcribe-medical.html
3070-
api_ref: transcribe/latest/APIReference/Welcome.html
3071-
tags:
3072-
product_categories: {'Machine Learning & AI'}
3073-
version: transcribe-2017-10-26
30743043
translate:
30753044
long: '&TSLlong;'
30763045
short: '&TSL;'

Diff for: .doc_gen/metadata/transcribe-medical_metadata.yaml

-88
This file was deleted.

Diff for: .doc_gen/metadata/transcribe_metadata.yaml

+87
Original file line numberDiff line numberDiff line change
@@ -374,3 +374,90 @@ transcribe_Scenario_CustomVocabulary:
374374
services:
375375
transcribe: {StartTranscriptionJob, GetTranscriptionJob, DeleteTranscriptionJob, CreateVocabulary,
376376
GetVocabulary, UpdateVocabulary, ListVocabularies, DeleteVocabulary}
377+
transcribe_StartMedicalTranscriptionJob:
378+
title: Start an &TSCM; transcription job using an &AWS; SDK
379+
title_abbrev: Start a medical transcription job
380+
synopsis: start an &TSCM; transcription job.
381+
category:
382+
languages:
383+
.NET:
384+
versions:
385+
- sdk_version: 3
386+
github: dotnetv3/Transcribe
387+
sdkguide:
388+
excerpts:
389+
- description:
390+
snippet_tags:
391+
- Transcribe.dotnetv3.StartMedicalTranscriptionJob
392+
JavaScript:
393+
versions:
394+
- sdk_version: 3
395+
github: javascriptv3/example_code/transcribe
396+
sdkguide: sdk-for-javascript/v3/developer-guide/transcribe-medical-examples-section.html#transcribe-start-medical-transcription
397+
excerpts:
398+
- description: Create the client.
399+
snippet_tags:
400+
- transcribe.JavaScript.createclientv3
401+
- description: Start a medical transcription job.
402+
snippet_tags:
403+
- transcribe.JavaScript.jobs.createMedicalJobV3
404+
services:
405+
transcribe: {StartMedicalTranscriptionJob}
406+
transcribe_DeleteMedicalTranscriptionJob:
407+
title: Delete a &TSCM; transcription job using an &AWS; SDK
408+
title_abbrev: Delete a medical transcription job
409+
synopsis: delete an &TSCM; transcription job.
410+
category:
411+
languages:
412+
.NET:
413+
versions:
414+
- sdk_version: 3
415+
github: dotnetv3/Transcribe
416+
sdkguide:
417+
excerpts:
418+
- description:
419+
snippet_tags:
420+
- Transcribe.dotnetv3.DeleteMedicalTranscriptionJob
421+
JavaScript:
422+
versions:
423+
- sdk_version: 3
424+
github: javascriptv3/example_code/transcribe
425+
sdkguide: sdk-for-javascript/v3/developer-guide/transcribe-medical-examples-section.html#transcribe-delete-medical-job
426+
excerpts:
427+
- description: Create the client.
428+
snippet_tags:
429+
- transcribe.JavaScript.createclientv3
430+
- description: Delete a medical transcription job.
431+
snippet_tags:
432+
- transcribe.JavaScript.jobs.deleteMedicalJobV3
433+
services:
434+
transcribe: {DeleteMedicalTranscriptionJob}
435+
transcribe_ListMedicalTranscriptionJobs:
436+
title: List &TSCM; transcription jobs using an &AWS; SDK
437+
title_abbrev: List medical transcription jobs
438+
synopsis: list &TSCM; transcription jobs.
439+
category:
440+
languages:
441+
.NET:
442+
versions:
443+
- sdk_version: 3
444+
github: dotnetv3/Transcribe
445+
sdkguide:
446+
excerpts:
447+
- description:
448+
snippet_tags:
449+
- Transcribe.dotnetv3.ListMedicalTranscriptionJobs
450+
JavaScript:
451+
versions:
452+
- sdk_version: 3
453+
github: javascriptv3/example_code/transcribe
454+
sdkguide: sdk-for-javascript/v3/developer-guide/transcribe-medical-examples-section.html#transcribe-list-medical-jobs
455+
excerpts:
456+
- description: Create the client.
457+
snippet_tags:
458+
- transcribe.JavaScript.createclientv3
459+
- description: List medical transcription jobs.
460+
snippet_tags:
461+
- transcribe.JavaScript.jobs.createMedicalJobV3
462+
services:
463+
transcribe: {ListMedicalTranscriptionJobs}

Diff for: .tools/readmes/config.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
"&IAM-users;": "IAM users",
2222
"&kms-key;": "KMS key",
2323
"&kms-keys;": "KMS keys",
24+
"&S3long;": "Amazon Simple Storage Service",
2425
"&SLN;": "Amazon States Language",
2526
}
2627
language = {
@@ -44,7 +45,6 @@
4445
"service_folder": 'javav2/example_code/{{service["name"]}}',
4546
"sdk_api_ref": 'https://sdk.amazonaws.com/java/api/latest/software/amazon/awssdk/services/{{service["name"]}}/package-summary.html',
4647
"service_folder_overrides": {
47-
"sesv2": "javav2/example_code/ses",
4848
"medical-imaging": "javav2/example_code/medicalimaging",
4949
},
5050
},

Diff for: .tools/readmes/multi.py

+5-2
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
import os
99
import sys
1010
from pathlib import Path
11-
from render import Renderer
11+
from render import Renderer, MissingMetadataError
1212
from scanner import Scanner
1313

1414

@@ -82,7 +82,7 @@ def main():
8282
for service in args.services:
8383
id = f"{language}:{version}:{service}"
8484
try:
85-
scanner.set_example(language, service)
85+
scanner.set_example(language, int(version), service)
8686
logging.debug("Rendering %s", id)
8787
renderer = Renderer(scanner, int(version), args.safe)
8888

@@ -99,6 +99,9 @@ def main():
9999
written.append(id)
100100
except FileNotFoundError:
101101
skipped.append(id)
102+
except MissingMetadataError as mme:
103+
logging.error(mme)
104+
failed.append(id)
102105
except Exception:
103106
logging.exception("Exception rendering %s", id)
104107
failed.append(id)

Diff for: .tools/readmes/render.py

+22-4
Original file line numberDiff line numberDiff line change
@@ -111,9 +111,9 @@ def _transform_service(self):
111111
post_svc["guide"]["url"] = self._doc_link(post_svc["guide"]["url"])
112112
return post_svc
113113

114-
def _transform_actions(self, pre_actions):
115-
post_actions = []
116-
for _, pre in pre_actions.items():
114+
def _transform_hello(self, pre_hello):
115+
post_hello = []
116+
for _, pre in pre_hello.items():
117117
try:
118118
api = next(iter(pre["services"][self.scanner.svc_name]))
119119
except:
@@ -126,6 +126,23 @@ def _transform_actions(self, pre_actions):
126126
),
127127
"api": api,
128128
}
129+
post_hello.append(action)
130+
return sorted(post_hello, key=itemgetter("title_abbrev"))
131+
132+
133+
def _transform_actions(self, pre_actions):
134+
post_actions = []
135+
for pre_id, pre in pre_actions.items():
136+
try:
137+
api = next(iter(pre["services"][self.scanner.svc_name]))
138+
except:
139+
raise MissingMetadataError(f"Action not found for example {pre_id} and service {self.scanner.svc_name}.")
140+
action = {
141+
"title_abbrev": api,
142+
"file": self.scanner.snippet(
143+
pre, self.sdk_ver, self.lang_config["service_folder"], api
144+
),
145+
}
129146
post_actions.append(action)
130147
return sorted(post_actions, key=itemgetter("title_abbrev"))
131148

@@ -273,7 +290,7 @@ def render(self):
273290
return None
274291
sdk = self._transform_sdk()
275292
svc = self._transform_service()
276-
hello = self._transform_actions(self.scanner.hello())
293+
hello = self._transform_hello(self.scanner.hello())
277294
actions = self._transform_actions(self.scanner.actions())
278295
scenarios = self._transform_scenarios()
279296
custom_cats = self._transform_custom_categories()
@@ -314,6 +331,7 @@ def write(self):
314331
self.readme_filename,
315332
f'{self.lang_config["service_folder"]}/{config.saved_readme}',
316333
)
334+
os.remove(self.readme_filename) # Do this so that new files are always updated to the correct case (README.md).
317335
with open(self.readme_filename, "w", encoding="utf-8") as f:
318336
f.write(self.readme_text)
319337
print(f"Updated {self.readme_filename}.")

0 commit comments

Comments
 (0)