Aws-cli: aws apigateway put-integration-response:response-templates valueof`null`は受け入れられません

作成日 2015年10月31日  ·  3コメント  ·  ソース: aws/aws-cli

次のように、応答テンプレートでnullを指定します。

aws apigateway put-integration-response \
  --region "$region" \
  --rest-api-id "$api_id" \
  --resource-id "$resource_id" \
  --http-method GET \
  --status-code 200 \
  --response-templates '{"application/json":null}'

エラーが発生します:

Parameter validation failed:
Invalid type for parameter responseTemplates.application/json, value: None, type: <type 'NoneType'>, valid types: <type 'basestring'>

null"Empty"に置き換えると、CLIは次のパラメーターを受け入れます。

  --response-templates '{"application/json":"Empty"}'

AWSコンソールが同じメソッドを作成し、それをクエリすると、値はnullとして表示されます。 aws-cliを使用して同じ値に設定できるはずです。

aws-cli / v1.9.2

guidance

最も参考になるコメント

回避策は、 nullの代わりに空の文字列、つまり--response-templates '{"application/json":""}'を渡すことであり、次のようになります。

{
    "statusCode": "200",
    "responseTemplates": {
        "application/json": null
    }
}

全てのコメント3件

回避策は、 nullの代わりに空の文字列、つまり--response-templates '{"application/json":""}'を渡すことであり、次のようになります。

{
    "statusCode": "200",
    "responseTemplates": {
        "application/json": null
    }
}

ありがとう。

@quiver@ehammondに感謝します。 「回避策」が実際にそれを行う正しい方法であると私は恐れています。 実際のところ、apigatewayサービスは入力として文字列を期待するようにモデル化されているため、すべてのAWS SDKはこのように機能し、apigatewayは空の文字列を内部でnullとして変換するようです。 おそらく、AWSコンソールでも同じことが起こります。

このページは役に立ちましたか?
0 / 5 - 0 評価