File: //lib/python2.7/site-packages/awscli/schema.pyc
�
R$�_c @ sV d d l m Z d e f d � � YZ d e f d � � YZ d e f d � � YZ d S( i����( t defaultdictt ParameterRequiredErrorc B s e Z RS( ( t __name__t
__module__( ( ( s1 /usr/lib/python2.7/site-packages/awscli/schema.pyR s t SchemaTransformerc B ss e Z d Z i d d 6d d 6Z d � Z d � Z d � Z d � Z d � Z d
� Z d � Z
d � Z d
� Z RS( sE
Transforms a custom argument parameter schema into an internal
model representation so that it can be treated like a normal
service model. This includes shorthand JSON parsing and
automatic documentation generation. The format of the schema
follows JSON Schema, which can be found here:
http://json-schema.org/
Only a relevant subset of features is supported here:
* Types: `object`, `array`, `string`, `integer`, `boolean`
* Properties: `type`, `description`, `required`, `enum`
For example::
{
"type": "array",
"items": {
"type": "object",
"properties": {
"arg1": {
"type": "string",
"required": True,
"enum": [
"Value1",
"Value2",
"Value3"
]
},
"arg2": {
"type": "integer",
"description": "The number of calls"
}
}
}
}
Assuming the schema is applied to a service named `foo`, with an
operation named `bar` and that the parameter is called `baz`, you
could call it with the shorthand JSON like so::
$ aws foo bar --baz arg1=Value1,arg2=5 arg1=Value2
t structuret objectt listt arrayc C s t � | _ d S( N( t ShapeNameGeneratort _shape_namer( t self( ( s1 /usr/lib/python2.7/site-packages/awscli/schema.pyt __init__G s c C s i } | j | | d � | S( s� Convert JSON schema to the format used internally by the AWS CLI.
:type schema: dict
:param schema: The JSON schema describing the argument model.
:rtype: dict
:return: The transformed model in a form that can be consumed
internally by the AWS CLI. The dictionary returned will
have a list of shapes, where the shape representing the
transformed schema is always named ``InputShape`` in the
returned dictionary.
t
InputShape( t
_transform( R t schemat shapes( ( s1 /usr/lib/python2.7/site-packages/awscli/schema.pyt transformJ s c C s� d | k r t d � � n | d d k rD | j | | � | | <ne | d d k rm | j | | � | | <n<