[
  {
    "description": "Scalar members",
    "metadata": {
      "protocol": "rest-xml"
    },
    "shapes": {
      "OutputShape": {
        "type": "structure",
        "members": {
          "ImaHeader": {
            "shape": "HeaderShape"
          },
          "ImaHeaderLocation": {
            "shape": "HeaderShape",
            "locationName": "X-Foo"
          },
          "Str": {
            "shape": "StringType"
          },
          "Num": {
            "shape": "IntegerType",
            "locationName": "FooNum"
          },
          "FalseBool": {
            "shape": "BooleanType"
          },
          "TrueBool": {
            "shape": "BooleanType"
          },
          "Float": {
            "shape": "FloatType"
          },
          "Double": {
            "shape": "DoubleType"
          },
          "Long": {
            "shape": "LongType"
          },
          "Char": {
            "shape": "CharType"
          },
          "Timestamp": {
            "shape": "TimestampType"
          }
        }
      },
      "StringType": {
        "type": "string"
      },
      "IntegerType": {
        "type": "integer"
      },
      "BooleanType": {
        "type": "boolean"
      },
      "FloatType": {
        "type": "float"
      },
      "DoubleType": {
        "type": "double"
      },
      "LongType": {
        "type": "long"
      },
      "CharType": {
        "type": "character"
      },
      "HeaderShape": {
        "type": "string",
        "location": "header"
      },
      "StatusShape": {
        "type": "integer",
        "location": "statusCode"
      },
      "TimestampType": {
        "type": "timestamp"
      }
    },
    "cases": [
      {
        "given": {
          "output": {
            "shape": "OutputShape"
          },
          "name": "OperationName"
        },
        "result": {
          "ImaHeader": "test",
          "ImaHeaderLocation": "abc",
          "Str": "myname",
          "Num": 123,
          "FalseBool": false,
          "TrueBool": true,
          "Float": 1.2,
          "Double": 1.3,
          "Long": 200,
          "Char": "a",
          "Timestamp": 1422172800
        },
        "response": {
          "status_code": 200,
          "headers": {
            "ImaHeader": "test",
            "X-Foo": "abc"
          },
          "body": "<OperationNameResponse><Str>myname</Str><FooNum>123</FooNum><FalseBool>false</FalseBool><TrueBool>true</TrueBool><Float>1.2</Float><Double>1.3</Double><Long>200</Long><Char>a</Char><Timestamp>2015-01-25T08:00:00Z</Timestamp></OperationNameResponse>"
        }
      },
      {
        "given": {
          "output": {
            "shape": "OutputShape"
          },
          "name": "OperationName"
        },
        "result": {
          "ImaHeader": "test",
          "ImaHeaderLocation": "abc",
          "Str": "",
          "Num": 123,
          "FalseBool": false,
          "TrueBool": true,
          "Float": 1.2,
          "Double": 1.3,
          "Long": 200,
          "Char": "a",
          "Timestamp": 1422172800
        },
        "response": {
          "status_code": 200,
          "headers": {
            "ImaHeader": "test",
            "X-Foo": "abc"
          },
          "body": "<OperationNameResponse><Str></Str><FooNum>123</FooNum><FalseBool>false</FalseBool><TrueBool>true</TrueBool><Float>1.2</Float><Double>1.3</Double><Long>200</Long><Char>a</Char><Timestamp>2015-01-25T08:00:00Z</Timestamp></OperationNameResponse>"
        }
      }
    ]
  },
  {
    "description": "Blob",
    "metadata": {
      "protocol": "rest-xml"
    },
    "shapes": {
      "OutputShape": {
        "type": "structure",
        "members": {
          "Blob": {
            "shape": "BlobType"
          }
        }
      },
      "BlobType": {
        "type": "blob"
      }
    },
    "cases": [
      {
        "given": {
          "output": {
            "shape": "OutputShape"
          },
          "name": "OperationName"
        },
        "result": {
          "Blob": "value"
        },
        "response": {
          "status_code": 200,
          "headers": {},
          "body": "<OperationNameResult><Blob>dmFsdWU=</Blob></OperationNameResult>"
        }
      }
    ]
  },
  {
    "description": "Lists",
    "metadata": {
      "protocol": "rest-xml"
    },
    "shapes": {
      "OutputShape": {
        "type": "structure",
        "members": {
          "ListMember": {
            "shape": "ListShape"
          }
        }
      },
      "ListShape": {
        "type": "list",
        "member": {
          "shape": "StringType"
        }
      },
      "StringType": {
        "type": "string"
      }
    },
    "cases": [
      {
        "given": {
          "output": {
            "shape": "OutputShape"
          },
          "name": "OperationName"
        },
        "result": {
          "ListMember": ["abc", "123"]
        },
        "response": {
          "status_code": 200,
          "headers": {},
          "body": "<OperationNameResult><ListMember><member>abc</member><member>123</member></ListMember></OperationNameResult>"
        }
      }
    ]
  },
  {
    "description": "List with custom member name",
    "metadata": {
      "protocol": "rest-xml"
    },
    "shapes": {
      "OutputShape": {
        "type": "structure",
        "members": {
          "ListMember": {
            "shape": "ListShape"
          }
        }
      },
      "ListShape": {
        "type": "list",
        "member": {
          "shape": "StringType",
          "locationName": "item"
        }
      },
      "StringType": {
        "type": "string"
      }
    },
    "cases": [
      {
        "given": {
          "output": {
            "shape": "OutputShape"
          },
          "name": "OperationName"
        },
        "result": {
          "ListMember": ["abc", "123"]
        },
        "response": {
          "status_code": 200,
          "headers": {},
          "body": "<OperationNameResult><ListMember><item>abc</item><item>123</item></ListMember></OperationNameResult>"
        }
      }
    ]
  },
  {
    "description": "Flattened List",
    "metadata": {
      "protocol": "rest-xml"
    },
    "shapes": {
      "OutputShape": {
        "type": "structure",
        "members": {
          "ListMember": {
            "shape": "StringList",
            "flattened": true
          }
        }
      },
      "StringList": {
        "type": "list",
        "member": {
          "shape": "StringType"
        }
      },
      "StringType": {
        "type": "string"
      }
    },
    "cases": [
      {
        "given": {
          "output": {
            "shape": "OutputShape"
          },
          "name": "OperationName"
        },
        "result": {
          "ListMember": ["abc", "123"]
        },
        "response": {
          "status_code": 200,
          "headers": {},
          "body": "<OperationNameResult><ListMember>abc</ListMember><ListMember>123</ListMember></OperationNameResult>"
        }
      }
    ]
  },
  {
    "description": "Normal map",
    "metadata": {
      "protocol": "rest-xml"
    },
    "shapes": {
      "OutputShape": {
        "type": "structure",
        "members": {
          "Map": {
            "shape": "StringMap"
          }
        }
      },
      "StringMap": {
        "type": "map",
        "key": {
          "shape": "StringType"
        },
        "value": {
          "shape": "SingleStructure"
        }
      },
      "SingleStructure": {
        "type": "structure",
        "members": {
          "foo": {
            "shape": "StringType"
          }
        }
      },
      "StringType": {
        "type": "string"
      }
    },
    "cases": [
      {
        "given": {
          "output": {
            "shape": "OutputShape"
          },
          "name": "OperationName"
        },
        "result": {
          "Map": {
            "qux": {
              "foo": "bar"
            },
            "baz": {
              "foo": "bam"
            }
          }
        },
        "response": {
          "status_code": 200,
          "headers": {},
          "body": "<OperationNameResult><Map><entry><key>qux</key><value><foo>bar</foo></value></entry><entry><key>baz</key><value><foo>bam</foo></value></entry></Map></OperationNameResult>"
        }
      }
    ]
  },
  {
    "description": "Flattened map",
    "metadata": {
      "protocol": "rest-xml"
    },
    "shapes": {
      "OutputShape": {
        "type": "structure",
        "members": {
          "Map": {
            "shape": "StringMap",
            "flattened": true
          }
        }
      },
      "StringMap": {
        "type": "map",
        "key": {
          "shape": "StringType"
        },
        "value": {
          "shape": "StringType"
        }
      },
      "StringType": {
        "type": "string"
      }
    },
    "cases": [
      {
        "given": {
          "output": {
            "shape": "OutputShape"
          },
          "name": "OperationName"
        },
        "result": {
          "Map": {
            "qux": "bar",
            "baz": "bam"
          }
        },
        "response": {
          "status_code": 200,
          "headers": {},
          "body": "<OperationNameResult><Map><key>qux</key><value>bar</value></Map><Map><key>baz</key><value>bam</value></Map></OperationNameResult>"
        }
      }
    ]
  },
  {
    "description": "Named map",
    "metadata": {
      "protocol": "rest-xml"
    },
    "shapes": {
      "OutputShape": {
        "type": "structure",
        "members": {
          "Map": {
            "shape": "StringMap"
          }
        }
      },
      "StringMap": {
        "type": "map",
        "key": {
          "shape": "StringType",
          "locationName": "foo"
        },
        "value": {
          "shape": "StringType",
          "locationName": "bar"
        }
      },
      "StringType": {
        "type": "string"
      }
    },
    "cases": [
      {
        "given": {
          "output": {
            "shape": "OutputShape"
          },
          "name": "OperationName"
        },
        "result": {
          "Map": {
            "qux": "bar",
            "baz": "bam"
          }
        },
        "response": {
          "status_code": 200,
          "headers": {},
          "body": "<OperationNameResult><Map><entry><foo>qux</foo><bar>bar</bar></entry><entry><foo>baz</foo><bar>bam</bar></entry></Map></OperationNameResult>"
        }
      }
    ]
  },
  {
    "description": "XML payload",
    "metadata": {
      "protocol": "rest-xml"
    },
    "shapes": {
      "OutputShape": {
        "type": "structure",
        "payload": "Data",
        "members": {
          "Header": {
            "shape": "StringType",
            "location": "header",
            "locationName": "X-Foo"
          },
          "Data": {
            "shape": "SingleStructure"
          }
        }
      },
      "StringType": {
        "type": "string"
      },
      "SingleStructure": {
        "type": "structure",
        "members": {
          "Foo": {
            "shape": "StringType"
          }
        }
      }
    },
    "cases": [
      {
        "given": {
          "output": {
            "shape": "OutputShape"
          },
          "name": "OperationName"
        },
        "result": {
          "Header": "baz",
          "Data": {
            "Foo": "abc"
          }
        },
        "response": {
          "status_code": 200,
          "headers": {
            "X-Foo": "baz"
          },
          "body": "<OperationNameResponse><Foo>abc</Foo></OperationNameResponse>"
        }
      }
    ]
  },
  {
    "description": "Streaming payload",
    "metadata": {
      "protocol": "rest-xml"
    },
    "shapes": {
      "OutputShape": {
        "type": "structure",
        "payload": "Stream",
        "members": {
          "Stream": {
            "shape": "BlobStream"
          }
        }
      },
      "BlobStream": {
        "type": "blob"
      }
    },
    "cases": [
      {
        "given": {
          "output": {
            "shape": "OutputShape"
          },
          "name": "OperationName"
        },
        "result": {
          "Stream": "abc"
        },
        "response": {
          "status_code": 200,
          "headers": {},
          "body": "abc"
        }
      }
    ]
  },
  {
    "description": "Scalar members in headers",
    "metadata": {
      "protocol": "rest-xml"
    },
    "shapes": {
      "OutputShape": {
        "type": "structure",
        "members": {
          "Str": {
            "locationName": "x-str",
            "shape": "StringHeaderType"
          },
          "Integer": {
            "locationName": "x-int",
            "shape": "IntegerHeaderType"
          },
          "TrueBool": {
            "locationName": "x-true-bool",
            "shape": "BooleanHeaderType"
          },
          "FalseBool": {
            "locationName": "x-false-bool",
            "shape": "BooleanHeaderType"
          },
          "Float": {
            "locationName": "x-float",
            "shape": "FloatHeaderType"
          },
          "Double": {
            "locationName": "x-double",
            "shape": "DoubleHeaderType"
          },
          "Long": {
            "locationName": "x-long",
            "shape": "LongHeaderType"
          },
          "Char": {
            "locationName": "x-char",
            "shape": "CharHeaderType"
          },
          "Timestamp": {
            "locationName": "x-timestamp",
            "shape": "TimestampHeaderType"
          }
        }
      },
      "StringHeaderType": {
        "location": "header",
        "type": "string"
      },
      "IntegerHeaderType": {
        "location": "header",
        "type": "integer"
      },
      "BooleanHeaderType": {
        "location": "header",
        "type": "boolean"
      },
      "FloatHeaderType": {
        "location": "header",
        "type": "float"
      },
      "DoubleHeaderType": {
        "location": "header",
        "type": "double"
      },
      "LongHeaderType": {
        "location": "header",
        "type": "long"
      },
      "CharHeaderType": {
        "location": "header",
        "type": "character"
      },
      "TimestampHeaderType": {
        "location": "header",
        "type": "timestamp"
      }
    },
    "cases": [
      {
        "given": {
          "output": {
            "shape": "OutputShape"
          },
          "name": "OperationName"
        },
        "result": {
          "Str": "string",
          "Integer": 1,
          "TrueBool": true,
          "FalseBool": false,
          "Float": 1.5,
          "Double": 1.5,
          "Long": 100,
          "Char": "a",
          "Timestamp": 1422172800
        },
        "response": {
          "status_code": 200,
          "headers": {
            "x-str": "string",
            "x-int": "1",
            "x-true-bool": "true",
            "x-false-bool": "false",
            "x-float": "1.5",
            "x-double": "1.5",
            "x-long": "100",
            "x-char": "a",
            "x-timestamp": "Sun, 25 Jan 2015 08:00:00 GMT"
          },
          "body": ""
        }
      }
    ]
  },
  {
    "description": "Empty string",
    "metadata": {
      "protocol": "rest-xml"
    },
    "shapes": {
      "OutputShape": {
        "type": "structure",
        "members": {
          "Foo": {
            "shape": "StringType"
          }
        }
      },
      "StringType": {
        "type": "string"
      }
    },
    "cases": [
      {
        "given": {
          "output": {
            "shape": "OutputShape"
          },
          "name": "OperationName"
        },
        "result": {
          "Foo": ""
        },
        "response": {
          "status_code": 200,
          "headers": {},
          "body": "<OperationNameResponse><Foo/><RequestId>requestid</RequestId></OperationNameResponse>"
        }
      }
    ]
  },
  {
    "description": "JSON value trait",
    "metadata": {
      "protocol": "rest-xml"
    },
    "shapes": {
      "OutputShape": {
        "type": "structure",
        "members": {
          "Attr": {
            "shape": "StringType",
              "jsonvalue": true,
              "location": "header",
              "locationName": "X-Amz-Foo"
          }
        }
      },
      "StringType": {
        "type": "string"
      }
    },
    "cases": [
      {
        "given": {
          "output": {
            "shape": "OutputShape"
          },
          "name": "OperationName"
        },
        "result": {
          "Attr": {"Foo":"Bar"}
        },
        "response": {
          "status_code": 200,
          "headers": {"X-Amz-Foo": "eyJGb28iOiJCYXIifQ=="},
          "body": ""
        }
      }
    ]
  },
  {
    "description": "Timestamp members",
    "metadata": {
      "protocol": "rest-xml"
    },
    "shapes": {
      "OutputShape": {
        "type": "structure",
        "members": {
          "TimeArg": {
            "shape": "TimestampType"
          },
          "TimeArgInHeader": {
            "shape": "TimestampType",
            "location": "header",
            "locationName": "x-amz-timearg"
          },
          "TimeCustom": {
            "timestampFormat": "rfc822",
            "shape": "TimestampType"
          },
          "TimeCustomInHeader": {
            "timestampFormat": "unixTimestamp",
            "shape": "TimestampType",
            "location": "header",
            "locationName": "x-amz-timecustom"
          },
          "TimeFormat": {
            "shape": "TimestampFormatType"
          },
          "TimeFormatInHeader": {
            "shape": "TimestampFormatType",
            "location": "header",
            "locationName": "x-amz-timeformat"
          },
          "StructMember": {
            "shape": "TimeContainer"
          }
        }
      },
      "TimeContainer": {
        "type": "structure",
        "members": {
          "foo": {
            "shape": "TimestampType"
          },
          "bar": {
            "shape": "TimestampFormatType"
          }
        }
      },
      "TimestampFormatType": {
        "timestampFormat": "unixTimestamp",
        "type": "timestamp"
      },
      "TimestampType": {
        "type": "timestamp"
      }
    },
    "cases": [
      {
        "given": {
          "output": {
            "shape": "OutputShape"
          },
          "name": "OperationName"
        },
        "result": {
          "TimeArg": 1398796238,
          "TimeArgInHeader": 1398796238,
          "TimeCustom": 1398796238,
          "TimeCustomInHeader": 1398796238,
          "TimeFormat": 1398796238,
          "TimeFormatInHeader": 1398796238,
          "StructMember": {
            "foo": 1398796238,
            "bar": 1398796238
          }
        },
        "response": {
          "status_code": 200,
          "headers": {
            "x-amz-timearg": "Tue, 29 Apr 2014 18:30:38 GMT",
            "x-amz-timecustom": "1398796238",
            "x-amz-timeformat": "1398796238"
          },
          "body": "<OperationNameResponse><StructMember><foo>2014-04-29T18:30:38+00:00</foo><bar>1398796238</bar></StructMember><TimeArg>2014-04-29T18:30:38+00:00</TimeArg><TimeCustom>Tue, 29 Apr 2014 18:30:38 GMT</TimeCustom><TimeFormat>1398796238</TimeFormat><RequestId>requestid</RequestId></OperationNameResponse>"
        }
      }
    ]
  },
  {
    "description": "REST XML Event Stream",
    "metadata": {
      "protocol": "rest-xml"
    },
    "shapes": {
      "OutputShape": {
        "type": "structure",
        "members": {
            "Payload": {"shape": "EventStream"}
        },
        "payload": "Payload"
      },
      "EventStream": {
          "type": "structure",
          "eventstream": true,
          "members": {
              "TypeA": {"shape": "TypeAEvent"},
              "TypeB": {"shape": "TypeBEvent"},
              "TypeC": {"shape": "TypeCEvent"}
          }
      },
      "TypeAEvent": {
          "type": "structure",
          "event": true,
          "members": {
              "Payload": {
                  "shape": "BlobType",
                  "eventpayload": true
              }
          }
      },
      "TypeBEvent": {
          "type": "structure",
          "event": true,
          "members": {
              "Details": {
                  "shape": "Details",
                  "eventpayload": true
              }
          }
      },
      "TypeCEvent": {
          "type": "structure",
          "event": true,
          "members": {
              "Details": {
                  "shape": "Details",
                  "eventpayload": true
              },
              "Boolean": {
                  "shape": "BooleanType",
                  "eventheader": true
              },
              "Integer": {
                  "shape": "IntegerType",
                  "eventheader": true
              },
              "Blob": {
                  "shape": "BlobType",
                  "eventheader": true
              },
              "String": {
                  "shape": "StringType",
                  "eventheader": true
              },
              "Timestamp": {
                  "shape": "TimestampType",
                  "eventheader": true
              }
          }
      },
      "Details": {
          "type": "structure",
          "members": {
              "StringField": {"shape": "StringType"},
              "IntegerField": {"shape": "IntegerType"}
          }
      },
      "StringType": {
        "type": "string"
      },
      "IntegerType": {
        "type": "integer"
      },
      "BooleanType": {
        "type": "boolean"
      },
      "TimestampType": {
        "type": "timestamp"
      },
      "BlobType": {
        "type": "blob"
      }
    },
    "cases": [
      {
        "given": {
          "output": {
            "shape": "OutputShape"
          },
          "name": "OperationName"
        },
        "result": {
          "Payload": [
              {
                  "TypeA": {"Payload": "somebytes"}
              },
              {
                  "TypeB": {
                      "Details": {
                          "StringField": "somestring",
                          "IntegerField": 123
                      }
                  }
              }
          ]
        },
        "response": {
          "status_code": 200,
          "headers": {},
          "body": "AAAAbAAAAFPLgkVrDTptZXNzYWdlLXR5cGUHAAVldmVudAs6ZXZlbnQtdHlwZQcABVR5cGVBDTpjb250ZW50LXR5cGUHABhhcHBsaWNhdGlvbi9vY3RldC1zdHJlYW1zb21lYnl0ZXMesj2HAAAAsAAAAEOaMMdXDTptZXNzYWdlLXR5cGUHAAVldmVudAs6ZXZlbnQtdHlwZQcABVR5cGVCDTpjb250ZW50LXR5cGUHAAh0ZXh0L3htbDxUeXBlQiB4bWxucz0iIj48U3RyaW5nRmllbGQ+c29tZXN0cmluZzwvU3RyaW5nRmllbGQ+PEludGVnZXJGaWVsZD4xMjM8L0ludGVnZXJGaWVsZD48L1R5cGVCPiwthPo="
        }
      },
      {
        "given": {
          "output": {
            "shape": "OutputShape"
          },
          "name": "OperationName"
        },
        "result": {
          "Payload": [
              {
                  "TypeC": {
                      "Boolean": true,
                      "Integer": 123,
                      "Blob": "someblob",
                      "String": "somestring",
                      "Timestamp": 1422172800,
                      "Details": {
                          "StringField": "somestring",
                          "IntegerField": 123
                      }
                  }
              }
          ]
        },
        "response": {
          "status_code": 200,
          "headers": {},
          "body": "AAABAQAAAJBjEbY4DTptZXNzYWdlLXR5cGUHAAVldmVudAs6ZXZlbnQtdHlwZQcABVR5cGVDDTpjb250ZW50LXR5cGUHAAh0ZXh0L3htbAdCb29sZWFuAAdJbnRlZ2VyBAAAAHsEQmxvYgYACHNvbWVibG9iBlN0cmluZwcACnNvbWVzdHJpbmcJVGltZXN0YW1wCAAAAUsgGsQAPERldGFpbHMgeG1sbnM9IiI+PFN0cmluZ0ZpZWxkPnNvbWVzdHJpbmc8L1N0cmluZ0ZpZWxkPjxJbnRlZ2VyRmllbGQ+MTIzPC9JbnRlZ2VyRmllbGQ+PC9EZXRhaWxzPhGUvKo="
        }
      },
      {
        "given": {
          "output": {
            "shape": "OutputShape"
          },
          "name": "OperationName"
        },
        "result": {
          "Payload": []
        },
        "response": {
          "status_code": 200,
          "headers": {},
          "body": ""
        }
      }
    ]
  }
]
