Improve the sync models script and pull in new models (#631)

* Improve the sync models script

* Remove sdb model and add new route53 models
This commit is contained in:
John DiSanti 2021-08-03 15:03:54 -07:00 committed by GitHub
parent 1e92258691
commit f7d270244d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 6267 additions and 8 deletions

View File

@ -0,0 +1,511 @@
{
"smithy": "1.0",
"metadata": {
"suppressions": [
{
"id": "HttpMethodSemantics",
"namespace": "*"
},
{
"id": "HttpResponseCodeSemantics",
"namespace": "*"
},
{
"id": "PaginatedTrait",
"namespace": "*"
},
{
"id": "HttpHeaderTrait",
"namespace": "*"
},
{
"id": "HttpUriConflict",
"namespace": "*"
},
{
"id": "Service",
"namespace": "*"
}
]
},
"shapes": {
"com.amazonaws.route53recoverycluster#AccessDeniedException": {
"type": "structure",
"members": {
"message": {
"target": "com.amazonaws.route53recoverycluster#String",
"traits": {
"smithy.api#required": {}
}
}
},
"traits": {
"smithy.api#documentation": "<p>You don't have sufficient permissions to query the routing control state.</p>",
"smithy.api#error": "client",
"smithy.api#httpError": 403
}
},
"com.amazonaws.route53recoverycluster#Arn": {
"type": "string",
"traits": {
"smithy.api#length": {
"min": 1,
"max": 255
},
"smithy.api#pattern": "^[A-Za-z0-9:\\/_-]*$"
}
},
"com.amazonaws.route53recoverycluster#ConflictException": {
"type": "structure",
"members": {
"message": {
"target": "com.amazonaws.route53recoverycluster#String",
"traits": {
"smithy.api#documentation": "Description of the ConflictException error",
"smithy.api#required": {}
}
},
"resourceId": {
"target": "com.amazonaws.route53recoverycluster#String",
"traits": {
"smithy.api#documentation": "Identifier of the resource in use",
"smithy.api#required": {}
}
},
"resourceType": {
"target": "com.amazonaws.route53recoverycluster#String",
"traits": {
"smithy.api#documentation": "Type of the resource in use",
"smithy.api#required": {}
}
}
},
"traits": {
"smithy.api#documentation": "<p>There was a conflict with this request. Try again.</p>",
"smithy.api#error": "client",
"smithy.api#httpError": 409
}
},
"com.amazonaws.route53recoverycluster#EndpointTemporarilyUnavailableException": {
"type": "structure",
"members": {
"message": {
"target": "com.amazonaws.route53recoverycluster#String",
"traits": {
"smithy.api#required": {}
}
}
},
"traits": {
"smithy.api#documentation": "<p>The cluster endpoint isn't available. Try another cluster endpoint.</p>",
"smithy.api#error": "server",
"smithy.api#httpError": 503
}
},
"com.amazonaws.route53recoverycluster#GetRoutingControlState": {
"type": "operation",
"input": {
"target": "com.amazonaws.route53recoverycluster#GetRoutingControlStateRequest"
},
"output": {
"target": "com.amazonaws.route53recoverycluster#GetRoutingControlStateResponse"
},
"errors": [
{
"target": "com.amazonaws.route53recoverycluster#AccessDeniedException"
},
{
"target": "com.amazonaws.route53recoverycluster#EndpointTemporarilyUnavailableException"
},
{
"target": "com.amazonaws.route53recoverycluster#InternalServerException"
},
{
"target": "com.amazonaws.route53recoverycluster#ResourceNotFoundException"
},
{
"target": "com.amazonaws.route53recoverycluster#ThrottlingException"
},
{
"target": "com.amazonaws.route53recoverycluster#ValidationException"
}
],
"traits": {
"smithy.api#documentation": "<p>Get the state for a routing control. A routing control is a simple on/off switch\n\t\t\t\tthat you can use to route traffic to cells. When the state is On, traffic flows to a cell. When it's off, traffic does not flow. </p>\n\t\t\t <p>Before you can create a routing control, you first must create a cluster to host the control.\n\t\t\t\tFor more information, see \n\t\t\t\t<a href=\"https://docs.aws.amazon.com/recovery-cluster/latest/api/cluster.html\">CreateCluster</a>.\n\t\t\t\tAccess one of the endpoints for the cluster to get or update the routing control state to\n\t\t\t\tredirect traffic.</p>\n\t\t\t <p>For more information about working with routing controls, see \n\t\t\t\t<a href=\"https://docs.aws.amazon.com/r53recovery/latest/dg/routing-control.html\">Routing control</a>\n\t\t\t\tin the Route 53 Application Recovery Controller Developer Guide.</p>"
}
},
"com.amazonaws.route53recoverycluster#GetRoutingControlStateRequest": {
"type": "structure",
"members": {
"RoutingControlArn": {
"target": "com.amazonaws.route53recoverycluster#Arn",
"traits": {
"smithy.api#documentation": "<p>The Amazon Resource Number (ARN) for the routing control that you want to get the state for.</p>",
"smithy.api#required": {}
}
}
}
},
"com.amazonaws.route53recoverycluster#GetRoutingControlStateResponse": {
"type": "structure",
"members": {
"RoutingControlArn": {
"target": "com.amazonaws.route53recoverycluster#Arn",
"traits": {
"smithy.api#documentation": "<p>The Amazon Resource Number (ARN) of the response.</p>",
"smithy.api#required": {}
}
},
"RoutingControlState": {
"target": "com.amazonaws.route53recoverycluster#RoutingControlState",
"traits": {
"smithy.api#documentation": "<p>The state of the routing control.</p>",
"smithy.api#required": {}
}
}
}
},
"com.amazonaws.route53recoverycluster#InternalServerException": {
"type": "structure",
"members": {
"message": {
"target": "com.amazonaws.route53recoverycluster#String",
"traits": {
"smithy.api#required": {}
}
},
"retryAfterSeconds": {
"target": "com.amazonaws.route53recoverycluster#RetryAfterSeconds",
"traits": {
"smithy.api#httpHeader": "Retry-After"
}
}
},
"traits": {
"smithy.api#documentation": "<p>There was an unexpected error during processing of the request.</p>",
"smithy.api#error": "server",
"smithy.api#httpError": 500
}
},
"com.amazonaws.route53recoverycluster#ResourceNotFoundException": {
"type": "structure",
"members": {
"message": {
"target": "com.amazonaws.route53recoverycluster#String",
"traits": {
"smithy.api#required": {}
}
},
"resourceId": {
"target": "com.amazonaws.route53recoverycluster#String",
"traits": {
"smithy.api#documentation": "Hypothetical resource identifier that was not found",
"smithy.api#required": {}
}
},
"resourceType": {
"target": "com.amazonaws.route53recoverycluster#String",
"traits": {
"smithy.api#documentation": "Hypothetical resource type that was not found",
"smithy.api#required": {}
}
}
},
"traits": {
"smithy.api#documentation": "<p>The request references a routing control that was not found.</p>",
"smithy.api#error": "client",
"smithy.api#httpError": 404
}
},
"com.amazonaws.route53recoverycluster#RetryAfterSeconds": {
"type": "integer",
"traits": {
"smithy.api#documentation": "Advice to clients on when the call can be safely retried"
}
},
"com.amazonaws.route53recoverycluster#RoutingControlState": {
"type": "string",
"traits": {
"smithy.api#enum": [
{
"value": "On",
"name": "On"
},
{
"value": "Off",
"name": "Off"
}
]
}
},
"com.amazonaws.route53recoverycluster#String": {
"type": "string"
},
"com.amazonaws.route53recoverycluster#ThrottlingException": {
"type": "structure",
"members": {
"message": {
"target": "com.amazonaws.route53recoverycluster#String",
"traits": {
"smithy.api#required": {}
}
},
"retryAfterSeconds": {
"target": "com.amazonaws.route53recoverycluster#RetryAfterSeconds",
"traits": {
"smithy.api#httpHeader": "Retry-After"
}
}
},
"traits": {
"smithy.api#documentation": "<p>The request was denied because of request throttling.</p>",
"smithy.api#error": "client",
"smithy.api#httpError": 429
}
},
"com.amazonaws.route53recoverycluster#ToggleCustomerAPI": {
"type": "service",
"version": "2019-12-02",
"operations": [
{
"target": "com.amazonaws.route53recoverycluster#GetRoutingControlState"
},
{
"target": "com.amazonaws.route53recoverycluster#UpdateRoutingControlState"
},
{
"target": "com.amazonaws.route53recoverycluster#UpdateRoutingControlStates"
}
],
"traits": {
"aws.api#service": {
"sdkId": "Route53 Recovery Cluster",
"arnNamespace": "route53-recovery-cluster",
"cloudFormationName": "Route53RecoveryCluster",
"cloudTrailEventSource": "route53recoverycluster.amazonaws.com",
"endpointPrefix": "route53-recovery-cluster"
},
"aws.auth#sigv4": {
"name": "route53-recovery-cluster"
},
"aws.protocols#awsJson1_0": {},
"smithy.api#documentation": "<p>Welcome to the Amazon Route 53 Application Recovery Controller API Reference Guide for Recovery Control Data Plane .</p>\n\t\t\t <p>Recovery control in Route 53 Application Recovery Controller includes extremely reliable routing controls that enable you to recover applications \n\t\t\t\tby rerouting traffic, for example, across Availability Zones or AWS Regions. Routing controls are simple on/off switches \n\t\t\t\thosted on a cluster. A cluster is a set of five redundant regional endpoints against which you can execute API calls to update or \n\t\t\t\tget the state of routing controls. You use routing controls to failover traffic to recover your application \n\t\t\t\tacross Availability Zones or Regions.</p>\n\t\t\t <p>This API guide includes information about how to get and update routing control states in Route 53 Application Recovery Controller.</p>\n\t\t\t <p>For more information about Route 53 Application Recovery Controller, see the following:</p>\n\t\t\t <ul>\n <li>\n <p>You can create clusters, routing controls, and control panels by using the control plane API for Recovery\n\t\t\t\t\tControl. For more information, see <a href=\"https://docs.aws.amazon.com/recovery-cluster/latest/api/\">Amazon Route 53 Application Recovery Controller Recovery Control API Reference</a>.</p>\n </li>\n <li>\n <p>Route 53 Application Recovery Controller also provides continuous readiness checks to ensure that your applications are scaled to handle failover traffic. \n\t\t\t\t\tFor more information about the related API actions, see <a href=\"https://docs.aws.amazon.com/recovery-readiness/latest/api/\">Amazon Route 53 Application Recovery Controller Recovery Readiness API Reference</a>.</p>\n </li>\n <li>\n <p>For more information about creating resilient applications and preparing for recovery readiness with Route 53 Application Recovery Controller, \n\t\t\t\t\tsee the <a href=\"r53recovery/latest/dg/\">Amazon Route 53 Application Recovery Controller Developer Guide</a>.</p>\n </li>\n </ul>",
"smithy.api#title": "Route53 Recovery Cluster"
}
},
"com.amazonaws.route53recoverycluster#UpdateRoutingControlState": {
"type": "operation",
"input": {
"target": "com.amazonaws.route53recoverycluster#UpdateRoutingControlStateRequest"
},
"output": {
"target": "com.amazonaws.route53recoverycluster#UpdateRoutingControlStateResponse"
},
"errors": [
{
"target": "com.amazonaws.route53recoverycluster#AccessDeniedException"
},
{
"target": "com.amazonaws.route53recoverycluster#ConflictException"
},
{
"target": "com.amazonaws.route53recoverycluster#EndpointTemporarilyUnavailableException"
},
{
"target": "com.amazonaws.route53recoverycluster#InternalServerException"
},
{
"target": "com.amazonaws.route53recoverycluster#ResourceNotFoundException"
},
{
"target": "com.amazonaws.route53recoverycluster#ThrottlingException"
},
{
"target": "com.amazonaws.route53recoverycluster#ValidationException"
}
],
"traits": {
"smithy.api#documentation": "<p>Set the state of the routing control to reroute traffic. You can set the value to be On or Off.\n\t\t\t\tWhen the state is On, traffic flows to a cell. When it's off, traffic does not flow.</p>\n\t\t\t <p>For more information about working with routing controls, see \n\t\t\t\t<a href=\"https://docs.aws.amazon.com/r53recovery/latest/dg/routing-control.html\">Routing control</a>\n\t\t\t\tin the Route 53 Application Recovery Controller Developer Guide.</p>"
}
},
"com.amazonaws.route53recoverycluster#UpdateRoutingControlStateEntries": {
"type": "list",
"member": {
"target": "com.amazonaws.route53recoverycluster#UpdateRoutingControlStateEntry"
}
},
"com.amazonaws.route53recoverycluster#UpdateRoutingControlStateEntry": {
"type": "structure",
"members": {
"RoutingControlArn": {
"target": "com.amazonaws.route53recoverycluster#Arn",
"traits": {
"smithy.api#documentation": "<p>The Amazon Resource Number (ARN) for the routing control state entry.</p>",
"smithy.api#required": {}
}
},
"RoutingControlState": {
"target": "com.amazonaws.route53recoverycluster#RoutingControlState",
"traits": {
"smithy.api#documentation": "<p>The routing control state in a set of routing control state entries.</p>",
"smithy.api#required": {}
}
}
},
"traits": {
"smithy.api#documentation": "<p>A routing control state.</p>"
}
},
"com.amazonaws.route53recoverycluster#UpdateRoutingControlStateRequest": {
"type": "structure",
"members": {
"RoutingControlArn": {
"target": "com.amazonaws.route53recoverycluster#Arn",
"traits": {
"smithy.api#documentation": "<p>The Amazon Resource Number (ARN) for the routing control that you want to update the state for.</p>",
"smithy.api#required": {}
}
},
"RoutingControlState": {
"target": "com.amazonaws.route53recoverycluster#RoutingControlState",
"traits": {
"smithy.api#documentation": "<p>The state of the routing control. You can set the value to be On or Off.</p>",
"smithy.api#required": {}
}
}
}
},
"com.amazonaws.route53recoverycluster#UpdateRoutingControlStateResponse": {
"type": "structure",
"members": {}
},
"com.amazonaws.route53recoverycluster#UpdateRoutingControlStates": {
"type": "operation",
"input": {
"target": "com.amazonaws.route53recoverycluster#UpdateRoutingControlStatesRequest"
},
"output": {
"target": "com.amazonaws.route53recoverycluster#UpdateRoutingControlStatesResponse"
},
"errors": [
{
"target": "com.amazonaws.route53recoverycluster#AccessDeniedException"
},
{
"target": "com.amazonaws.route53recoverycluster#ConflictException"
},
{
"target": "com.amazonaws.route53recoverycluster#EndpointTemporarilyUnavailableException"
},
{
"target": "com.amazonaws.route53recoverycluster#InternalServerException"
},
{
"target": "com.amazonaws.route53recoverycluster#ResourceNotFoundException"
},
{
"target": "com.amazonaws.route53recoverycluster#ThrottlingException"
},
{
"target": "com.amazonaws.route53recoverycluster#ValidationException"
}
],
"traits": {
"smithy.api#documentation": "<p>Set multiple routing control states. You can set the value for each state to be On or Off.\n\t\t\tWhen the state is On, traffic flows to a cell. When it's off, traffic does not flow.</p>\n\t\t\t <p>For more information about working with routing controls, see \n\t\t\t\t<a href=\"https://docs.aws.amazon.com/r53recovery/latest/dg/routing-control.html\">Routing control</a>\n\t\t\t\tin the Route 53 Application Recovery Controller Developer Guide.</p>"
}
},
"com.amazonaws.route53recoverycluster#UpdateRoutingControlStatesRequest": {
"type": "structure",
"members": {
"UpdateRoutingControlStateEntries": {
"target": "com.amazonaws.route53recoverycluster#UpdateRoutingControlStateEntries",
"traits": {
"smithy.api#documentation": "<p>A set of routing control entries that you want to update.</p>",
"smithy.api#required": {}
}
}
}
},
"com.amazonaws.route53recoverycluster#UpdateRoutingControlStatesResponse": {
"type": "structure",
"members": {}
},
"com.amazonaws.route53recoverycluster#ValidationException": {
"type": "structure",
"members": {
"message": {
"target": "com.amazonaws.route53recoverycluster#String",
"traits": {
"smithy.api#required": {}
}
},
"reason": {
"target": "com.amazonaws.route53recoverycluster#ValidationExceptionReason"
},
"fields": {
"target": "com.amazonaws.route53recoverycluster#ValidationExceptionFieldList"
}
},
"traits": {
"smithy.api#documentation": "<p>There was a validation error on the request.</p>",
"smithy.api#error": "client",
"smithy.api#httpError": 400
}
},
"com.amazonaws.route53recoverycluster#ValidationExceptionField": {
"type": "structure",
"members": {
"name": {
"target": "com.amazonaws.route53recoverycluster#String",
"traits": {
"smithy.api#documentation": "<p>The field that had the validation exception.</p>",
"smithy.api#required": {}
}
},
"message": {
"target": "com.amazonaws.route53recoverycluster#String",
"traits": {
"smithy.api#documentation": "<p>Information about the validation exception.</p>",
"smithy.api#required": {}
}
}
},
"traits": {
"smithy.api#documentation": "<p>There was a validation error on the request.</p>"
}
},
"com.amazonaws.route53recoverycluster#ValidationExceptionFieldList": {
"type": "list",
"member": {
"target": "com.amazonaws.route53recoverycluster#ValidationExceptionField"
},
"traits": {
"smithy.api#documentation": "The fields that caused the error, if applicable"
}
},
"com.amazonaws.route53recoverycluster#ValidationExceptionReason": {
"type": "string",
"traits": {
"smithy.api#documentation": "Reason the request failed validation",
"smithy.api#enum": [
{
"value": "unknownOperation",
"name": "UNKNOWN_OPERATION"
},
{
"value": "cannotParse",
"name": "CANNOT_PARSE"
},
{
"value": "fieldValidationFailed",
"name": "FIELD_VALIDATION_FAILED"
},
{
"value": "other",
"name": "OTHER"
}
]
}
}
}
}

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

58
aws/sdk/sync-models.py Normal file → Executable file
View File

@ -1,22 +1,64 @@
#!/usr/bin/env python3
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
# SPDX-License-Identifier: Apache-2.0.
import sys import sys
import os import os
import os.path as path
from pathlib import Path from pathlib import Path
import shutil import shutil
if len(sys.argv) != 2: # Ensure working directory is the script path
print("Please provide the location of the aws-models repository as the first argument") script_path = path.dirname(path.realpath(__file__))
sys.exit(1)
aws_models = sys.argv[1] # Looks for aws-models in the parent directory of smithy-rs
def discover_aws_models():
repo_path = path.abspath(path.join(script_path, "../../../aws-models"))
git_path = repo_path + "/.git"
if path.exists(repo_path) and path.exists(git_path):
print(f"Discovered aws-models at {repo_path}")
return repo_path
else:
return None
# Acquire model location
aws_models_repo = discover_aws_models()
if aws_models_repo == None:
if len(sys.argv) != 2:
print("Please provide the location of the aws-models repository as the first argument")
sys.exit(1)
else:
aws_models_repo = sys.argv[1]
print("Copying over known models...")
known_models = set()
for model in os.listdir("aws-models"): for model in os.listdir("aws-models"):
if not model.endswith('.json'): if not model.endswith('.json'):
continue continue
model_name = model[:-len('.json')] model_name = model[:-len('.json')]
source = Path(aws_models) / model_name / 'smithy' / 'model.json' known_models.add(model_name)
if not source.exists(): source_path = Path(aws_models_repo) / model_name / "smithy" / "model.json"
print(f'warning: cannot find: {source}') if not source_path.exists():
print(f" Warning: cannot find model for '{model_name}' in aws-models, but it exists in smithy-rs")
continue continue
shutil.copyfile(source, Path('aws-models') / model) # Add a newline at the end when copying the model over
source = source_path.read_text()
with open(Path("aws-models") / model, "w") as file:
file.write(source)
if not source.endswith("\n"):
file.write("\n")
print("Looking for new models...")
new_models = []
for model in os.listdir(aws_models_repo):
if model not in known_models and path.exists(Path(aws_models_repo) / model / "smithy" / "model.json"):
new_models.append(model)
if len(new_models) > 0:
print(f" Warning: found models for {new_models} in aws-models that aren't in smithy-rs")
print(f" Run the following commands to bring these in:\n")
for model in new_models:
print(f" touch aws-models/{model}.json")
print(f" ./sync-models.py\n")
print("Models synced.") print("Models synced.")