text: import { __assign, __awaiter, __generator, __read } from "tslib";
  import { HttpRequest as __HttpRequest } from "@aws-sdk/protocol-http";
  export var serializeAws_json1_1BatchCheckLayerAvailabilityCommand = function (input, context) { return __awaiter(void 0, void 0, void 0, function () {
      var headers, body;
      return __generator(this, function (_a) {
          headers = {
              "content-type": "application/x-amz-json-1.1",
              "x-amz-target": "AmazonEC2ContainerRegistry_V20150921.BatchCheckLayerAvailability",
          };
          body = JSON.stringify(serializeAws_json1_1BatchCheckLayerAvailabilityRequest(input, context));
          return [2 /*return*/, buildHttpRpcRequest(context, headers, "/", undefined, body)];
      });
  }); };
  export var serializeAws_json1_1BatchDeleteImageCommand = function (input, context) { return __awaiter(void 0, void 0, void 0, function () {
      var headers, body;
      return __generator(this, function (_a) {
          headers = {
              "content-type": "application/x-amz-json-1.1",
              "x-amz-target": "AmazonEC2ContainerRegistry_V20150921.BatchDeleteImage",
          };
          body = JSON.stringify(serializeAws_json1_1BatchDeleteImageRequest(input, context));
          return [2 /*return*/, buildHttpRpcRequest(context, headers, "/", undefined, body)];
      });
  }); };
  export var serializeAws_json1_1BatchGetImageCommand = function (input, context) { return __awaiter(void 0, void 0, void 0, function () {
      var headers, body;
      return __generator(this, function (_a) {
          headers = {
              "content-type": "application/x-amz-json-1.1",
              "x-amz-target": "AmazonEC2ContainerRegistry_V20150921.BatchGetImage",
          };
          body = JSON.stringify(serializeAws_json1_1BatchGetImageRequest(input, context));
          return [2 /*return*/, buildHttpRpcRequest(context, headers, "/", undefined, body)];
      });
  }); };
  export var serializeAws_json1_1CompleteLayerUploadCommand = function (input, context) { return __awaiter(void 0, void 0, void 0, function () {
      var headers, body;
      return __generator(this, function (_a) {
          headers = {
              "content-type": "application/x-amz-json-1.1",
              "x-amz-target": "AmazonEC2ContainerRegistry_V20150921.CompleteLayerUpload",
          };
          body = JSON.stringify(serializeAws_json1_1CompleteLayerUploadRequest(input, context));
          return [2 /*return*/, buildHttpRpcRequest(context, headers, "/", undefined, body)];
      });
  }); };
  export var serializeAws_json1_1CreateRepositoryCommand = function (input, context) { return __awaiter(void 0, void 0, void 0, function () {
      var headers, body;
      return __generator(this, function (_a) {
          headers = {
              "content-type": "application/x-amz-json-1.1",
              "x-amz-target": "AmazonEC2ContainerRegistry_V20150921.CreateRepository",
          };
          body = JSON.stringify(serializeAws_json1_1CreateRepositoryRequest(input, context));
          return [2 /*return*/, buildHttpRpcRequest(context, headers, "/", undefined, body)];
      });
  }); };
  export var serializeAws_json1_1DeleteLifecyclePolicyCommand = function (input, context) { return __awaiter(void 0, void 0, void 0, function () {
      var headers, body;
      return __generator(this, function (_a) {
          headers = {
              "content-type": "application/x-amz-json-1.1",
              "x-amz-target": "AmazonEC2ContainerRegistry_V20150921.DeleteLifecyclePolicy",
          };
          body = JSON.stringify(serializeAws_json1_1DeleteLifecyclePolicyRequest(input, context));
          return [2 /*return*/, buildHttpRpcRequest(context, headers, "/", undefined, body)];
      });
  }); };
  export var serializeAws_json1_1DeleteRegistryPolicyCommand = function (input, context) { return __awaiter(void 0, void 0, void 0, function () {
      var headers, body;
      return __generator(this, function (_a) {
          headers = {
              "content-type": "application/x-amz-json-1.1",
              "x-amz-target": "AmazonEC2ContainerRegistry_V20150921.DeleteRegistryPolicy",
          };
          body = JSON.stringify(serializeAws_json1_1DeleteRegistryPolicyRequest(input, context));
          return [2 /*return*/, buildHttpRpcRequest(context, headers, "/", undefined, body)];
      });
  }); };
  export var serializeAws_json1_1DeleteRepositoryCommand = function (input, context) { return __awaiter(void 0, void 0, void 0, function () {
      var headers, body;
      return __generator(this, function (_a) {
          headers = {
              "content-type": "application/x-amz-json-1.1",
              "x-amz-target": "AmazonEC2ContainerRegistry_V20150921.DeleteRepository",
          };
          body = JSON.stringify(serializeAws_json1_1DeleteRepositoryRequest(input, context));
          return [2 /*return*/, buildHttpRpcRequest(context, headers, "/", undefined, body)];
      });
  }); };
  export var serializeAws_json1_1DeleteRepositoryPolicyCommand = function (input, context) { return __awaiter(void 0, void 0, void 0, function () {
      var headers, body;
      return __generator(this, function (_a) {
          headers = {
              "content-type": "application/x-amz-json-1.1",
              "x-amz-target": "AmazonEC2ContainerRegistry_V20150921.DeleteRepositoryPolicy",
          };
          body = JSON.stringify(serializeAws_json1_1DeleteRepositoryPolicyRequest(input, context));
          return [2 /*return*/, buildHttpRpcRequest(context, headers, "/", undefined, body)];
      });
  }); };
  export var serializeAws_json1_1DescribeImagesCommand = function (input, context) { return __awaiter(void 0, void 0, void 0, function () {
      var headers, body;
      return __generator(this, function (_a) {
          headers = {
              "content-type": "application/x-amz-json-1.1",
              "x-amz-target": "AmazonEC2ContainerRegistry_V20150921.DescribeImages",
          };
          body = JSON.stringify(serializeAws_json1_1DescribeImagesRequest(input, context));
          return [2 /*return*/, buildHttpRpcRequest(context, headers, "/", undefined, body)];
      });
  }); };
  export var serializeAws_json1_1DescribeImageScanFindingsCommand = function (input, context) { return __awaiter(void 0, void 0, void 0, function () {
      var headers, body;
      return __generator(this, function (_a) {
          headers = {
              "content-type": "application/x-amz-json-1.1",
              "x-amz-target": "AmazonEC2ContainerRegistry_V20150921.DescribeImageScanFindings",
          };
          body = JSON.stringify(serializeAws_json1_1DescribeImageScanFindingsRequest(input, context));
          return [2 /*return*/, buildHttpRpcRequest(context, headers, "/", undefined, body)];
      });
  }); };
  export var serializeAws_json1_1DescribeRegistryCommand = function (input, context) { return __awaiter(void 0, void 0, void 0, function () {
      var headers, body;
      return __generator(this, function (_a) {
          headers = {
              "content-type": "application/x-amz-json-1.1",
              "x-amz-target": "AmazonEC2ContainerRegistry_V20150921.DescribeRegistry",
          };
          body = JSON.stringify(serializeAws_json1_1DescribeRegistryRequest(input, context));
          return [2 /*return*/, buildHttpRpcRequest(context, headers, "/", undefined, body)];
      });
  }); };
  export var serializeAws_json1_1DescribeRepositoriesCommand = function (input, context) { return __awaiter(void 0, void 0, void 0, function () {
      var headers, body;
      return __generator(this, function (_a) {
          headers = {
              "content-type": "application/x-amz-json-1.1",
              "x-amz-target": "AmazonEC2ContainerRegistry_V20150921.DescribeRepositories",
          };
          body = JSON.stringify(serializeAws_json1_1DescribeRepositoriesRequest(input, context));
          return [2 /*return*/, buildHttpRpcRequest(context, headers, "/", undefined, body)];
      });
  }); };
  export var serializeAws_json1_1GetAuthorizationTokenCommand = function (input, context) { return __awaiter(void 0, void 0, void 0, function () {
      var headers, body;
      return __generator(this, function (_a) {
          headers = {
              "content-type": "application/x-amz-json-1.1",
              "x-amz-target": "AmazonEC2ContainerRegistry_V20150921.GetAuthorizationToken",
          };
          body = JSON.stringify(serializeAws_json1_1GetAuthorizationTokenRequest(input, context));
          return [2 /*return*/, buildHttpRpcRequest(context, headers, "/", undefined, body)];
      });
  }); };
  export var serializeAws_json1_1GetDownloadUrlForLayerCommand = function (input, context) { return __awaiter(void 0, void 0, void 0, function () {
      var headers, body;
      return __generator(this, function (_a) {
          headers = {
              "content-type": "application/x-amz-json-1.1",
              "x-amz-target": "AmazonEC2ContainerRegistry_V20150921.GetDownloadUrlForLayer",
          };
          body = JSON.stringify(serializeAws_json1_1GetDownloadUrlForLayerRequest(input, context));
          return [2 /*return*/, buildHttpRpcRequest(context, headers, "/", undefined, body)];
      });
  }); };
  export var serializeAws_json1_1GetLifecyclePolicyCommand = function (input, context) { return __awaiter(void 0, void 0, void 0, function () {
      var headers, body;
      return __generator(this, function (_a) {
          headers = {
              "content-type": "application/x-amz-json-1.1",
              "x-amz-target": "AmazonEC2ContainerRegistry_V20150921.GetLifecyclePolicy",
          };
          body = JSON.stringify(serializeAws_json1_1GetLifecyclePolicyRequest(input, context));
          return [2 /*return*/, buildHttpRpcRequest(context, headers, "/", undefined, body)];
      });
  }); };
  export var serializeAws_json1_1GetLifecyclePolicyPreviewCommand = function (input, context) { return __awaiter(void 0, void 0, void 0, function () {
      var headers, body;
      return __generator(this, function (_a) {
          headers = {
              "content-type": "application/x-amz-json-1.1",
              "x-amz-target": "AmazonEC2ContainerRegistry_V20150921.GetLifecyclePolicyPreview",
          };
          body = JSON.stringify(serializeAws_json1_1GetLifecyclePolicyPreviewRequest(input, context));
          return [2 /*return*/, buildHttpRpcRequest(context, headers, "/", undefined, body)];
      });
  }); };
  export var serializeAws_json1_1GetRegistryPolicyCommand = function (input, context) { return __awaiter(void 0, void 0, void 0, function () {
      var headers, body;
      return __generator(this, function (_a) {
          headers = {
              "content-type": "application/x-amz-json-1.1",
              "x-amz-target": "AmazonEC2ContainerRegistry_V20150921.GetRegistryPolicy",
          };
          body = JSON.stringify(serializeAws_json1_1GetRegistryPolicyRequest(input, context));
          return [2 /*return*/, buildHttpRpcRequest(context, headers, "/", undefined, body)];
      });
  }); };
  export var serializeAws_json1_1GetRepositoryPolicyCommand = function (input, context) { return __awaiter(void 0, void 0, void 0, function () {
      var headers, body;
      return __generator(this, function (_a) {
          headers = {
              "content-type": "application/x-amz-json-1.1",
              "x-amz-target": "AmazonEC2ContainerRegistry_V20150921.GetRepositoryPolicy",
          };
          body = JSON.stringify(serializeAws_json1_1GetRepositoryPolicyRequest(input, context));
          return [2 /*return*/, buildHttpRpcRequest(context, headers, "/", undefined, body)];
      });
  }); };
  export var serializeAws_json1_1InitiateLayerUploadCommand = function (input, context) { return __awaiter(void 0, void 0, void 0, function () {
      var headers, body;
      return __generator(this, function (_a) {
          headers = {
              "content-type": "application/x-amz-json-1.1",
              "x-amz-target": "AmazonEC2ContainerRegistry_V20150921.InitiateLayerUpload",
          };
          body = JSON.stringify(serializeAws_json1_1InitiateLayerUploadRequest(input, context));
          return [2 /*return*/, buildHttpRpcRequest(context, headers, "/", undefined, body)];
      });
  }); };
  export var serializeAws_json1_1ListImagesCommand = function (input, context) { return __awaiter(void 0, void 0, void 0, function () {
      var headers, body;
      return __generator(this, function (_a) {
          headers = {
              "content-type": "application/x-amz-json-1.1",
              "x-amz-target": "AmazonEC2ContainerRegistry_V20150921.ListImages",
          };
          body = JSON.stringify(serializeAws_json1_1ListImagesRequest(input, context));
          return [2 /*return*/, buildHttpRpcRequest(context, headers, "/", undefined, body)];
      });
  }); };
  export var serializeAws_json1_1ListTagsForResourceCommand = function (input, context) { return __awaiter(void 0, void 0, void 0, function () {
      var headers, body;
      return __generator(this, function (_a) {
          headers = {
              "content-type": "application/x-amz-json-1.1",
              "x-amz-target": "AmazonEC2ContainerRegistry_V20150921.ListTagsForResource",
          };
          body = JSON.stringify(serializeAws_json1_1ListTagsForResourceRequest(input, context));
          return [2 /*return*/, buildHttpRpcRequest(context, headers, "/", undefined, body)];
      });
  }); };
  export var serializeAws_json1_1PutImageCommand = function (input, context) { return __awaiter(void 0, void 0, void 0, function () {
      var headers, body;
      return __generator(this, function (_a) {
          headers = {
              "content-type": "application/x-amz-json-1.1",
              "x-amz-target": "AmazonEC2ContainerRegistry_V20150921.PutImage",
          };
          body = JSON.stringify(serializeAws_json1_1PutImageRequest(input, context));
          return [2 /*return*/, buildHttpRpcRequest(context, headers, "/", undefined, body)];
      });
  }); };
  export var serializeAws_json1_1PutImageScanningConfigurationCommand = function (input, context) { return __awaiter(void 0, void 0, void 0, function () {
      var headers, body;
      return __generator(this, function (_a) {
          headers = {
              "content-type": "application/x-amz-json-1.1",
              "x-amz-target": "AmazonEC2ContainerRegistry_V20150921.PutImageScanningConfiguration",
          };
          body = JSON.stringify(serializeAws_json1_1PutImageScanningConfigurationRequest(input, context));
          return [2 /*return*/, buildHttpRpcRequest(context, headers, "/", undefined, body)];
      });
  }); };
  export var serializeAws_json1_1PutImageTagMutabilityCommand = function (input, context) { return __awaiter(void 0, void 0, void 0, function () {
      var headers, body;
      return __generator(this, function (_a) {
          headers = {
              "content-type": "application/x-amz-json-1.1",
              "x-amz-target": "AmazonEC2ContainerRegistry_V20150921.PutImageTagMutability",
          };
          body = JSON.stringify(serializeAws_json1_1PutImageTagMutabilityRequest(input, context));
          return [2 /*return*/, buildHttpRpcRequest(context, headers, "/", undefined, body)];
      });
  }); };
  export var serializeAws_json1_1PutLifecyclePolicyCommand = function (input, context) { return __awaiter(void 0, void 0, void 0, function () {
      var headers, body;
      return __generator(this, function (_a) {
          headers = {
              "content-type": "application/x-amz-json-1.1",
              "x-amz-target": "AmazonEC2ContainerRegistry_V20150921.PutLifecyclePolicy",
          };
          body = JSON.stringify(serializeAws_json1_1PutLifecyclePolicyRequest(input, context));
          return [2 /*return*/, buildHttpRpcRequest(context, headers, "/", undefined, body)];
      });
  }); };
  export var serializeAws_json1_1PutRegistryPolicyCommand = function (input, context) { return __awaiter(void 0, void 0, void 0, function () {
      var headers, body;
      return __generator(this, function (_a) {
          headers = {
              "content-type": "application/x-amz-json-1.1",
              "x-amz-target": "AmazonEC2ContainerRegistry_V20150921.PutRegistryPolicy",
          };
          body = JSON.stringify(serializeAws_json1_1PutRegistryPolicyRequest(input, context));
          return [2 /*return*/, buildHttpRpcRequest(context, headers, "/", undefined, body)];
      });
  }); };
  export var serializeAws_json1_1PutReplicationConfigurationCommand = function (input, context) { return __awaiter(void 0, void 0, void 0, function () {
      var headers, body;
      return __generator(this, function (_a) {
          headers = {
              "content-type": "application/x-amz-json-1.1",
              "x-amz-target": "AmazonEC2ContainerRegistry_V20150921.PutReplicationConfiguration",
          };
          body = JSON.stringify(serializeAws_json1_1PutReplicationConfigurationRequest(input, context));
          return [2 /*return*/, buildHttpRpcRequest(context, headers, "/", undefined, body)];
      });
  }); };
  export var serializeAws_json1_1SetRepositoryPolicyCommand = function (input, context) { return __awaiter(void 0, void 0, void 0, function () {
      var headers, body;
      return __generator(this, function (_a) {
          headers = {
              "content-type": "application/x-amz-json-1.1",
              "x-amz-target": "AmazonEC2ContainerRegistry_V20150921.SetRepositoryPolicy",
          };
          body = JSON.stringify(serializeAws_json1_1SetRepositoryPolicyRequest(input, context));
          return [2 /*return*/, buildHttpRpcRequest(context, headers, "/", undefined, body)];
      });
  }); };
  export var serializeAws_json1_1StartImageScanCommand = function (input, context) { return __awaiter(void 0, void 0, void 0, function () {
      var headers, body;
      return __generator(this, function (_a) {
          headers = {
              "content-type": "application/x-amz-json-1.1",
              "x-amz-target": "AmazonEC2ContainerRegistry_V20150921.StartImageScan",
          };
          body = JSON.stringify(serializeAws_json1_1StartImageScanRequest(input, context));
          return [2 /*return*/, buildHttpRpcRequest(context, headers, "/", undefined, body)];
      });
  }); };
  export var serializeAws_json1_1StartLifecyclePolicyPreviewCommand = function (input, context) { return __awaiter(void 0, void 0, void 0, function () {
      var headers, body;
      return __generator(this, function (_a) {
          headers = {
              "content-type": "application/x-amz-json-1.1",
              "x-amz-target": "AmazonEC2ContainerRegistry_V20150921.StartLifecyclePolicyPreview",
          };
          body = JSON.stringify(serializeAws_json1_1StartLifecyclePolicyPreviewRequest(input, context));
          return [2 /*return*/, buildHttpRpcRequest(context, headers, "/", undefined, body)];
      });
  }); };
  export var serializeAws_json1_1TagResourceCommand = function (input, context) { return __awaiter(void 0, void 0, void 0, function () {
      var headers, body;
      return __generator(this, function (_a) {
          headers = {
              "content-type": "application/x-amz-json-1.1",
              "x-amz-target": "AmazonEC2ContainerRegistry_V20150921.TagResource",
          };
          body = JSON.stringify(serializeAws_json1_1TagResourceRequest(input, context));
          return [2 /*return*/, buildHttpRpcRequest(context, headers, "/", undefined, body)];
      });
  }); };
  export var serializeAws_json1_1UntagResourceCommand = function (input, context) { return __awaiter(void 0, void 0, void 0, function () {
      var headers, body;
      return __generator(this, function (_a) {
          headers = {
              "content-type": "application/x-amz-json-1.1",
              "x-amz-target": "AmazonEC2ContainerRegistry_V20150921.UntagResource",
          };
          body = JSON.stringify(serializeAws_json1_1UntagResourceRequest(input, context));
          return [2 /*return*/, buildHttpRpcRequest(context, headers, "/", undefined, body)];
      });
  }); };
  export var serializeAws_json1_1UploadLayerPartCommand = function (input, context) { return __awaiter(void 0, void 0, void 0, function () {
      var headers, body;
      return __generator(this, function (_a) {
          headers = {
              "content-type": "application/x-amz-json-1.1",
              "x-amz-target": "AmazonEC2ContainerRegistry_V20150921.UploadLayerPart",
          };
          body = JSON.stringify(serializeAws_json1_1UploadLayerPartRequest(input, context));
          return [2 /*return*/, buildHttpRpcRequest(context, headers, "/", undefined, body)];
      });
  }); };
  export var deserializeAws_json1_1BatchCheckLayerAvailabilityCommand = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
      var data, contents, response;
      return __generator(this, function (_a) {
          switch (_a.label) {
              case 0:
                  if (output.statusCode >= 300) {
                      return [2 /*return*/, deserializeAws_json1_1BatchCheckLayerAvailabilityCommandError(output, context)];
                  }
                  return [4 /*yield*/, parseBody(output.body, context)];
              case 1:
                  data = _a.sent();
                  contents = {};
                  contents = deserializeAws_json1_1BatchCheckLayerAvailabilityResponse(data, context);
                  response = __assign({ $metadata: deserializeMetadata(output) }, contents);
                  return [2 /*return*/, Promise.resolve(response)];
          }
      });
  }); };
  var deserializeAws_json1_1BatchCheckLayerAvailabilityCommandError = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
      var parsedOutput, _a, response, errorCode, _b, _c, _d, _e, parsedBody, message;
      var _f;
      return __generator(this, function (_g) {
          switch (_g.label) {
              case 0:
                  _a = [__assign({}, output)];
                  _f = {};
                  return [4 /*yield*/, parseBody(output.body, context)];
              case 1:
                  parsedOutput = __assign.apply(void 0, _a.concat([(_f.body = _g.sent(), _f)]));
                  errorCode = "UnknownError";
                  errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
                  _b = errorCode;
                  switch (_b) {
                      case "InvalidParameterException": return [3 /*break*/, 2];
                      case "com.amazonaws.ecr#InvalidParameterException": return [3 /*break*/, 2];
                      case "RepositoryNotFoundException": return [3 /*break*/, 4];
                      case "com.amazonaws.ecr#RepositoryNotFoundException": return [3 /*break*/, 4];
                      case "ServerException": return [3 /*break*/, 6];
                      case "com.amazonaws.ecr#ServerException": return [3 /*break*/, 6];
                  }
                  return [3 /*break*/, 8];
              case 2:
                  _c = [{}];
                  return [4 /*yield*/, deserializeAws_json1_1InvalidParameterExceptionResponse(parsedOutput, context)];
              case 3:
                  response = __assign.apply(void 0, [__assign.apply(void 0, _c.concat([(_g.sent())])), { name: errorCode, $metadata: deserializeMetadata(output) }]);
                  return [3 /*break*/, 9];
              case 4:
                  _d = [{}];
                  return [4 /*yield*/, deserializeAws_json1_1RepositoryNotFoundExceptionResponse(parsedOutput, context)];
              case 5:
                  response = __assign.apply(void 0, [__assign.apply(void 0, _d.concat([(_g.sent())])), { name: errorCode, $metadata: deserializeMetadata(output) }]);
                  return [3 /*break*/, 9];
              case 6:
                  _e = [{}];
                  return [4 /*yield*/, deserializeAws_json1_1ServerExceptionResponse(parsedOutput, context)];
              case 7:
                  response = __assign.apply(void 0, [__assign.apply(void 0, _e.concat([(_g.sent())])), { name: errorCode, $metadata: deserializeMetadata(output) }]);
                  return [3 /*break*/, 9];
              case 8:
                  parsedBody = parsedOutput.body;
                  errorCode = parsedBody.code || parsedBody.Code || errorCode;
                  response = __assign(__assign({}, parsedBody), { name: "" + errorCode, message: parsedBody.message || parsedBody.Message || errorCode, $fault: "client", $metadata: deserializeMetadata(output) });
                  _g.label = 9;
              case 9:
                  message = response.message || response.Message || errorCode;
                  response.message = message;
                  delete response.Message;
                  return [2 /*return*/, Promise.reject(Object.assign(new Error(message), response))];
          }
      });
  }); };
  export var deserializeAws_json1_1BatchDeleteImageCommand = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
      var data, contents, response;
      return __generator(this, function (_a) {
          switch (_a.label) {
              case 0:
                  if (output.statusCode >= 300) {
                      return [2 /*return*/, deserializeAws_json1_1BatchDeleteImageCommandError(output, context)];
                  }
                  return [4 /*yield*/, parseBody(output.body, context)];
              case 1:
                  data = _a.sent();
                  contents = {};
                  contents = deserializeAws_json1_1BatchDeleteImageResponse(data, context);
                  response = __assign({ $metadata: deserializeMetadata(output) }, contents);
                  return [2 /*return*/, Promise.resolve(response)];
          }
      });
  }); };
  var deserializeAws_json1_1BatchDeleteImageCommandError = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
      var parsedOutput, _a, response, errorCode, _b, _c, _d, _e, parsedBody, message;
      var _f;
      return __generator(this, function (_g) {
          switch (_g.label) {
              case 0:
                  _a = [__assign({}, output)];
                  _f = {};
                  return [4 /*yield*/, parseBody(output.body, context)];
              case 1:
                  parsedOutput = __assign.apply(void 0, _a.concat([(_f.body = _g.sent(), _f)]));
                  errorCode = "UnknownError";
                  errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
                  _b = errorCode;
                  switch (_b) {
                      case "InvalidParameterException": return [3 /*break*/, 2];
                      case "com.amazonaws.ecr#InvalidParameterException": return [3 /*break*/, 2];
                      case "RepositoryNotFoundException": return [3 /*break*/, 4];
                      case "com.amazonaws.ecr#RepositoryNotFoundException": return [3 /*break*/, 4];
                      case "ServerException": return [3 /*break*/, 6];
                      case "com.amazonaws.ecr#ServerException": return [3 /*break*/, 6];
                  }
                  return [3 /*break*/, 8];
              case 2:
                  _c = [{}];
                  return [4 /*yield*/, deserializeAws_json1_1InvalidParameterExceptionResponse(parsedOutput, context)];
              case 3:
                  response = __assign.apply(void 0, [__assign.apply(void 0, _c.concat([(_g.sent())])), { name: errorCode, $metadata: deserializeMetadata(output) }]);
                  return [3 /*break*/, 9];
              case 4:
                  _d = [{}];
                  return [4 /*yield*/, deserializeAws_json1_1RepositoryNotFoundExceptionResponse(parsedOutput, context)];
              case 5:
                  response = __assign.apply(void 0, [__assign.apply(void 0, _d.concat([(_g.sent())])), { name: errorCode, $metadata: deserializeMetadata(output) }]);
                  return [3 /*break*/, 9];
              case 6:
                  _e = [{}];
                  return [4 /*yield*/, deserializeAws_json1_1ServerExceptionResponse(parsedOutput, context)];
              case 7:
                  response = __assign.apply(void 0, [__assign.apply(void 0, _e.concat([(_g.sent())])), { name: errorCode, $metadata: deserializeMetadata(output) }]);
                  return [3 /*break*/, 9];
              case 8:
                  parsedBody = parsedOutput.body;
                  errorCode = parsedBody.code || parsedBody.Code || errorCode;
                  response = __assign(__assign({}, parsedBody), { name: "" + errorCode, message: parsedBody.message || parsedBody.Message || errorCode, $fault: "client", $metadata: deserializeMetadata(output) });
                  _g.label = 9;
              case 9:
                  message = response.message || response.Message || errorCode;
                  response.message = message;
                  delete response.Message;
                  return [2 /*return*/, Promise.reject(Object.assign(new Error(message), response))];
          }
      });
  }); };
  export var deserializeAws_json1_1BatchGetImageCommand = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
      var data, contents, response;
      return __generator(this, function (_a) {
          switch (_a.label) {
              case 0:
                  if (output.statusCode >= 300) {
                      return [2 /*return*/, deserializeAws_json1_1BatchGetImageCommandError(output, context)];
                  }
                  return [4 /*yield*/, parseBody(output.body, context)];
              case 1:
                  data = _a.sent();
                  contents = {};
                  contents = deserializeAws_json1_1BatchGetImageResponse(data, context);
                  response = __assign({ $metadata: deserializeMetadata(output) }, contents);
                  return [2 /*return*/, Promise.resolve(response)];
          }
      });
  }); };
  var deserializeAws_json1_1BatchGetImageCommandError = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
      var parsedOutput, _a, response, errorCode, _b, _c, _d, _e, parsedBody, message;
      var _f;
      return __generator(this, function (_g) {
          switch (_g.label) {
              case 0:
                  _a = [__assign({}, output)];
                  _f = {};
                  return [4 /*yield*/, parseBody(output.body, context)];
              case 1:
                  parsedOutput = __assign.apply(void 0, _a.concat([(_f.body = _g.sent(), _f)]));
                  errorCode = "UnknownError";
                  errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
                  _b = errorCode;
                  switch (_b) {
                      case "InvalidParameterException": return [3 /*break*/, 2];
                      case "com.amazonaws.ecr#InvalidParameterException": return [3 /*break*/, 2];
                      case "RepositoryNotFoundException": return [3 /*break*/, 4];
                      case "com.amazonaws.ecr#RepositoryNotFoundException": return [3 /*break*/, 4];
                      case "ServerException": return [3 /*break*/, 6];
                      case "com.amazonaws.ecr#ServerException": return [3 /*break*/, 6];
                  }
                  return [3 /*break*/, 8];
              case 2:
                  _c = [{}];
                  return [4 /*yield*/, deserializeAws_json1_1InvalidParameterExceptionResponse(parsedOutput, context)];
              case 3:
                  response = __assign.apply(void 0, [__assign.apply(void 0, _c.concat([(_g.sent())])), { name: errorCode, $metadata: deserializeMetadata(output) }]);
                  return [3 /*break*/, 9];
              case 4:
                  _d = [{}];
                  return [4 /*yield*/, deserializeAws_json1_1RepositoryNotFoundExceptionResponse(parsedOutput, context)];
              case 5:
                  response = __assign.apply(void 0, [__assign.apply(void 0, _d.concat([(_g.sent())])), { name: errorCode, $metadata: deserializeMetadata(output) }]);
                  return [3 /*break*/, 9];
              case 6:
                  _e = [{}];
                  return [4 /*yield*/, deserializeAws_json1_1ServerExceptionResponse(parsedOutput, context)];
              case 7:
                  response = __assign.apply(void 0, [__assign.apply(void 0, _e.concat([(_g.sent())])), { name: errorCode, $metadata: deserializeMetadata(output) }]);
                  return [3 /*break*/, 9];
              case 8:
                  parsedBody = parsedOutput.body;
                  errorCode = parsedBody.code || parsedBody.Code || errorCode;
                  response = __assign(__assign({}, parsedBody), { name: "" + errorCode, message: parsedBody.message || parsedBody.Message || errorCode, $fault: "client", $metadata: deserializeMetadata(output) });
                  _g.label = 9;
              case 9:
                  message = response.message || response.Message || errorCode;
                  response.message = message;
                  delete response.Message;
                  return [2 /*return*/, Promise.reject(Object.assign(new Error(message), response))];
          }
      });
  }); };
  export var deserializeAws_json1_1CompleteLayerUploadCommand = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
      var data, contents, response;
      return __generator(this, function (_a) {
          switch (_a.label) {
              case 0:
                  if (output.statusCode >= 300) {
                      return [2 /*return*/, deserializeAws_json1_1CompleteLayerUploadCommandError(output, context)];
                  }
                  return [4 /*yield*/, parseBody(output.body, context)];
              case 1:
                  data = _a.sent();
                  contents = {};
                  contents = deserializeAws_json1_1CompleteLayerUploadResponse(data, context);
                  response = __assign({ $metadata: deserializeMetadata(output) }, contents);
                  return [2 /*return*/, Promise.resolve(response)];
          }
      });
  }); };
  var deserializeAws_json1_1CompleteLayerUploadCommandError = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
      var parsedOutput, _a, response, errorCode, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, parsedBody, message;
      var _m;
      return __generator(this, function (_o) {
          switch (_o.label) {
              case 0:
                  _a = [__assign({}, output)];
                  _m = {};
                  return [4 /*yield*/, parseBody(output.body, context)];
              case 1:
                  parsedOutput = __assign.apply(void 0, _a.concat([(_m.body = _o.sent(), _m)]));
                  errorCode = "UnknownError";
                  errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
                  _b = errorCode;
                  switch (_b) {
                      case "EmptyUploadException": return [3 /*break*/, 2];
                      case "com.amazonaws.ecr#EmptyUploadException": return [3 /*break*/, 2];
                      case "InvalidLayerException": return [3 /*break*/, 4];
                      case "com.amazonaws.ecr#InvalidLayerException": return [3 /*break*/, 4];
                      case "InvalidParameterException": return [3 /*break*/, 6];
                      case "com.amazonaws.ecr#InvalidParameterException": return [3 /*break*/, 6];
                      case "KmsException": return [3 /*break*/, 8];
                      case "com.amazonaws.ecr#KmsException": return [3 /*break*/, 8];
                      case "LayerAlreadyExistsException": return [3 /*break*/, 10];
                      case "com.amazonaws.ecr#LayerAlreadyExistsException": return [3 /*break*/, 10];
                      case "LayerPartTooSmallException": return [3 /*break*/, 12];
                      case "com.amazonaws.ecr#LayerPartTooSmallException": return [3 /*break*/, 12];
                      case "RepositoryNotFoundException": return [3 /*break*/, 14];
                      case "com.amazonaws.ecr#RepositoryNotFoundException": return [3 /*break*/, 14];
                      case "ServerException": return [3 /*break*/, 16];
                      case "com.amazonaws.ecr#ServerException": return [3 /*break*/, 16];
                      case "UploadNotFoundException": return [3 /*break*/, 18];
                      case "com.amazonaws.ecr#UploadNotFoundException": return [3 /*break*/, 18];
                  }
                  return [3 /*break*/, 20];
              case 2:
                  _c = [{}];
                  return [4 /*yield*/, deserializeAws_json1_1EmptyUploadExceptionResponse(parsedOutput, context)];
              case 3:
                  response = __assign.apply(void 0, [__assign.apply(void 0, _c.concat([(_o.sent())])), { name: errorCode, $metadata: deserializeMetadata(output) }]);
                  return [3 /*break*/, 21];
              case 4:
                  _d = [{}];
                  return [4 /*yield*/, deserializeAws_json1_1InvalidLayerExceptionResponse(parsedOutput, context)];
              case 5:
                  response = __assign.apply(void 0, [__assign.apply(void 0, _d.concat([(_o.sent())])), { name: errorCode, $metadata: deserializeMetadata(output) }]);
                  return [3 /*break*/, 21];
              case 6:
                  _e = [{}];
                  return [4 /*yield*/, deserializeAws_json1_1InvalidParameterExceptionResponse(parsedOutput, context)];
              case 7:
                  response = __assign.apply(void 0, [__assign.apply(void 0, _e.concat([(_o.sent())])), { name: errorCode, $metadata: deserializeMetadata(output) }]);
                  return [3 /*break*/, 21];
              case 8:
                  _f = [{}];
                  return [4 /*yield*/, deserializeAws_json1_1KmsExceptionResponse(parsedOutput, context)];
              case 9:
                  response = __assign.apply(void 0, [__assign.apply(void 0, _f.concat([(_o.sent())])), { name: errorCode, $metadata: deserializeMetadata(output) }]);
                  return [3 /*break*/, 21];
              case 10:
                  _g = [{}];
                  return [4 /*yield*/, deserializeAws_json1_1LayerAlreadyExistsExceptionResponse(parsedOutput, context)];
              case 11:
                  response = __assign.apply(void 0, [__assign.apply(void 0, _g.concat([(_o.sent())])), { name: errorCode, $metadata: deserializeMetadata(output) }]);
                  return [3 /*break*/, 21];
              case 12:
                  _h = [{}];
                  return [4 /*yield*/, deserializeAws_json1_1LayerPartTooSmallExceptionResponse(parsedOutput, context)];
              case 13:
                  response = __assign.apply(void 0, [__assign.apply(void 0, _h.concat([(_o.sent())])), { name: errorCode, $metadata: deserializeMetadata(output) }]);
                  return [3 /*break*/, 21];
              case 14:
                  _j = [{}];
                  return [4 /*yield*/, deserializeAws_json1_1RepositoryNotFoundExceptionResponse(parsedOutput, context)];
              case 15:
                  response = __assign.apply(void 0, [__assign.apply(void 0, _j.concat([(_o.sent())])), { name: errorCode, $metadata: deserializeMetadata(output) }]);
                  return [3 /*break*/, 21];
              case 16:
                  _k = [{}];
                  return [4 /*yield*/, deserializeAws_json1_1ServerExceptionResponse(parsedOutput, context)];
              case 17:
                  response = __assign.apply(void 0, [__assign.apply(void 0, _k.concat([(_o.sent())])), { name: errorCode, $metadata: deserializeMetadata(output) }]);
                  return [3 /*break*/, 21];
              case 18:
                  _l = [{}];
                  return [4 /*yield*/, deserializeAws_json1_1UploadNotFoundExceptionResponse(parsedOutput, context)];
              case 19:
                  response = __assign.apply(void 0, [__assign.apply(void 0, _l.concat([(_o.sent())])), { name: errorCode, $metadata: deserializeMetadata(output) }]);
                  return [3 /*break*/, 21];
              case 20:
                  parsedBody = parsedOutput.body;
                  errorCode = parsedBody.code || parsedBody.Code || errorCode;
                  response = __assign(__assign({}, parsedBody), { name: "" + errorCode, message: parsedBody.message || parsedBody.Message || errorCode, $fault: "client", $metadata: deserializeMetadata(output) });
                  _o.label = 21;
              case 21:
                  message = response.message || response.Message || errorCode;
                  response.message = message;
                  delete response.Message;
                  return [2 /*return*/, Promise.reject(Object.assign(new Error(message), response))];
          }
      });
  }); };
  export var deserializeAws_json1_1CreateRepositoryCommand = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
      var data, contents, response;
      return __generator(this, function (_a) {
          switch (_a.label) {
              case 0:
                  if (output.statusCode >= 300) {
                      return [2 /*return*/, deserializeAws_json1_1CreateRepositoryCommandError(output, context)];
                  }
                  return [4 /*yield*/, parseBody(output.body, context)];
              case 1:
                  data = _a.sent();
                  contents = {};
                  contents = deserializeAws_json1_1CreateRepositoryResponse(data, context);
                  response = __assign({ $metadata: deserializeMetadata(output) }, contents);
                  return [2 /*return*/, Promise.resolve(response)];
          }
      });
  }); };
  var deserializeAws_json1_1CreateRepositoryCommandError = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
      var parsedOutput, _a, response, errorCode, _b, _c, _d, _e, _f, _g, _h, _j, parsedBody, message;
      var _k;
      return __generator(this, function (_l) {
          switch (_l.label) {
              case 0:
                  _a = [__assign({}, output)];
                  _k = {};
                  return [4 /*yield*/, parseBody(output.body, context)];
              case 1:
                  parsedOutput = __assign.apply(void 0, _a.concat([(_k.body = _l.sent(), _k)]));
                  errorCode = "UnknownError";
                  errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
                  _b = errorCode;
                  switch (_b) {
                      case "InvalidParameterException": return [3 /*break*/, 2];
                      case "com.amazonaws.ecr#InvalidParameterException": return [3 /*break*/, 2];
                      case "InvalidTagParameterException": return [3 /*break*/, 4];
                      case "com.amazonaws.ecr#InvalidTagParameterException": return [3 /*break*/, 4];
                      case "KmsException": return [3 /*break*/, 6];
                      case "com.amazonaws.ecr#KmsException": return [3 /*break*/, 6];
                      case "LimitExceededException": return [3 /*break*/, 8];
                      case "com.amazonaws.ecr#LimitExceededException": return [3 /*break*/, 8];
                      case "RepositoryAlreadyExistsException": return [3 /*break*/, 10];
                      case "com.amazonaws.ecr#RepositoryAlreadyExistsException": return [3 /*break*/, 10];
                      case "ServerException": return [3 /*break*/, 12];
                      case "com.amazonaws.ecr#ServerException": return [3 /*break*/, 12];
                      case "TooManyTagsException": return [3 /*break*/, 14];
                      case "com.amazonaws.ecr#TooManyTagsException": return [3 /*break*/, 14];
                  }
                  return [3 /*break*/, 16];
              case 2:
                  _c = [{}];
                  return [4 /*yield*/, deserializeAws_json1_1InvalidParameterExceptionResponse(parsedOutput, context)];
              case 3:
                  response = __assign.apply(void 0, [__assign.apply(void 0, _c.concat([(_l.sent())])), { name: errorCode, $metadata: deserializeMetadata(output) }]);
                  return [3 /*break*/, 17];
              case 4:
                  _d = [{}];
                  return [4 /*yield*/, deserializeAws_json1_1InvalidTagParameterExceptionResponse(parsedOutput, context)];
              case 5:
                  response = __assign.apply(void 0, [__assign.apply(void 0, _d.concat([(_l.sent())])), { name: errorCode, $metadata: deserializeMetadata(output) }]);
                  return [3 /*break*/, 17];
              case 6:
                  _e = [{}];
                  return [4 /*yield*/, deserializeAws_json1_1KmsExceptionResponse(parsedOutput, context)];
              case 7:
                  response = __assign.apply(void 0, [__assign.apply(void 0, _e.concat([(_l.sent())])), { name: errorCode, $metadata: deserializeMetadata(output) }]);
                  return [3 /*break*/, 17];
              case 8:
                  _f = [{}];
                  return [4 /*yield*/, deserializeAws_json1_1LimitExceededExceptionResponse(parsedOutput, context)];
              case 9:
                  response = __assign.apply(void 0, [__assign.apply(void 0, _f.concat([(_l.sent())])), { name: errorCode, $metadata: deserializeMetadata(output) }]);
                  return [3 /*break*/, 17];
              case 10:
                  _g = [{}];
                  return [4 /*yield*/, deserializeAws_json1_1RepositoryAlreadyExistsExceptionResponse(parsedOutput, context)];
              case 11:
                  response = __assign.apply(void 0, [__assign.apply(void 0, _g.concat([(_l.sent())])), { name: errorCode, $metadata: deserializeMetadata(output) }]);
                  return [3 /*break*/, 17];
              case 12:
                  _h = [{}];
                  return [4 /*yield*/, deserializeAws_json1_1ServerExceptionResponse(parsedOutput, context)];
              case 13:
                  response = __assign.apply(void 0, [__assign.apply(void 0, _h.concat([(_l.sent())])), { name: errorCode, $metadata: deserializeMetadata(output) }]);
                  return [3 /*break*/, 17];
              case 14:
                  _j = [{}];
                  return [4 /*yield*/, deserializeAws_json1_1TooManyTagsExceptionResponse(parsedOutput, context)];
              case 15:
                  response = __assign.apply(void 0, [__assign.apply(void 0, _j.concat([(_l.sent())])), { name: errorCode, $metadata: deserializeMetadata(output) }]);
                  return [3 /*break*/, 17];
              case 16:
                  parsedBody = parsedOutput.body;
                  errorCode = parsedBody.code || parsedBody.Code || errorCode;
                  response = __assign(__assign({}, parsedBody), { name: "" + errorCode, message: parsedBody.message || parsedBody.Message || errorCode, $fault: "client", $metadata: deserializeMetadata(output) });
                  _l.label = 17;
              case 17:
                  message = response.message || response.Message || errorCode;
                  response.message = message;
                  delete response.Message;
                  return [2 /*return*/, Promise.reject(Object.assign(new Error(message), response))];
          }
      });
  }); };
  export var deserializeAws_json1_1DeleteLifecyclePolicyCommand = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
      var data, contents, response;
      return __generator(this, function (_a) {
          switch (_a.label) {
              case 0:
                  if (output.statusCode >= 300) {
                      return [2 /*return*/, deserializeAws_json1_1DeleteLifecyclePolicyCommandError(output, context)];
                  }
                  return [4 /*yield*/, parseBody(output.body, context)];
              case 1:
                  data = _a.sent();
                  contents = {};
                  contents = deserializeAws_json1_1DeleteLifecyclePolicyResponse(data, context);
                  response = __assign({ $metadata: deserializeMetadata(output) }, contents);
                  return [2 /*return*/, Promise.resolve(response)];
          }
      });
  }); };
  var deserializeAws_json1_1DeleteLifecyclePolicyCommandError = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
      var parsedOutput, _a, response, errorCode, _b, _c, _d, _e, _f, parsedBody, message;
      var _g;
      return __generator(this, function (_h) {
          switch (_h.label) {
              case 0:
                  _a = [__assign({}, output)];
                  _g = {};
                  return [4 /*yield*/, parseBody(output.body, context)];
              case 1:
                  parsedOutput = __assign.apply(void 0, _a.concat([(_g.body = _h.sent(), _g)]));
                  errorCode = "UnknownError";
                  errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
                  _b = errorCode;
                  switch (_b) {
                      case "InvalidParameterException": return [3 /*break*/, 2];
                      case "com.amazonaws.ecr#InvalidParameterException": return [3 /*break*/, 2];
                      case "LifecyclePolicyNotFoundException": return [3 /*break*/, 4];
                      case "com.amazonaws.ecr#LifecyclePolicyNotFoundException": return [3 /*break*/, 4];
                      case "RepositoryNotFoundException": return [3 /*break*/, 6];
                      case "com.amazonaws.ecr#RepositoryNotFoundException": return [3 /*break*/, 6];
                      case "ServerException": return [3 /*break*/, 8];
                      case "com.amazonaws.ecr#ServerException": return [3 /*break*/, 8];
                  }
                  return [3 /*break*/, 10];
              case 2:
                  _c = [{}];
                  return [4 /*yield*/, deserializeAws_json1_1InvalidParameterExceptionResponse(parsedOutput, context)];
              case 3:
                  response = __assign.apply(void 0, [__assign.apply(void 0, _c.concat([(_h.sent())])), { name: errorCode, $metadata: deserializeMetadata(output) }]);
                  return [3 /*break*/, 11];
              case 4:
                  _d = [{}];
                  return [4 /*yield*/, deserializeAws_json1_1LifecyclePolicyNotFoundExceptionResponse(parsedOutput, context)];
              case 5:
                  response = __assign.apply(void 0, [__assign.apply(void 0, _d.concat([(_h.sent())])), { name: errorCode, $metadata: deserializeMetadata(output) }]);
                  return [3 /*break*/, 11];
              case 6:
                  _e = [{}];
                  return [4 /*yield*/, deserializeAws_json1_1RepositoryNotFoundExceptionResponse(parsedOutput, context)];
              case 7:
                  response = __assign.apply(void 0, [__assign.apply(void 0, _e.concat([(_h.sent())])), { name: errorCode, $metadata: deserializeMetadata(output) }]);
                  return [3 /*break*/, 11];
              case 8:
                  _f = [{}];
                  return [4 /*yield*/, deserializeAws_json1_1ServerExceptionResponse(parsedOutput, context)];
              case 9:
                  response = __assign.apply(void 0, [__assign.apply(void 0, _f.concat([(_h.sent())])), { name: errorCode, $metadata: deserializeMetadata(output) }]);
                  return [3 /*break*/, 11];
              case 10:
                  parsedBody = parsedOutput.body;
                  errorCode = parsedBody.code || parsedBody.Code || errorCode;
                  response = __assign(__assign({}, parsedBody), { name: "" + errorCode, message: parsedBody.message || parsedBody.Message || errorCode, $fault: "client", $metadata: deserializeMetadata(output) });
                  _h.label = 11;
              case 11:
                  message = response.message || response.Message || errorCode;
                  response.message = message;
                  delete response.Message;
                  return [2 /*return*/, Promise.reject(Object.assign(new Error(message), response))];
          }
      });
  }); };
  export var deserializeAws_json1_1DeleteRegistryPolicyCommand = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
      var data, contents, response;
      return __generator(this, function (_a) {
          switch (_a.label) {
              case 0:
                  if (output.statusCode >= 300) {
                      return [2 /*return*/, deserializeAws_json1_1DeleteRegistryPolicyCommandError(output, context)];
                  }
                  return [4 /*yield*/, parseBody(output.body, context)];
              case 1:
                  data = _a.sent();
                  contents = {};
                  contents = deserializeAws_json1_1DeleteRegistryPolicyResponse(data, context);
                  response = __assign({ $metadata: deserializeMetadata(output) }, contents);
                  return [2 /*return*/, Promise.resolve(response)];
          }
      });
  }); };
  var deserializeAws_json1_1DeleteRegistryPolicyCommandError = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
      var parsedOutput, _a, response, errorCode, _b, _c, _d, _e, parsedBody, message;
      var _f;
      return __generator(this, function (_g) {
          switch (_g.label) {
              case 0:
                  _a = [__assign({}, output)];
                  _f = {};
                  return [4 /*yield*/, parseBody(output.body, context)];
              case 1:
                  parsedOutput = __assign.apply(void 0, _a.concat([(_f.body = _g.sent(), _f)]));
                  errorCode = "UnknownError";
                  errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
                  _b = errorCode;
                  switch (_b) {
                      case "InvalidParameterException": return [3 /*break*/, 2];
                      case "com.amazonaws.ecr#InvalidParameterException": return [3 /*break*/, 2];
                      case "RegistryPolicyNotFoundException": return [3 /*break*/, 4];
                      case "com.amazonaws.ecr#RegistryPolicyNotFoundException": return [3 /*break*/, 4];
                      case "ServerException": return [3 /*break*/, 6];
                      case "com.amazonaws.ecr#ServerException": return [3 /*break*/, 6];
                  }
                  return [3 /*break*/, 8];
              case 2:
                  _c = [{}];
                  return [4 /*yield*/, deserializeAws_json1_1InvalidParameterExceptionResponse(parsedOutput, context)];
              case 3:
                  response = __assign.apply(void 0, [__assign.apply(void 0, _c.concat([(_g.sent())])), { name: errorCode, $metadata: deserializeMetadata(output) }]);
                  return [3 /*break*/, 9];
              case 4:
                  _d = [{}];
                  return [4 /*yield*/, deserializeAws_json1_1RegistryPolicyNotFoundExceptionResponse(parsedOutput, context)];
              case 5:
                  response = __assign.apply(void 0, [__assign.apply(void 0, _d.concat([(_g.sent())])), { name: errorCode, $metadata: deserializeMetadata(output) }]);
                  return [3 /*break*/, 9];
              case 6:
                  _e = [{}];
                  return [4 /*yield*/, deserializeAws_json1_1ServerExceptionResponse(parsedOutput, context)];
              case 7:
                  response = __assign.apply(void 0, [__assign.apply(void 0, _e.concat([(_g.sent())])), { name: errorCode, $metadata: deserializeMetadata(output) }]);
                  return [3 /*break*/, 9];
              case 8:
                  parsedBody = parsedOutput.body;
                  errorCode = parsedBody.code || parsedBody.Code || errorCode;
                  response = __assign(__assign({}, parsedBody), { name: "" + errorCode, message: parsedBody.message || parsedBody.Message || errorCode, $fault: "client", $metadata: deserializeMetadata(output) });
                  _g.label = 9;
              case 9:
                  message = response.message || response.Message || errorCode;
                  response.message = message;
                  delete response.Message;
                  return [2 /*return*/, Promise.reject(Object.assign(new Error(message), response))];
          }
      });
  }); };
  export var deserializeAws_json1_1DeleteRepositoryCommand = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
      var data, contents, response;
      return __generator(this, function (_a) {
          switch (_a.label) {
              case 0:
                  if (output.statusCode >= 300) {
                      return [2 /*return*/, deserializeAws_json1_1DeleteRepositoryCommandError(output, context)];
                  }
                  return [4 /*yield*/, parseBody(output.body, context)];
              case 1:
                  data = _a.sent();
                  contents = {};
                  contents = deserializeAws_json1_1DeleteRepositoryResponse(data, context);
                  response = __assign({ $metadata: deserializeMetadata(output) }, contents);
                  return [2 /*return*/, Promise.resolve(response)];
          }
      });
  }); };
  var deserializeAws_json1_1DeleteRepositoryCommandError = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
      var parsedOutput, _a, response, errorCode, _b, _c, _d, _e, _f, _g, parsedBody, message;
      var _h;
      return __generator(this, function (_j) {
          switch (_j.label) {
              case 0:
                  _a = [__assign({}, output)];
                  _h = {};
                  return [4 /*yield*/, parseBody(output.body, context)];
              case 1:
                  parsedOutput = __assign.apply(void 0, _a.concat([(_h.body = _j.sent(), _h)]));
                  errorCode = "UnknownError";
                  errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
                  _b = errorCode;
                  switch (_b) {
                      case "InvalidParameterException": return [3 /*break*/, 2];
                      case "com.amazonaws.ecr#InvalidParameterException": return [3 /*break*/, 2];
                      case "KmsException": return [3 /*break*/, 4];
                      case "com.amazonaws.ecr#KmsException": return [3 /*break*/, 4];
                      case "RepositoryNotEmptyException": return [3 /*break*/, 6];
                      case "com.amazonaws.ecr#RepositoryNotEmptyException": return [3 /*break*/, 6];
                      case "RepositoryNotFoundException": return [3 /*break*/, 8];
                      case "com.amazonaws.ecr#RepositoryNotFoundException": return [3 /*break*/, 8];
                      case "ServerException": return [3 /*break*/, 10];
                      case "com.amazonaws.ecr#ServerException": return [3 /*break*/, 10];
                  }
                  return [3 /*break*/, 12];
              case 2:
                  _c = [{}];
                  return [4 /*yield*/, deserializeAws_json1_1InvalidParameterExceptionResponse(parsedOutput, context)];
              case 3:
                  response = __assign.apply(void 0, [__assign.apply(void 0, _c.concat([(_j.sent())])), { name: errorCode, $metadata: deserializeMetadata(output) }]);
                  return [3 /*break*/, 13];
              case 4:
                  _d = [{}];
                  return [4 /*yield*/, deserializeAws_json1_1KmsExceptionResponse(parsedOutput, context)];
              case 5:
                  response = __assign.apply(void 0, [__assign.apply(void 0, _d.concat([(_j.sent())])), { name: errorCode, $metadata: deserializeMetadata(output) }]);
                  return [3 /*break*/, 13];
              case 6:
                  _e = [{}];
                  return [4 /*yield*/, deserializeAws_json1_1RepositoryNotEmptyExceptionResponse(parsedOutput, context)];
              case 7:
                  response = __assign.apply(void 0, [__assign.apply(void 0, _e.concat([(_j.sent())])), { name: errorCode, $metadata: deserializeMetadata(output) }]);
                  return [3 /*break*/, 13];
              case 8:
                  _f = [{}];
                  return [4 /*yield*/, deserializeAws_json1_1RepositoryNotFoundExceptionResponse(parsedOutput, context)];
              case 9:
                  response = __assign.apply(void 0, [__assign.apply(void 0, _f.concat([(_j.sent())])), { name: errorCode, $metadata: deserializeMetadata(output) }]);
                  return [3 /*break*/, 13];
              case 10:
                  _g = [{}];
                  return [4 /*yield*/, deserializeAws_json1_1ServerExceptionResponse(parsedOutput, context)];
              case 11:
                  response = __assign.apply(void 0, [__assign.apply(void 0, _g.concat([(_j.sent())])), { name: errorCode, $metadata: deserializeMetadata(output) }]);
                  return [3 /*break*/, 13];
              case 12:
                  parsedBody = parsedOutput.body;
                  errorCode = parsedBody.code || parsedBody.Code || errorCode;
                  response = __assign(__assign({}, parsedBody), { name: "" + errorCode, message: parsedBody.message || parsedBody.Message || errorCode, $fault: "client", $metadata: deserializeMetadata(output) });
                  _j.label = 13;
              case 13:
                  message = response.message || response.Message || errorCode;
                  response.message = message;
                  delete response.Message;
                  return [2 /*return*/, Promise.reject(Object.assign(new Error(message), response))];
          }
      });
  }); };
  export var deserializeAws_json1_1DeleteRepositoryPolicyCommand = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
      var data, contents, response;
      return __generator(this, function (_a) {
          switch (_a.label) {
              case 0:
                  if (output.statusCode >= 300) {
                      return [2 /*return*/, deserializeAws_json1_1DeleteRepositoryPolicyCommandError(output, context)];
                  }
                  return [4 /*yield*/, parseBody(output.body, context)];
              case 1:
                  data = _a.sent();
                  contents = {};
                  contents = deserializeAws_json1_1DeleteRepositoryPolicyResponse(data, context);
                  response = __assign({ $metadata: deserializeMetadata(output) }, contents);
                  return [2 /*return*/, Promise.resolve(response)];
          }
      });
  }); };
  var deserializeAws_json1_1DeleteRepositoryPolicyCommandError = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
      var parsedOutput, _a, response, errorCode, _b, _c, _d, _e, _f, parsedBody, message;
      var _g;
      return __generator(this, function (_h) {
          switch (_h.label) {
              case 0:
                  _a = [__assign({}, output)];
                  _g = {};
                  return [4 /*yield*/, parseBody(output.body, context)];
              case 1:
                  parsedOutput = __assign.apply(void 0, _a.concat([(_g.body = _h.sent(), _g)]));
                  errorCode = "UnknownError";
                  errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
                  _b = errorCode;
                  switch (_b) {
                      case "InvalidParameterException": return [3 /*break*/, 2];
                      case "com.amazonaws.ecr#InvalidParameterException": return [3 /*break*/, 2];
                      case "RepositoryNotFoundException": return [3 /*break*/, 4];
                      case "com.amazonaws.ecr#RepositoryNotFoundException": return [3 /*break*/, 4];
                      case "RepositoryPolicyNotFoundException": return [3 /*break*/, 6];
                      case "com.amazonaws.ecr#RepositoryPolicyNotFoundException": return [3 /*break*/, 6];
                      case "ServerException": return [3 /*break*/, 8];
                      case "com.amazonaws.ecr#ServerException": return [3 /*break*/, 8];
                  }
                  return [3 /*break*/, 10];
              case 2:
                  _c = [{}];
                  return [4 /*yield*/, deserializeAws_json1_1InvalidParameterExceptionResponse(parsedOutput, context)];
              case 3:
                  response = __assign.apply(void 0, [__assign.apply(void 0, _c.concat([(_h.sent())])), { name: errorCode, $metadata: deserializeMetadata(output) }]);
                  return [3 /*break*/, 11];
              case 4:
                  _d = [{}];
                  return [4 /*yield*/, deserializeAws_json1_1RepositoryNotFoundExceptionResponse(parsedOutput, context)];
              case 5:
                  response = __assign.apply(void 0, [__assign.apply(void 0, _d.concat([(_h.sent())])), { name: errorCode, $metadata: deserializeMetadata(output) }]);
                  return [3 /*break*/, 11];
              case 6:
                  _e = [{}];
                  return [4 /*yield*/, deserializeAws_json1_1RepositoryPolicyNotFoundExceptionResponse(parsedOutput, context)];
              case 7:
                  response = __assign.apply(void 0, [__assign.apply(void 0, _e.concat([(_h.sent())])), { name: errorCode, $metadata: deserializeMetadata(output) }]);
                  return [3 /*break*/, 11];
              case 8:
                  _f = [{}];
                  return [4 /*yield*/, deserializeAws_json1_1ServerExceptionResponse(parsedOutput, context)];
              case 9:
                  response = __assign.apply(void 0, [__assign.apply(void 0, _f.concat([(_h.sent())])), { name: errorCode, $metadata: deserializeMetadata(output) }]);
                  return [3 /*break*/, 11];
              case 10:
                  parsedBody = parsedOutput.body;
                  errorCode = parsedBody.code || parsedBody.Code || errorCode;
                  response = __assign(__assign({}, parsedBody), { name: "" + errorCode, message: parsedBody.message || parsedBody.Message || errorCode, $fault: "client", $metadata: deserializeMetadata(output) });
                  _h.label = 11;
              case 11:
                  message = response.message || response.Message || errorCode;
                  response.message = message;
                  delete response.Message;
                  return [2 /*return*/, Promise.reject(Object.assign(new Error(message), response))];
          }
      });
  }); };
  export var deserializeAws_json1_1DescribeImagesCommand = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
      var data, contents, response;
      return __generator(this, function (_a) {
          switch (_a.label) {
              case 0:
                  if (output.statusCode >= 300) {
                      return [2 /*return*/, deserializeAws_json1_1DescribeImagesCommandError(output, context)];
                  }
                  return [4 /*yield*/, parseBody(output.body, context)];
              case 1:
                  data = _a.sent();
                  contents = {};
                  contents = deserializeAws_json1_1DescribeImagesResponse(data, context);
                  response = __assign({ $metadata: deserializeMetadata(output) }, contents);
                  return [2 /*return*/, Promise.resolve(response)];
          }
      });
  }); };
  var deserializeAws_json1_1DescribeImagesCommandError = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
      var parsedOutput, _a, response, errorCode, _b, _c, _d, _e, _f, parsedBody, message;
      var _g;
      return __generator(this, function (_h) {
          switch (_h.label) {
              case 0:
                  _a = [__assign({}, output)];
                  _g = {};
                  return [4 /*yield*/, parseBody(output.body, context)];
              case 1:
                  parsedOutput = __assign.apply(void 0, _a.concat([(_g.body = _h.sent(), _g)]));
                  errorCode = "UnknownError";
                  errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
                  _b = errorCode;
                  switch (_b) {
                      case "ImageNotFoundException": return [3 /*break*/, 2];
                      case "com.amazonaws.ecr#ImageNotFoundException": return [3 /*break*/, 2];
                      case "InvalidParameterException": return [3 /*break*/, 4];
                      case "com.amazonaws.ecr#InvalidParameterException": return [3 /*break*/, 4];
                      case "RepositoryNotFoundException": return [3 /*break*/, 6];
                      case "com.amazonaws.ecr#RepositoryNotFoundException": return [3 /*break*/, 6];
                      case "ServerException": return [3 /*break*/, 8];
                      case "com.amazonaws.ecr#ServerException": return [3 /*break*/, 8];
                  }
                  return [3 /*break*/, 10];
              case 2:
                  _c = [{}];
                  return [4 /*yield*/, deserializeAws_json1_1ImageNotFoundExceptionResponse(parsedOutput, context)];
              case 3:
                  response = __assign.apply(void 0, [__assign.apply(void 0, _c.concat([(_h.sent())])), { name: errorCode, $metadata: deserializeMetadata(output) }]);
                  return [3 /*break*/, 11];
              case 4:
                  _d = [{}];
                  return [4 /*yield*/, deserializeAws_json1_1InvalidParameterExceptionResponse(parsedOutput, context)];
              case 5:
                  response = __assign.apply(void 0, [__assign.apply(void 0, _d.concat([(_h.sent())])), { name: errorCode, $metadata: deserializeMetadata(output) }]);
                  return [3 /*break*/, 11];
              case 6:
                  _e = [{}];
                  return [4 /*yield*/, deserializeAws_json1_1RepositoryNotFoundExceptionResponse(parsedOutput, context)];
              case 7:
                  response = __assign.apply(void 0, [__assign.apply(void 0, _e.concat([(_h.sent())])), { name: errorCode, $metadata: deserializeMetadata(output) }]);
                  return [3 /*break*/, 11];
              case 8:
                  _f = [{}];
                  return [4 /*yield*/, deserializeAws_json1_1ServerExceptionResponse(parsedOutput, context)];
              case 9:
                  response = __assign.apply(void 0, [__assign.apply(void 0, _f.concat([(_h.sent())])), { name: errorCode, $metadata: deserializeMetadata(output) }]);
                  return [3 /*break*/, 11];
              case 10:
                  parsedBody = parsedOutput.body;
                  errorCode = parsedBody.code || parsedBody.Code || errorCode;
                  response = __assign(__assign({}, parsedBody), { name: "" + errorCode, message: parsedBody.message || parsedBody.Message || errorCode, $fault: "client", $metadata: deserializeMetadata(output) });
                  _h.label = 11;
              case 11:
                  message = response.message || response.Message || errorCode;
                  response.message = message;
                  delete response.Message;
                  return [2 /*return*/, Promise.reject(Object.assign(new Error(message), response))];
          }
      });
  }); };
  export var deserializeAws_json1_1DescribeImageScanFindingsCommand = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
      var data, contents, response;
      return __generator(this, function (_a) {
          switch (_a.label) {
              case 0:
                  if (output.statusCode >= 300) {
                      return [2 /*return*/, deserializeAws_json1_1DescribeImageScanFindingsCommandError(output, context)];
                  }
                  return [4 /*yield*/, parseBody(output.body, context)];
              case 1:
                  data = _a.sent();
                  contents = {};
                  contents = deserializeAws_json1_1DescribeImageScanFindingsResponse(data, context);
                  response = __assign({ $metadata: deserializeMetadata(output) }, contents);
                  return [2 /*return*/, Promise.resolve(response)];
          }
      });
  }); };
  var deserializeAws_json1_1DescribeImageScanFindingsCommandError = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
      var parsedOutput, _a, response, errorCode, _b, _c, _d, _e, _f, _g, parsedBody, message;
      var _h;
      return __generator(this, function (_j) {
          switch (_j.label) {
              case 0:
                  _a = [__assign({}, output)];
                  _h = {};
                  return [4 /*yield*/, parseBody(output.body, context)];
              case 1:
                  parsedOutput = __assign.apply(void 0, _a.concat([(_h.body = _j.sent(), _h)]));
                  errorCode = "UnknownError";
                  errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
                  _b = errorCode;
                  switch (_b) {
                      case "ImageNotFoundException": return [3 /*break*/, 2];
                      case "com.amazonaws.ecr#ImageNotFoundException": return [3 /*break*/, 2];
                      case "InvalidParameterException": return [3 /*break*/, 4];
                      case "com.amazonaws.ecr#InvalidParameterException": return [3 /*break*/, 4];
                      case "RepositoryNotFoundException": return [3 /*break*/, 6];
                      case "com.amazonaws.ecr#RepositoryNotFoundException": return [3 /*break*/, 6];
                      case "ScanNotFoundException": return [3 /*break*/, 8];
                      case "com.amazonaws.ecr#ScanNotFoundException": return [3 /*break*/, 8];
                      case "ServerException": return [3 /*break*/, 10];
                      case "com.amazonaws.ecr#ServerException": return [3 /*break*/, 10];
                  }
                  return [3 /*break*/, 12];
              case 2:
                  _c = [{}];
                  return [4 /*yield*/, deserializeAws_json1_1ImageNotFoundExceptionResponse(parsedOutput, context)];
              case 3:
                  response = __assign.apply(void 0, [__assign.apply(void 0, _c.concat([(_j.sent())])), { name: errorCode, $metadata: deserializeMetadata(output) }]);
                  return [3 /*break*/, 13];
              case 4:
                  _d = [{}];
                  return [4 /*yield*/, deserializeAws_json1_1InvalidParameterExceptionResponse(parsedOutput, context)];
              case 5:
                  response = __assign.apply(void 0, [__assign.apply(void 0, _d.concat([(_j.sent())])), { name: errorCode, $metadata: deserializeMetadata(output) }]);
                  return [3 /*break*/, 13];
              case 6:
                  _e = [{}];
                  return [4 /*yield*/, deserializeAws_json1_1RepositoryNotFoundExceptionResponse(parsedOutput, context)];
              case 7:
                  response = __assign.apply(void 0, [__assign.apply(void 0, _e.concat([(_j.sent())])), { name: errorCode, $metadata: deserializeMetadata(output) }]);
                  return [3 /*break*/, 13];
              case 8:
                  _f = [{}];
                  return [4 /*yield*/, deserializeAws_json1_1ScanNotFoundExceptionResponse(parsedOutput, context)];
              case 9:
                  response = __assign.apply(void 0, [__assign.apply(void 0, _f.concat([(_j.sent())])), { name: errorCode, $metadata: deserializeMetadata(output) }]);
                  return [3 /*break*/, 13];
              case 10:
                  _g = [{}];
                  return [4 /*yield*/, deserializeAws_json1_1ServerExceptionResponse(parsedOutput, context)];
              case 11:
                  response = __assign.apply(void 0, [__assign.apply(void 0, _g.concat([(_j.sent())])), { name: errorCode, $metadata: deserializeMetadata(output) }]);
                  return [3 /*break*/, 13];
              case 12:
                  parsedBody = parsedOutput.body;
                  errorCode = parsedBody.code || parsedBody.Code || errorCode;
                  response = __assign(__assign({}, parsedBody), { name: "" + errorCode, message: parsedBody.message || parsedBody.Message || errorCode, $fault: "client", $metadata: deserializeMetadata(output) });
                  _j.label = 13;
              case 13:
                  message = response.message || response.Message || errorCode;
                  response.message = message;
                  delete response.Message;
                  return [2 /*return*/, Promise.reject(Object.assign(new Error(message), response))];
          }
      });
  }); };
  export var deserializeAws_json1_1DescribeRegistryCommand = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
      var data, contents, response;
      return __generator(this, function (_a) {
          switch (_a.label) {
              case 0:
                  if (output.statusCode >= 300) {
                      return [2 /*return*/, deserializeAws_json1_1DescribeRegistryCommandError(output, context)];
                  }
                  return [4 /*yield*/, parseBody(output.body, context)];
              case 1:
                  data = _a.sent();
                  contents = {};
                  contents = deserializeAws_json1_1DescribeRegistryResponse(data, context);
                  response = __assign({ $metadata: deserializeMetadata(output) }, contents);
                  return [2 /*return*/, Promise.resolve(response)];
          }
      });
  }); };
  var deserializeAws_json1_1DescribeRegistryCommandError = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
      var parsedOutput, _a, response, errorCode, _b, _c, _d, _e, parsedBody, message;
      var _f;
      return __generator(this, function (_g) {
          switch (_g.label) {
              case 0:
                  _a = [__assign({}, output)];
                  _f = {};
                  return [4 /*yield*/, parseBody(output.body, context)];
              case 1:
                  parsedOutput = __assign.apply(void 0, _a.concat([(_f.body = _g.sent(), _f)]));
                  errorCode = "UnknownError";
                  errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
                  _b = errorCode;
                  switch (_b) {
                      case "InvalidParameterException": return [3 /*break*/, 2];
                      case "com.amazonaws.ecr#InvalidParameterException": return [3 /*break*/, 2];
                      case "ServerException": return [3 /*break*/, 4];
                      case "com.amazonaws.ecr#ServerException": return [3 /*break*/, 4];
                      case "ValidationException": return [3 /*break*/, 6];
                      case "com.amazonaws.ecr#ValidationException": return [3 /*break*/, 6];
                  }
                  return [3 /*break*/, 8];
              case 2:
                  _c = [{}];
                  return [4 /*yield*/, deserializeAws_json1_1InvalidParameterExceptionResponse(parsedOutput, context)];
              case 3:
                  response = __assign.apply(void 0, [__assign.apply(void 0, _c.concat([(_g.sent())])), { name: errorCode, $metadata: deserializeMetadata(output) }]);
                  return [3 /*break*/, 9];
              case 4:
                  _d = [{}];
                  return [4 /*yield*/, deserializeAws_json1_1ServerExceptionResponse(parsedOutput, context)];
              case 5:
                  response = __assign.apply(void 0, [__assign.apply(void 0, _d.concat([(_g.sent())])), { name: errorCode, $metadata: deserializeMetadata(output) }]);
                  return [3 /*break*/, 9];
              case 6:
                  _e = [{}];
                  return [4 /*yield*/, deserializeAws_json1_1ValidationExceptionResponse(parsedOutput, context)];
              case 7:
                  response = __assign.apply(void 0, [__assign.apply(void 0, _e.concat([(_g.sent())])), { name: errorCode, $metadata: deserializeMetadata(output) }]);
                  return [3 /*break*/, 9];
              case 8:
                  parsedBody = parsedOutput.body;
                  errorCode = parsedBody.code || parsedBody.Code || errorCode;
                  response = __assign(__assign({}, parsedBody), { name: "" + errorCode, message: parsedBody.message || parsedBody.Message || errorCode, $fault: "client", $metadata: deserializeMetadata(output) });
                  _g.label = 9;
              case 9:
                  message = response.message || response.Message || errorCode;
                  response.message = message;
                  delete response.Message;
                  return [2 /*return*/, Promise.reject(Object.assign(new Error(message), response))];
          }
      });
  }); };
  export var deserializeAws_json1_1DescribeRepositoriesCommand = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
      var data, contents, response;
      return __generator(this, function (_a) {
          switch (_a.label) {
              case 0:
                  if (output.statusCode >= 300) {
                      return [2 /*return*/, deserializeAws_json1_1DescribeRepositoriesCommandError(output, context)];
                  }
                  return [4 /*yield*/, parseBody(output.body, context)];
              case 1:
                  data = _a.sent();
                  contents = {};
                  contents = deserializeAws_json1_1DescribeRepositoriesResponse(data, context);
                  response = __assign({ $metadata: deserializeMetadata(output) }, contents);
                  return [2 /*return*/, Promise.resolve(response)];
          }
      });
  }); };
  var deserializeAws_json1_1DescribeRepositoriesCommandError = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
      var parsedOutput, _a, response, errorCode, _b, _c, _d, _e, parsedBody, message;
      var _f;
      return __generator(this, function (_g) {
          switch (_g.label) {
              case 0:
                  _a = [__assign({}, output)];
                  _f = {};
                  return [4 /*yield*/, parseBody(output.body, context)];
              case 1:
                  parsedOutput = __assign.apply(void 0, _a.concat([(_f.body = _g.sent(), _f)]));
                  errorCode = "UnknownError";
                  errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
                  _b = errorCode;
                  switch (_b) {
                      case "InvalidParameterException": return [3 /*break*/, 2];
                      case "com.amazonaws.ecr#InvalidParameterException": return [3 /*break*/, 2];
                      case "RepositoryNotFoundException": return [3 /*break*/, 4];
                      case "com.amazonaws.ecr#RepositoryNotFoundException": return [3 /*break*/, 4];
                      case "ServerException": return [3 /*break*/, 6];
                      case "com.amazonaws.ecr#ServerException": return [3 /*break*/, 6];
                  }
                  return [3 /*break*/, 8];
              case 2:
                  _c = [{}];
                  return [4 /*yield*/, deserializeAws_json1_1InvalidParameterExceptionResponse(parsedOutput, context)];
              case 3:
                  response = __assign.apply(void 0, [__assign.apply(void 0, _c.concat([(_g.sent())])), { name: errorCode, $metadata: deserializeMetadata(output) }]);
                  return [3 /*break*/, 9];
              case 4:
                  _d = [{}];
                  return [4 /*yield*/, deserializeAws_json1_1RepositoryNotFoundExceptionResponse(parsedOutput, context)];
              case 5:
                  response = __assign.apply(void 0, [__assign.apply(void 0, _d.concat([(_g.sent())])), { name: errorCode, $metadata: deserializeMetadata(output) }]);
                  return [3 /*break*/, 9];
              case 6:
                  _e = [{}];
                  return [4 /*yield*/, deserializeAws_json1_1ServerExceptionResponse(parsedOutput, context)];
              case 7:
                  response = __assign.apply(void 0, [__assign.apply(void 0, _e.concat([(_g.sent())])), { name: errorCode, $metadata: deserializeMetadata(output) }]);
                  return [3 /*break*/, 9];
              case 8:
                  parsedBody = parsedOutput.body;
                  errorCode = parsedBody.code || parsedBody.Code || errorCode;
                  response = __assign(__assign({}, parsedBody), { name: "" + errorCode, message: parsedBody.message || parsedBody.Message || errorCode, $fault: "client", $metadata: deserializeMetadata(output) });
                  _g.label = 9;
              case 9:
                  message = response.message || response.Message || errorCode;
                  response.message = message;
                  delete response.Message;
                  return [2 /*return*/, Promise.reject(Object.assign(new Error(message), response))];
          }
      });
  }); };
  export var deserializeAws_json1_1GetAuthorizationTokenCommand = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
      var data, contents, response;
      return __generator(this, function (_a) {
          switch (_a.label) {
              case 0:
                  if (output.statusCode >= 300) {
                      return [2 /*return*/, deserializeAws_json1_1GetAuthorizationTokenCommandError(output, context)];
                  }
                  return [4 /*yield*/, parseBody(output.body, context)];
              case 1:
                  data = _a.sent();
                  contents = {};
                  contents = deserializeAws_json1_1GetAuthorizationTokenResponse(data, context);
                  response = __assign({ $metadata: deserializeMetadata(output) }, contents);
                  return [2 /*return*/, Promise.resolve(response)];
          }
      });
  }); };
  var deserializeAws_json1_1GetAuthorizationTokenCommandError = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
      var parsedOutput, _a, response, errorCode, _b, _c, _d, parsedBody, message;
      var _e;
      return __generator(this, function (_f) {
          switch (_f.label) {
              case 0:
                  _a = [__assign({}, output)];
                  _e = {};
                  return [4 /*yield*/, parseBody(output.body, context)];
              case 1:
                  parsedOutput = __assign.apply(void 0, _a.concat([(_e.body = _f.sent(), _e)]));
                  errorCode = "UnknownError";
                  errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
                  _b = errorCode;
                  switch (_b) {
                      case "InvalidParameterException": return [3 /*break*/, 2];
                      case "com.amazonaws.ecr#InvalidParameterException": return [3 /*break*/, 2];
                      case "ServerException": return [3 /*break*/, 4];
                      case "com.amazonaws.ecr#ServerException": return [3 /*break*/, 4];
                  }
                  return [3 /*break*/, 6];
              case 2:
                  _c = [{}];
                  return [4 /*yield*/, deserializeAws_json1_1InvalidParameterExceptionResponse(parsedOutput, context)];
              case 3:
                  response = __assign.apply(void 0, [__assign.apply(void 0, _c.concat([(_f.sent())])), { name: errorCode, $metadata: deserializeMetadata(output) }]);
                  return [3 /*break*/, 7];
              case 4:
                  _d = [{}];
                  return [4 /*yield*/, deserializeAws_json1_1ServerExceptionResponse(parsedOutput, context)];
              case 5:
                  response = __assign.apply(void 0, [__assign.apply(void 0, _d.concat([(_f.sent())])), { name: errorCode, $metadata: deserializeMetadata(output) }]);
                  return [3 /*break*/, 7];
              case 6:
                  parsedBody = parsedOutput.body;
                  errorCode = parsedBody.code || parsedBody.Code || errorCode;
                  response = __assign(__assign({}, parsedBody), { name: "" + errorCode, message: parsedBody.message || parsedBody.Message || errorCode, $fault: "client", $metadata: deserializeMetadata(output) });
                  _f.label = 7;
              case 7:
                  message = response.message || response.Message || errorCode;
                  response.message = message;
                  delete response.Message;
                  return [2 /*return*/, Promise.reject(Object.assign(new Error(message), response))];
          }
      });
  }); };
  export var deserializeAws_json1_1GetDownloadUrlForLayerCommand = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
      var data, contents, response;
      return __generator(this, function (_a) {
          switch (_a.label) {
              case 0:
                  if (output.statusCode >= 300) {
                      return [2 /*return*/, deserializeAws_json1_1GetDownloadUrlForLayerCommandError(output, context)];
                  }
                  return [4 /*yield*/, parseBody(output.body, context)];
              case 1:
                  data = _a.sent();
                  contents = {};
                  contents = deserializeAws_json1_1GetDownloadUrlForLayerResponse(data, context);
                  response = __assign({ $metadata: deserializeMetadata(output) }, contents);
                  return [2 /*return*/, Promise.resolve(response)];
          }
      });
  }); };
  var deserializeAws_json1_1GetDownloadUrlForLayerCommandError = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
      var parsedOutput, _a, response, errorCode, _b, _c, _d, _e, _f, _g, parsedBody, message;
      var _h;
      return __generator(this, function (_j) {
          switch (_j.label) {
              case 0:
                  _a = [__assign({}, output)];
                  _h = {};
                  return [4 /*yield*/, parseBody(output.body, context)];
              case 1:
                  parsedOutput = __assign.apply(void 0, _a.concat([(_h.body = _j.sent(), _h)]));
                  errorCode = "UnknownError";
                  errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
                  _b = errorCode;
                  switch (_b) {
                      case "InvalidParameterException": return [3 /*break*/, 2];
                      case "com.amazonaws.ecr#InvalidParameterException": return [3 /*break*/, 2];
                      case "LayerInaccessibleException": return [3 /*break*/, 4];
                      case "com.amazonaws.ecr#LayerInaccessibleException": return [3 /*break*/, 4];
                      case "LayersNotFoundException": return [3 /*break*/, 6];
                      case "com.amazonaws.ecr#LayersNotFoundException": return [3 /*break*/, 6];
                      case "RepositoryNotFoundException": return [3 /*break*/, 8];
                      case "com.amazonaws.ecr#RepositoryNotFoundException": return [3 /*break*/, 8];
                      case "ServerException": return [3 /*break*/, 10];
                      case "com.amazonaws.ecr#ServerException": return [3 /*break*/, 10];
                  }
                  return [3 /*break*/, 12];
              case 2:
                  _c = [{}];
                  return [4 /*yield*/, deserializeAws_json1_1InvalidParameterExceptionResponse(parsedOutput, context)];
              case 3:
                  response = __assign.apply(void 0, [__assign.apply(void 0, _c.concat([(_j.sent())])), { name: errorCode, $metadata: deserializeMetadata(output) }]);
                  return [3 /*break*/, 13];
              case 4:
                  _d = [{}];
                  return [4 /*yield*/, deserializeAws_json1_1LayerInaccessibleExceptionResponse(parsedOutput, context)];
              case 5:
                  response = __assign.apply(void 0, [__assign.apply(void 0, _d.concat([(_j.sent())])), { name: errorCode, $metadata: deserializeMetadata(output) }]);
                  return [3 /*break*/, 13];
              case 6:
                  _e = [{}];
                  return [4 /*yield*/, deserializeAws_json1_1LayersNotFoundExceptionResponse(parsedOutput, context)];
              case 7:
                  response = __assign.apply(void 0, [__assign.apply(void 0, _e.concat([(_j.sent())])), { name: errorCode, $metadata: deserializeMetadata(output) }]);
                  return [3 /*break*/, 13];
              case 8:
                  _f = [{}];
                  return [4 /*yield*/, deserializeAws_json1_1RepositoryNotFoundExceptionResponse(parsedOutput, context)];
              case 9:
                  response = __assign.apply(void 0, [__assign.apply(void 0, _f.concat([(_j.sent())])), { name: errorCode, $metadata: deserializeMetadata(output) }]);
                  return [3 /*break*/, 13];
              case 10:
                  _g = [{}];
                  return [4 /*yield*/, deserializeAws_json1_1ServerExceptionResponse(parsedOutput, context)];
              case 11:
                  response = __assign.apply(void 0, [__assign.apply(void 0, _g.concat([(_j.sent())])), { name: errorCode, $metadata: deserializeMetadata(output) }]);
                  return [3 /*break*/, 13];
              case 12:
                  parsedBody = parsedOutput.body;
                  errorCode = parsedBody.code || parsedBody.Code || errorCode;
                  response = __assign(__assign({}, parsedBody), { name: "" + errorCode, message: parsedBody.message || parsedBody.Message || errorCode, $fault: "client", $metadata: deserializeMetadata(output) });
                  _j.label = 13;
              case 13:
                  message = response.message || response.Message || errorCode;
                  response.message = message;
                  delete response.Message;
                  return [2 /*return*/, Promise.reject(Object.assign(new Error(message), response))];
          }
      });
  }); };
  export var deserializeAws_json1_1GetLifecyclePolicyCommand = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
      var data, contents, response;
      return __generator(this, function (_a) {
          switch (_a.label) {
              case 0:
                  if (output.statusCode >= 300) {
                      return [2 /*return*/, deserializeAws_json1_1GetLifecyclePolicyCommandError(output, context)];
                  }
                  return [4 /*yield*/, parseBody(output.body, context)];
              case 1:
                  data = _a.sent();
                  contents = {};
                  contents = deserializeAws_json1_1GetLifecyclePolicyResponse(data, context);
                  response = __assign({ $metadata: deserializeMetadata(output) }, contents);
                  return [2 /*return*/, Promise.resolve(response)];
          }
      });
  }); };
  var deserializeAws_json1_1GetLifecyclePolicyCommandError = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
      var parsedOutput, _a, response, errorCode, _b, _c, _d, _e, _f, parsedBody, message;
      var _g;
      return __generator(this, function (_h) {
          switch (_h.label) {
              case 0:
                  _a = [__assign({}, output)];
                  _g = {};
                  return [4 /*yield*/, parseBody(output.body, context)];
              case 1:
                  parsedOutput = __assign.apply(void 0, _a.concat([(_g.body = _h.sent(), _g)]));
                  errorCode = "UnknownError";
                  errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
                  _b = errorCode;
                  switch (_b) {
                      case "InvalidParameterException": return [3 /*break*/, 2];
                      case "com.amazonaws.ecr#InvalidParameterException": return [3 /*break*/, 2];
                      case "LifecyclePolicyNotFoundException": return [3 /*break*/, 4];
                      case "com.amazonaws.ecr#LifecyclePolicyNotFoundException": return [3 /*break*/, 4];
                      case "RepositoryNotFoundException": return [3 /*break*/, 6];
                      case "com.amazonaws.ecr#RepositoryNotFoundException": return [3 /*break*/, 6];
                      case "ServerException": return [3 /*break*/, 8];
                      case "com.amazonaws.ecr#ServerException": return [3 /*break*/, 8];
                  }
                  return [3 /*break*/, 10];
              case 2:
                  _c = [{}];
                  return [4 /*yield*/, deserializeAws_json1_1InvalidParameterExceptionResponse(parsedOutput, context)];
              case 3:
                  response = __assign.apply(void 0, [__assign.apply(void 0, _c.concat([(_h.sent())])), { name: errorCode, $metadata: deserializeMetadata(output) }]);
                  return [3 /*break*/, 11];
              case 4:
                  _d = [{}];
                  return [4 /*yield*/, deserializeAws_json1_1LifecyclePolicyNotFoundExceptionResponse(parsedOutput, context)];
              case 5:
                  response = __assign.apply(void 0, [__assign.apply(void 0, _d.concat([(_h.sent())])), { name: errorCode, $metadata: deserializeMetadata(output) }]);
                  return [3 /*break*/, 11];
              case 6:
                  _e = [{}];
                  return [4 /*yield*/, deserializeAws_json1_1RepositoryNotFoundExceptionResponse(parsedOutput, context)];
              case 7:
                  response = __assign.apply(void 0, [__assign.apply(void 0, _e.concat([(_h.sent())])), { name: errorCode, $metadata: deserializeMetadata(output) }]);
                  return [3 /*break*/, 11];
              case 8:
                  _f = [{}];
                  return [4 /*yield*/, deserializeAws_json1_1ServerExceptionResponse(parsedOutput, context)];
              case 9:
                  response = __assign.apply(void 0, [__assign.apply(void 0, _f.concat([(_h.sent())])), { name: errorCode, $metadata: deserializeMetadata(output) }]);
                  return [3 /*break*/, 11];
              case 10:
                  parsedBody = parsedOutput.body;
                  errorCode = parsedBody.code || parsedBody.Code || errorCode;
                  response = __assign(__assign({}, parsedBody), { name: "" + errorCode, message: parsedBody.message || parsedBody.Message || errorCode, $fault: "client", $metadata: deserializeMetadata(output) });
                  _h.label = 11;
              case 11:
                  message = response.message || response.Message || errorCode;
                  response.message = message;
                  delete response.Message;
                  return [2 /*return*/, Promise.reject(Object.assign(new Error(message), response))];
          }
      });
  }); };
  export var deserializeAws_json1_1GetLifecyclePolicyPreviewCommand = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
      var data, contents, response;
      return __generator(this, function (_a) {
          switch (_a.label) {
              case 0:
                  if (output.statusCode >= 300) {
                      return [2 /*return*/, deserializeAws_json1_1GetLifecyclePolicyPreviewCommandError(output, context)];
                  }
                  return [4 /*yield*/, parseBody(output.body, context)];
              case 1:
                  data = _a.sent();
                  contents = {};
                  contents = deserializeAws_json1_1GetLifecyclePolicyPreviewResponse(data, context);
                  response = __assign({ $metadata: deserializeMetadata(output) }, contents);
                  return [2 /*return*/, Promise.resolve(response)];
          }
      });
  }); };
  var deserializeAws_json1_1GetLifecyclePolicyPreviewCommandError = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
      var parsedOutput, _a, response, errorCode, _b, _c, _d, _e, _f, parsedBody, message;
      var _g;
      return __generator(this, function (_h) {
          switch (_h.label) {
              case 0:
                  _a = [__assign({}, output)];
                  _g = {};
                  return [4 /*yield*/, parseBody(output.body, context)];
              case 1:
                  parsedOutput = __assign.apply(void 0, _a.concat([(_g.body = _h.sent(), _g)]));
                  errorCode = "UnknownError";
                  errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
                  _b = errorCode;
                  switch (_b) {
                      case "InvalidParameterException": return [3 /*break*/, 2];
                      case "com.amazonaws.ecr#InvalidParameterException": return [3 /*break*/, 2];
                      case "LifecyclePolicyPreviewNotFoundException": return [3 /*break*/, 4];
                      case "com.amazonaws.ecr#LifecyclePolicyPreviewNotFoundException": return [3 /*break*/, 4];
                      case "RepositoryNotFoundException": return [3 /*break*/, 6];
                      case "com.amazonaws.ecr#RepositoryNotFoundException": return [3 /*break*/, 6];
                      case "ServerException": return [3 /*break*/, 8];
                      case "com.amazonaws.ecr#ServerException": return [3 /*break*/, 8];
                  }
                  return [3 /*break*/, 10];
              case 2:
                  _c = [{}];
                  return [4 /*yield*/, deserializeAws_json1_1InvalidParameterExceptionResponse(parsedOutput, context)];
              case 3:
                  response = __assign.apply(void 0, [__assign.apply(void 0, _c.concat([(_h.sent())])), { name: errorCode, $metadata: deserializeMetadata(output) }]);
                  return [3 /*break*/, 11];
              case 4:
                  _d = [{}];
                  return [4 /*yield*/, deserializeAws_json1_1LifecyclePolicyPreviewNotFoundExceptionResponse(parsedOutput, context)];
              case 5:
                  response = __assign.apply(void 0, [__assign.apply(void 0, _d.concat([(_h.sent())])), { name: errorCode, $metadata: deserializeMetadata(output) }]);
                  return [3 /*break*/, 11];
              case 6:
                  _e = [{}];
                  return [4 /*yield*/, deserializeAws_json1_1RepositoryNotFoundExceptionResponse(parsedOutput, context)];
              case 7:
                  response = __assign.apply(void 0, [__assign.apply(void 0, _e.concat([(_h.sent())])), { name: errorCode, $metadata: deserializeMetadata(output) }]);
                  return [3 /*break*/, 11];
              case 8:
                  _f = [{}];
                  return [4 /*yield*/, deserializeAws_json1_1ServerExceptionResponse(parsedOutput, context)];
              case 9:
                  response = __assign.apply(void 0, [__assign.apply(void 0, _f.concat([(_h.sent())])), { name: errorCode, $metadata: deserializeMetadata(output) }]);
                  return [3 /*break*/, 11];
              case 10:
                  parsedBody = parsedOutput.body;
                  errorCode = parsedBody.code || parsedBody.Code || errorCode;
                  response = __assign(__assign({}, parsedBody), { name: "" + errorCode, message: parsedBody.message || parsedBody.Message || errorCode, $fault: "client", $metadata: deserializeMetadata(output) });
                  _h.label = 11;
              case 11:
                  message = response.message || response.Message || errorCode;
                  response.message = message;
                  delete response.Message;
                  return [2 /*return*/, Promise.reject(Object.assign(new Error(message), response))];
          }
      });
  }); };
  export var deserializeAws_json1_1GetRegistryPolicyCommand = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
      var data, contents, response;
      return __generator(this, function (_a) {
          switch (_a.label) {
              case 0:
                  if (output.statusCode >= 300) {
                      return [2 /*return*/, deserializeAws_json1_1GetRegistryPolicyCommandError(output, context)];
                  }
                  return [4 /*yield*/, parseBody(output.body, context)];
              case 1:
                  data = _a.sent();
                  contents = {};
                  contents = deserializeAws_json1_1GetRegistryPolicyResponse(data, context);
                  response = __assign({ $metadata: deserializeMetadata(output) }, contents);
                  return [2 /*return*/, Promise.resolve(response)];
          }
      });
  }); };
  var deserializeAws_json1_1GetRegistryPolicyCommandError = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
      var parsedOutput, _a, response, errorCode, _b, _c, _d, _e, parsedBody, message;
      var _f;
      return __generator(this, function (_g) {
          switch (_g.label) {
              case 0:
                  _a = [__assign({}, output)];
                  _f = {};
                  return [4 /*yield*/, parseBody(output.body, context)];
              case 1:
                  parsedOutput = __assign.apply(void 0, _a.concat([(_f.body = _g.sent(), _f)]));
                  errorCode = "UnknownError";
                  errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
                  _b = errorCode;
                  switch (_b) {
                      case "InvalidParameterException": return [3 /*break*/, 2];
                      case "com.amazonaws.ecr#InvalidParameterException": return [3 /*break*/, 2];
                      case "RegistryPolicyNotFoundException": return [3 /*break*/, 4];
                      case "com.amazonaws.ecr#RegistryPolicyNotFoundException": return [3 /*break*/, 4];
                      case "ServerException": return [3 /*break*/, 6];
                      case "com.amazonaws.ecr#ServerException": return [3 /*break*/, 6];
                  }
                  return [3 /*break*/, 8];
              case 2:
                  _c = [{}];
                  return [4 /*yield*/, deserializeAws_json1_1InvalidParameterExceptionResponse(parsedOutput, context)];
              case 3:
                  response = __assign.apply(void 0, [__assign.apply(void 0, _c.concat([(_g.sent())])), { name: errorCode, $metadata: deserializeMetadata(output) }]);
                  return [3 /*break*/, 9];
              case 4:
                  _d = [{}];
                  return [4 /*yield*/, deserializeAws_json1_1RegistryPolicyNotFoundExceptionResponse(parsedOutput, context)];
              case 5:
                  response = __assign.apply(void 0, [__assign.apply(void 0, _d.concat([(_g.sent())])), { name: errorCode, $metadata: deserializeMetadata(output) }]);
                  return [3 /*break*/, 9];
              case 6:
                  _e = [{}];
                  return [4 /*yield*/, deserializeAws_json1_1ServerExceptionResponse(parsedOutput, context)];
              case 7:
                  response = __assign.apply(void 0, [__assign.apply(void 0, _e.concat([(_g.sent())])), { name: errorCode, $metadata: deserializeMetadata(output) }]);
                  return [3 /*break*/, 9];
              case 8:
                  parsedBody = parsedOutput.body;
                  errorCode = parsedBody.code || parsedBody.Code || errorCode;
                  response = __assign(__assign({}, parsedBody), { name: "" + errorCode, message: parsedBody.message || parsedBody.Message || errorCode, $fault: "client", $metadata: deserializeMetadata(output) });
                  _g.label = 9;
              case 9:
                  message = response.message || response.Message || errorCode;
                  response.message = message;
                  delete response.Message;
                  return [2 /*return*/, Promise.reject(Object.assign(new Error(message), response))];
          }
      });
  }); };
  export var deserializeAws_json1_1GetRepositoryPolicyCommand = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
      var data, contents, response;
      return __generator(this, function (_a) {
          switch (_a.label) {
              case 0:
                  if (output.statusCode >= 300) {
                      return [2 /*return*/, deserializeAws_json1_1GetRepositoryPolicyCommandError(output, context)];
                  }
                  return [4 /*yield*/, parseBody(output.body, context)];
              case 1:
                  data = _a.sent();
                  contents = {};
                  contents = deserializeAws_json1_1GetRepositoryPolicyResponse(data, context);
                  response = __assign({ $metadata: deserializeMetadata(output) }, contents);
                  return [2 /*return*/, Promise.resolve(response)];
          }
      });
  }); };
  var deserializeAws_json1_1GetRepositoryPolicyCommandError = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
      var parsedOutput, _a, response, errorCode, _b, _c, _d, _e, _f, parsedBody, message;
      var _g;
      return __generator(this, function (_h) {
          switch (_h.label) {
              case 0:
                  _a = [__assign({}, output)];
                  _g = {};
                  return [4 /*yield*/, parseBody(output.body, context)];
              case 1:
                  parsedOutput = __assign.apply(void 0, _a.concat([(_g.body = _h.sent(), _g)]));
                  errorCode = "UnknownError";
                  errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
                  _b = errorCode;
                  switch (_b) {
                      case "InvalidParameterException": return [3 /*break*/, 2];
                      case "com.amazonaws.ecr#InvalidParameterException": return [3 /*break*/, 2];
                      case "RepositoryNotFoundException": return [3 /*break*/, 4];
                      case "com.amazonaws.ecr#RepositoryNotFoundException": return [3 /*break*/, 4];
                      case "RepositoryPolicyNotFoundException": return [3 /*break*/, 6];
                      case "com.amazonaws.ecr#RepositoryPolicyNotFoundException": return [3 /*break*/, 6];
                      case "ServerException": return [3 /*break*/, 8];
                      case "com.amazonaws.ecr#ServerException": return [3 /*break*/, 8];
                  }
                  return [3 /*break*/, 10];
              case 2:
                  _c = [{}];
                  return [4 /*yield*/, deserializeAws_json1_1InvalidParameterExceptionResponse(parsedOutput, context)];
              case 3:
                  response = __assign.apply(void 0, [__assign.apply(void 0, _c.concat([(_h.sent())])), { name: errorCode, $metadata: deserializeMetadata(output) }]);
                  return [3 /*break*/, 11];
              case 4:
                  _d = [{}];
                  return [4 /*yield*/, deserializeAws_json1_1RepositoryNotFoundExceptionResponse(parsedOutput, context)];
              case 5:
                  response = __assign.apply(void 0, [__assign.apply(void 0, _d.concat([(_h.sent())])), { name: errorCode, $metadata: deserializeMetadata(output) }]);
                  return [3 /*break*/, 11];
              case 6:
                  _e = [{}];
                  return [4 /*yield*/, deserializeAws_json1_1RepositoryPolicyNotFoundExceptionResponse(parsedOutput, context)];
              case 7:
                  response = __assign.apply(void 0, [__assign.apply(void 0, _e.concat([(_h.sent())])), { name: errorCode, $metadata: deserializeMetadata(output) }]);
                  return [3 /*break*/, 11];
              case 8:
                  _f = [{}];
                  return [4 /*yield*/, deserializeAws_json1_1ServerExceptionResponse(parsedOutput, context)];
              case 9:
                  response = __assign.apply(void 0, [__assign.apply(void 0, _f.concat([(_h.sent())])), { name: errorCode, $metadata: deserializeMetadata(output) }]);
                  return [3 /*break*/, 11];
              case 10:
                  parsedBody = parsedOutput.body;
                  errorCode = parsedBody.code || parsedBody.Code || errorCode;
                  response = __assign(__assign({}, parsedBody), { name: "" + errorCode, message: parsedBody.message || parsedBody.Message || errorCode, $fault: "client", $metadata: deserializeMetadata(output) });
                  _h.label = 11;
              case 11:
                  message = response.message || response.Message || errorCode;
                  response.message = message;
                  delete response.Message;
                  return [2 /*return*/, Promise.reject(Object.assign(new Error(message), response))];
          }
      });
  }); };
  export var deserializeAws_json1_1InitiateLayerUploadCommand = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
      var data, contents, response;
      return __generator(this, function (_a) {
          switch (_a.label) {
              case 0:
                  if (output.statusCode >= 300) {
                      return [2 /*return*/, deserializeAws_json1_1InitiateLayerUploadCommandError(output, context)];
                  }
                  return [4 /*yield*/, parseBody(output.body, context)];
              case 1:
                  data = _a.sent();
                  contents = {};
                  contents = deserializeAws_json1_1InitiateLayerUploadResponse(data, context);
                  response = __assign({ $metadata: deserializeMetadata(output) }, contents);
                  return [2 /*return*/, Promise.resolve(response)];
          }
      });
  }); };
  var deserializeAws_json1_1InitiateLayerUploadCommandError = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
      var parsedOutput, _a, response, errorCode, _b, _c, _d, _e, _f, parsedBody, message;
      var _g;
      return __generator(this, function (_h) {
          switch (_h.label) {
              case 0:
                  _a = [__assign({}, output)];
                  _g = {};
                  return [4 /*yield*/, parseBody(output.body, context)];
              case 1:
                  parsedOutput = __assign.apply(void 0, _a.concat([(_g.body = _h.sent(), _g)]));
                  errorCode = "UnknownError";
                  errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
                  _b = errorCode;
                  switch (_b) {
                      case "InvalidParameterException": return [3 /*break*/, 2];
                      case "com.amazonaws.ecr#InvalidParameterException": return [3 /*break*/, 2];
                      case "KmsException": return [3 /*break*/, 4];
                      case "com.amazonaws.ecr#KmsException": return [3 /*break*/, 4];
                      case "RepositoryNotFoundException": return [3 /*break*/, 6];
                      case "com.amazonaws.ecr#RepositoryNotFoundException": return [3 /*break*/, 6];
                      case "ServerException": return [3 /*break*/, 8];
                      case "com.amazonaws.ecr#ServerException": return [3 /*break*/, 8];
                  }
                  return [3 /*break*/, 10];
              case 2:
                  _c = [{}];
                  return [4 /*yield*/, deserializeAws_json1_1InvalidParameterExceptionResponse(parsedOutput, context)];
              case 3:
                  response = __assign.apply(void 0, [__assign.apply(void 0, _c.concat([(_h.sent())])), { name: errorCode, $metadata: deserializeMetadata(output) }]);
                  return [3 /*break*/, 11];
              case 4:
                  _d = [{}];
                  return [4 /*yield*/, deserializeAws_json1_1KmsExceptionResponse(parsedOutput, context)];
              case 5:
                  response = __assign.apply(void 0, [__assign.apply(void 0, _d.concat([(_h.sent())])), { name: errorCode, $metadata: deserializeMetadata(output) }]);
                  return [3 /*break*/, 11];
              case 6:
                  _e = [{}];
                  return [4 /*yield*/, deserializeAws_json1_1RepositoryNotFoundExceptionResponse(parsedOutput, context)];
              case 7:
                  response = __assign.apply(void 0, [__assign.apply(void 0, _e.concat([(_h.sent())])), { name: errorCode, $metadata: deserializeMetadata(output) }]);
                  return [3 /*break*/, 11];
              case 8:
                  _f = [{}];
                  return [4 /*yield*/, deserializeAws_json1_1ServerExceptionResponse(parsedOutput, context)];
              case 9:
                  response = __assign.apply(void 0, [__assign.apply(void 0, _f.concat([(_h.sent())])), { name: errorCode, $metadata: deserializeMetadata(output) }]);
                  return [3 /*break*/, 11];
              case 10:
                  parsedBody = parsedOutput.body;
                  errorCode = parsedBody.code || parsedBody.Code || errorCode;
                  response = __assign(__assign({}, parsedBody), { name: "" + errorCode, message: parsedBody.message || parsedBody.Message || errorCode, $fault: "client", $metadata: deserializeMetadata(output) });
                  _h.label = 11;
              case 11:
                  message = response.message || response.Message || errorCode;
                  response.message = message;
                  delete response.Message;
                  return [2 /*return*/, Promise.reject(Object.assign(new Error(message), response))];
          }
      });
  }); };
  export var deserializeAws_json1_1ListImagesCommand = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
      var data, contents, response;
      return __generator(this, function (_a) {
          switch (_a.label) {
              case 0:
                  if (output.statusCode >= 300) {
                      return [2 /*return*/, deserializeAws_json1_1ListImagesCommandError(output, context)];
                  }
                  return [4 /*yield*/, parseBody(output.body, context)];
              case 1:
                  data = _a.sent();
                  contents = {};
                  contents = deserializeAws_json1_1ListImagesResponse(data, context);
                  response = __assign({ $metadata: deserializeMetadata(output) }, contents);
                  return [2 /*return*/, Promise.resolve(response)];
          }
      });
  }); };
  var deserializeAws_json1_1ListImagesCommandError = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
      var parsedOutput, _a, response, errorCode, _b, _c, _d, _e, parsedBody, message;
      var _f;
      return __generator(this, function (_g) {
          switch (_g.label) {
              case 0:
                  _a = [__assign({}, output)];
                  _f = {};
                  return [4 /*yield*/, parseBody(output.body, context)];
              case 1:
                  parsedOutput = __assign.apply(void 0, _a.concat([(_f.body = _g.sent(), _f)]));
                  errorCode = "UnknownError";
                  errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
                  _b = errorCode;
                  switch (_b) {
                      case "InvalidParameterException": return [3 /*break*/, 2];
                      case "com.amazonaws.ecr#InvalidParameterException": return [3 /*break*/, 2];
                      case "RepositoryNotFoundException": return [3 /*break*/, 4];
                      case "com.amazonaws.ecr#RepositoryNotFoundException": return [3 /*break*/, 4];
                      case "ServerException": return [3 /*break*/, 6];
                      case "com.amazonaws.ecr#ServerException": return [3 /*break*/, 6];
                  }
                  return [3 /*break*/, 8];
              case 2:
                  _c = [{}];
                  return [4 /*yield*/, deserializeAws_json1_1InvalidParameterExceptionResponse(parsedOutput, context)];
              case 3:
                  response = __assign.apply(void 0, [__assign.apply(void 0, _c.concat([(_g.sent())])), { name: errorCode, $metadata: deserializeMetadata(output) }]);
                  return [3 /*break*/, 9];
              case 4:
                  _d = [{}];
                  return [4 /*yield*/, deserializeAws_json1_1RepositoryNotFoundExceptionResponse(parsedOutput, context)];
              case 5:
                  response = __assign.apply(void 0, [__assign.apply(void 0, _d.concat([(_g.sent())])), { name: errorCode, $metadata: deserializeMetadata(output) }]);
                  return [3 /*break*/, 9];
              case 6:
                  _e = [{}];
                  return [4 /*yield*/, deserializeAws_json1_1ServerExceptionResponse(parsedOutput, context)];
              case 7:
                  response = __assign.apply(void 0, [__assign.apply(void 0, _e.concat([(_g.sent())])), { name: errorCode, $metadata: deserializeMetadata(output) }]);
                  return [3 /*break*/, 9];
              case 8:
                  parsedBody = parsedOutput.body;
                  errorCode = parsedBody.code || parsedBody.Code || errorCode;
                  response = __assign(__assign({}, parsedBody), { name: "" + errorCode, message: parsedBody.message || parsedBody.Message || errorCode, $fault: "client", $metadata: deserializeMetadata(output) });
                  _g.label = 9;
              case 9:
                  message = response.message || response.Message || errorCode;
                  response.message = message;
                  delete response.Message;
                  return [2 /*return*/, Promise.reject(Object.assign(new Error(message), response))];
          }
      });
  }); };
  export var deserializeAws_json1_1ListTagsForResourceCommand = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
      var data, contents, response;
      return __generator(this, function (_a) {
          switch (_a.label) {
              case 0:
                  if (output.statusCode >= 300) {
                      return [2 /*return*/, deserializeAws_json1_1ListTagsForResourceCommandError(output, context)];
                  }
                  return [4 /*yield*/, parseBody(output.body, context)];
              case 1:
                  data = _a.sent();
                  contents = {};
                  contents = deserializeAws_json1_1ListTagsForResourceResponse(data, context);
                  response = __assign({ $metadata: deserializeMetadata(output) }, contents);
                  return [2 /*return*/, Promise.resolve(response)];
          }
      });
  }); };
  var deserializeAws_json1_1ListTagsForResourceCommandError = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
      var parsedOutput, _a, response, errorCode, _b, _c, _d, _e, parsedBody, message;
      var _f;
      return __generator(this, function (_g) {
          switch (_g.label) {
              case 0:
                  _a = [__assign({}, output)];
                  _f = {};
                  return [4 /*yield*/, parseBody(output.body, context)];
              case 1:
                  parsedOutput = __assign.apply(void 0, _a.concat([(_f.body = _g.sent(), _f)]));
                  errorCode = "UnknownError";
                  errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
                  _b = errorCode;
                  switch (_b) {
                      case "InvalidParameterException": return [3 /*break*/, 2];
                      case "com.amazonaws.ecr#InvalidParameterException": return [3 /*break*/, 2];
                      case "RepositoryNotFoundException": return [3 /*break*/, 4];
                      case "com.amazonaws.ecr#RepositoryNotFoundException": return [3 /*break*/, 4];
                      case "ServerException": return [3 /*break*/, 6];
                      case "com.amazonaws.ecr#ServerException": return [3 /*break*/, 6];
                  }
                  return [3 /*break*/, 8];
              case 2:
                  _c = [{}];
                  return [4 /*yield*/, deserializeAws_json1_1InvalidParameterExceptionResponse(parsedOutput, context)];
              case 3:
                  response = __assign.apply(void 0, [__assign.apply(void 0, _c.concat([(_g.sent())])), { name: errorCode, $metadata: deserializeMetadata(output) }]);
                  return [3 /*break*/, 9];
              case 4:
                  _d = [{}];
                  return [4 /*yield*/, deserializeAws_json1_1RepositoryNotFoundExceptionResponse(parsedOutput, context)];
              case 5:
                  response = __assign.apply(void 0, [__assign.apply(void 0, _d.concat([(_g.sent())])), { name: errorCode, $metadata: deserializeMetadata(output) }]);
                  return [3 /*break*/, 9];
              case 6:
                  _e = [{}];
                  return [4 /*yield*/, deserializeAws_json1_1ServerExceptionResponse(parsedOutput, context)];
              case 7:
                  response = __assign.apply(void 0, [__assign.apply(void 0, _e.concat([(_g.sent())])), { name: errorCode, $metadata: deserializeMetadata(output) }]);
                  return [3 /*break*/, 9];
              case 8:
                  parsedBody = parsedOutput.body;
                  errorCode = parsedBody.code || parsedBody.Code || errorCode;
                  response = __assign(__assign({}, parsedBody), { name: "" + errorCode, message: parsedBody.message || parsedBody.Message || errorCode, $fault: "client", $metadata: deserializeMetadata(output) });
                  _g.label = 9;
              case 9:
                  message = response.message || response.Message || errorCode;
                  response.message = message;
                  delete response.Message;
                  return [2 /*return*/, Promise.reject(Object.assign(new Error(message), response))];
          }
      });
  }); };
  export var deserializeAws_json1_1PutImageCommand = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
      var data, contents, response;
      return __generator(this, function (_a) {
          switch (_a.label) {
              case 0:
                  if (output.statusCode >= 300) {
                      return [2 /*return*/, deserializeAws_json1_1PutImageCommandError(output, context)];
                  }
                  return [4 /*yield*/, parseBody(output.body, context)];
              case 1:
                  data = _a.sent();
                  contents = {};
                  contents = deserializeAws_json1_1PutImageResponse(data, context);
                  response = __assign({ $metadata: deserializeMetadata(output) }, contents);
                  return [2 /*return*/, Promise.resolve(response)];
          }
      });
  }); };
  var deserializeAws_json1_1PutImageCommandError = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
      var parsedOutput, _a, response, errorCode, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, parsedBody, message;
      var _o;
      return __generator(this, function (_p) {
          switch (_p.label) {
              case 0:
                  _a = [__assign({}, output)];
                  _o = {};
                  return [4 /*yield*/, parseBody(output.body, context)];
              case 1:
                  parsedOutput = __assign.apply(void 0, _a.concat([(_o.body = _p.sent(), _o)]));
                  errorCode = "UnknownError";
                  errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
                  _b = errorCode;
                  switch (_b) {
                      case "ImageAlreadyExistsException": return [3 /*break*/, 2];
                      case "com.amazonaws.ecr#ImageAlreadyExistsException": return [3 /*break*/, 2];
                      case "ImageDigestDoesNotMatchException": return [3 /*break*/, 4];
                      case "com.amazonaws.ecr#ImageDigestDoesNotMatchException": return [3 /*break*/, 4];
                      case "ImageTagAlreadyExistsException": return [3 /*break*/, 6];
                      case "com.amazonaws.ecr#ImageTagAlreadyExistsException": return [3 /*break*/, 6];
                      case "InvalidParameterException": return [3 /*break*/, 8];
                      case "com.amazonaws.ecr#InvalidParameterException": return [3 /*break*/, 8];
                      case "KmsException": return [3 /*break*/, 10];
                      case "com.amazonaws.ecr#KmsException": return [3 /*break*/, 10];
                      case "LayersNotFoundException": return [3 /*break*/, 12];
                      case "com.amazonaws.ecr#LayersNotFoundException": return [3 /*break*/, 12];
                      case "LimitExceededException": return [3 /*break*/, 14];
                      case "com.amazonaws.ecr#LimitExceededException": return [3 /*break*/, 14];
                      case "ReferencedImagesNotFoundException": return [3 /*break*/, 16];
                      case "com.amazonaws.ecr#ReferencedImagesNotFoundException": return [3 /*break*/, 16];
                      case "RepositoryNotFoundException": return [3 /*break*/, 18];
                      case "com.amazonaws.ecr#RepositoryNotFoundException": return [3 /*break*/, 18];
                      case "ServerException": return [3 /*break*/, 20];
                      case "com.amazonaws.ecr#ServerException": return [3 /*break*/, 20];
                  }
                  return [3 /*break*/, 22];
              case 2:
                  _c = [{}];
                  return [4 /*yield*/, deserializeAws_json1_1ImageAlreadyExistsExceptionResponse(parsedOutput, context)];
              case 3:
                  response = __assign.apply(void 0, [__assign.apply(void 0, _c.concat([(_p.sent())])), { name: errorCode, $metadata: deserializeMetadata(output) }]);
                  return [3 /*break*/, 23];
              case 4:
                  _d = [{}];
                  return [4 /*yield*/, deserializeAws_json1_1ImageDigestDoesNotMatchExceptionResponse(parsedOutput, context)];
              case 5:
                  response = __assign.apply(void 0, [__assign.apply(void 0, _d.concat([(_p.sent())])), { name: errorCode, $metadata: deserializeMetadata(output) }]);
                  return [3 /*break*/, 23];
              case 6:
                  _e = [{}];
                  return [4 /*yield*/, deserializeAws_json1_1ImageTagAlreadyExistsExceptionResponse(parsedOutput, context)];
              case 7:
                  response = __assign.apply(void 0, [__assign.apply(void 0, _e.concat([(_p.sent())])), { name: errorCode, $metadata: deserializeMetadata(output) }]);
                  return [3 /*break*/, 23];
              case 8:
                  _f = [{}];
                  return [4 /*yield*/, deserializeAws_json1_1InvalidParameterExceptionResponse(parsedOutput, context)];
              case 9:
                  response = __assign.apply(void 0, [__assign.apply(void 0, _f.concat([(_p.sent())])), { name: errorCode, $metadata: deserializeMetadata(output) }]);
                  return [3 /*break*/, 23];
              case 10:
                  _g = [{}];
                  return [4 /*yield*/, deserializeAws_json1_1KmsExceptionResponse(parsedOutput, context)];
              case 11:
                  response = __assign.apply(void 0, [__assign.apply(void 0, _g.concat([(_p.sent())])), { name: errorCode, $metadata: deserializeMetadata(output) }]);
                  return [3 /*break*/, 23];
              case 12:
                  _h = [{}];
                  return [4 /*yield*/, deserializeAws_json1_1LayersNotFoundExceptionResponse(parsedOutput, context)];
              case 13:
                  response = __assign.apply(void 0, [__assign.apply(void 0, _h.concat([(_p.sent())])), { name: errorCode, $metadata: deserializeMetadata(output) }]);
                  return [3 /*break*/, 23];
              case 14:
                  _j = [{}];
                  return [4 /*yield*/, deserializeAws_json1_1LimitExceededExceptionResponse(parsedOutput, context)];
              case 15:
                  response = __assign.apply(void 0, [__assign.apply(void 0, _j.concat([(_p.sent())])), { name: errorCode, $metadata: deserializeMetadata(output) }]);
                  return [3 /*break*/, 23];
              case 16:
                  _k = [{}];
                  return [4 /*yield*/, deserializeAws_json1_1ReferencedImagesNotFoundExceptionResponse(parsedOutput, context)];
              case 17:
                  response = __assign.apply(void 0, [__assign.apply(void 0, _k.concat([(_p.sent())])), { name: errorCode, $metadata: deserializeMetadata(output) }]);
                  return [3 /*break*/, 23];
              case 18:
                  _l = [{}];
                  return [4 /*yield*/, deserializeAws_json1_1RepositoryNotFoundExceptionResponse(parsedOutput, context)];
              case 19:
                  response = __assign.apply(void 0, [__assign.apply(void 0, _l.concat([(_p.sent())])), { name: errorCode, $metadata: deserializeMetadata(output) }]);
                  return [3 /*break*/, 23];
              case 20:
                  _m = [{}];
                  return [4 /*yield*/, deserializeAws_json1_1ServerExceptionResponse(parsedOutput, context)];
              case 21:
                  response = __assign.apply(void 0, [__assign.apply(void 0, _m.concat([(_p.sent())])), { name: errorCode, $metadata: deserializeMetadata(output) }]);
                  return [3 /*break*/, 23];
              case 22:
                  parsedBody = parsedOutput.body;
                  errorCode = parsedBody.code || parsedBody.Code || errorCode;
                  response = __assign(__assign({}, parsedBody), { name: "" + errorCode, message: parsedBody.message || parsedBody.Message || errorCode, $fault: "client", $metadata: deserializeMetadata(output) });
                  _p.label = 23;
              case 23:
                  message = response.message || response.Message || errorCode;
                  response.message = message;
                  delete response.Message;
                  return [2 /*return*/, Promise.reject(Object.assign(new Error(message), response))];
          }
      });
  }); };
  export var deserializeAws_json1_1PutImageScanningConfigurationCommand = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
      var data, contents, response;
      return __generator(this, function (_a) {
          switch (_a.label) {
              case 0:
                  if (output.statusCode >= 300) {
                      return [2 /*return*/, deserializeAws_json1_1PutImageScanningConfigurationCommandError(output, context)];
                  }
                  return [4 /*yield*/, parseBody(output.body, context)];
              case 1:
                  data = _a.sent();
                  contents = {};
                  contents = deserializeAws_json1_1PutImageScanningConfigurationResponse(data, context);
                  response = __assign({ $metadata: deserializeMetadata(output) }, contents);
                  return [2 /*return*/, Promise.resolve(response)];
          }
      });
  }); };
  var deserializeAws_json1_1PutImageScanningConfigurationCommandError = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
      var parsedOutput, _a, response, errorCode, _b, _c, _d, _e, parsedBody, message;
      var _f;
      return __generator(this, function (_g) {
          switch (_g.label) {
              case 0:
                  _a = [__assign({}, output)];
                  _f = {};
                  return [4 /*yield*/, parseBody(output.body, context)];
              case 1:
                  parsedOutput = __assign.apply(void 0, _a.concat([(_f.body = _g.sent(), _f)]));
                  errorCode = "UnknownError";
                  errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
                  _b = errorCode;
                  switch (_b) {
                      case "InvalidParameterException": return [3 /*break*/, 2];
                      case "com.amazonaws.ecr#InvalidParameterException": return [3 /*break*/, 2];
                      case "RepositoryNotFoundException": return [3 /*break*/, 4];
                      case "com.amazonaws.ecr#RepositoryNotFoundException": return [3 /*break*/, 4];
                      case "ServerException": return [3 /*break*/, 6];
                      case "com.amazonaws.ecr#ServerException": return [3 /*break*/, 6];
                  }
                  return [3 /*break*/, 8];
              case 2:
                  _c = [{}];
                  return [4 /*yield*/, deserializeAws_json1_1InvalidParameterExceptionResponse(parsedOutput, context)];
              case 3:
                  response = __assign.apply(void 0, [__assign.apply(void 0, _c.concat([(_g.sent())])), { name: errorCode, $metadata: deserializeMetadata(output) }]);
                  return [3 /*break*/, 9];
              case 4:
                  _d = [{}];
                  return [4 /*yield*/, deserializeAws_json1_1RepositoryNotFoundExceptionResponse(parsedOutput, context)];
              case 5:
                  response = __assign.apply(void 0, [__assign.apply(void 0, _d.concat([(_g.sent())])), { name: errorCode, $metadata: deserializeMetadata(output) }]);
                  return [3 /*break*/, 9];
              case 6:
                  _e = [{}];
                  return [4 /*yield*/, deserializeAws_json1_1ServerExceptionResponse(parsedOutput, context)];
              case 7:
                  response = __assign.apply(void 0, [__assign.apply(void 0, _e.concat([(_g.sent())])), { name: errorCode, $metadata: deserializeMetadata(output) }]);
                  return [3 /*break*/, 9];
              case 8:
                  parsedBody = parsedOutput.body;
                  errorCode = parsedBody.code || parsedBody.Code || errorCode;
                  response = __assign(__assign({}, parsedBody), { name: "" + errorCode, message: parsedBody.message || parsedBody.Message || errorCode, $fault: "client", $metadata: deserializeMetadata(output) });
                  _g.label = 9;
              case 9:
                  message = response.message || response.Message || errorCode;
                  response.message = message;
                  delete response.Message;
                  return [2 /*return*/, Promise.reject(Object.assign(new Error(message), response))];
          }
      });
  }); };
  export var deserializeAws_json1_1PutImageTagMutabilityCommand = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
      var data, contents, response;
      return __generator(this, function (_a) {
          switch (_a.label) {
              case 0:
                  if (output.statusCode >= 300) {
                      return [2 /*return*/, deserializeAws_json1_1PutImageTagMutabilityCommandError(output, context)];
                  }
                  return [4 /*yield*/, parseBody(output.body, context)];
              case 1:
                  data = _a.sent();
                  contents = {};
                  contents = deserializeAws_json1_1PutImageTagMutabilityResponse(data, context);
                  response = __assign({ $metadata: deserializeMetadata(output) }, contents);
                  return [2 /*return*/, Promise.resolve(response)];
          }
      });
  }); };
  var deserializeAws_json1_1PutImageTagMutabilityCommandError = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
      var parsedOutput, _a, response, errorCode, _b, _c, _d, _e, parsedBody, message;
      var _f;
      return __generator(this, function (_g) {
          switch (_g.label) {
              case 0:
                  _a = [__assign({}, output)];
                  _f = {};
                  return [4 /*yield*/, parseBody(output.body, context)];
              case 1:
                  parsedOutput = __assign.apply(void 0, _a.concat([(_f.body = _g.sent(), _f)]));
                  errorCode = "UnknownError";
                  errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
                  _b = errorCode;
                  switch (_b) {
                      case "InvalidParameterException": return [3 /*break*/, 2];
                      case "com.amazonaws.ecr#InvalidParameterException": return [3 /*break*/, 2];
                      case "RepositoryNotFoundException": return [3 /*break*/, 4];
                      case "com.amazonaws.ecr#RepositoryNotFoundException": return [3 /*break*/, 4];
                      case "ServerException": return [3 /*break*/, 6];
                      case "com.amazonaws.ecr#ServerException": return [3 /*break*/, 6];
                  }
                  return [3 /*break*/, 8];
              case 2:
                  _c = [{}];
                  return [4 /*yield*/, deserializeAws_json1_1InvalidParameterExceptionResponse(parsedOutput, context)];
              case 3:
                  response = __assign.apply(void 0, [__assign.apply(void 0, _c.concat([(_g.sent())])), { name: errorCode, $metadata: deserializeMetadata(output) }]);
                  return [3 /*break*/, 9];
              case 4:
                  _d = [{}];
                  return [4 /*yield*/, deserializeAws_json1_1RepositoryNotFoundExceptionResponse(parsedOutput, context)];
              case 5:
                  response = __assign.apply(void 0, [__assign.apply(void 0, _d.concat([(_g.sent())])), { name: errorCode, $metadata: deserializeMetadata(output) }]);
                  return [3 /*break*/, 9];
              case 6:
                  _e = [{}];
                  return [4 /*yield*/, deserializeAws_json1_1ServerExceptionResponse(parsedOutput, context)];
              case 7:
                  response = __assign.apply(void 0, [__assign.apply(void 0, _e.concat([(_g.sent())])), { name: errorCode, $metadata: deserializeMetadata(output) }]);
                  return [3 /*break*/, 9];
              case 8:
                  parsedBody = parsedOutput.body;
                  errorCode = parsedBody.code || parsedBody.Code || errorCode;
                  response = __assign(__assign({}, parsedBody), { name: "" + errorCode, message: parsedBody.message || parsedBody.Message || errorCode, $fault: "client", $metadata: deserializeMetadata(output) });
                  _g.label = 9;
              case 9:
                  message = response.message || response.Message || errorCode;
                  response.message = message;
                  delete response.Message;
                  return [2 /*return*/, Promise.reject(Object.assign(new Error(message), response))];
          }
      });
  }); };
  export var deserializeAws_json1_1PutLifecyclePolicyCommand = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
      var data, contents, response;
      return __generator(this, function (_a) {
          switch (_a.label) {
              case 0:
                  if (output.statusCode >= 300) {
                      return [2 /*return*/, deserializeAws_json1_1PutLifecyclePolicyCommandError(output, context)];
                  }
                  return [4 /*yield*/, parseBody(output.body, context)];
              case 1:
                  data = _a.sent();
                  contents = {};
                  contents = deserializeAws_json1_1PutLifecyclePolicyResponse(data, context);
                  response = __assign({ $metadata: deserializeMetadata(output) }, contents);
                  return [2 /*return*/, Promise.resolve(response)];
          }
      });
  }); };
  var deserializeAws_json1_1PutLifecyclePolicyCommandError = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
      var parsedOutput, _a, response, errorCode, _b, _c, _d, _e, parsedBody, message;
      var _f;
      return __generator(this, function (_g) {
          switch (_g.label) {
              case 0:
                  _a = [__assign({}, output)];
                  _f = {};
                  return [4 /*yield*/, parseBody(output.body, context)];
              case 1:
                  parsedOutput = __assign.apply(void 0, _a.concat([(_f.body = _g.sent(), _f)]));
                  errorCode = "UnknownError";
                  errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
                  _b = errorCode;
                  switch (_b) {
                      case "InvalidParameterException": return [3 /*break*/, 2];
                      case "com.amazonaws.ecr#InvalidParameterException": return [3 /*break*/, 2];
                      case "RepositoryNotFoundException": return [3 /*break*/, 4];
                      case "com.amazonaws.ecr#RepositoryNotFoundException": return [3 /*break*/, 4];
                      case "ServerException": return [3 /*break*/, 6];
                      case "com.amazonaws.ecr#ServerException": return [3 /*break*/, 6];
                  }
                  return [3 /*break*/, 8];
              case 2:
                  _c = [{}];
                  return [4 /*yield*/, deserializeAws_json1_1InvalidParameterExceptionResponse(parsedOutput, context)];
              case 3:
                  response = __assign.apply(void 0, [__assign.apply(void 0, _c.concat([(_g.sent())])), { name: errorCode, $metadata: deserializeMetadata(output) }]);
                  return [3 /*break*/, 9];
              case 4:
                  _d = [{}];
                  return [4 /*yield*/, deserializeAws_json1_1RepositoryNotFoundExceptionResponse(parsedOutput, context)];
              case 5:
                  response = __assign.apply(void 0, [__assign.apply(void 0, _d.concat([(_g.sent())])), { name: errorCode, $metadata: deserializeMetadata(output) }]);
                  return [3 /*break*/, 9];
              case 6:
                  _e = [{}];
                  return [4 /*yield*/, deserializeAws_json1_1ServerExceptionResponse(parsedOutput, context)];
              case 7:
                  response = __assign.apply(void 0, [__assign.apply(void 0, _e.concat([(_g.sent())])), { name: errorCode, $metadata: deserializeMetadata(output) }]);
                  return [3 /*break*/, 9];
              case 8:
                  parsedBody = parsedOutput.body;
                  errorCode = parsedBody.code || parsedBody.Code || errorCode;
                  response = __assign(__assign({}, parsedBody), { name: "" + errorCode, message: parsedBody.message || parsedBody.Message || errorCode, $fault: "client", $metadata: deserializeMetadata(output) });
                  _g.label = 9;
              case 9:
                  message = response.message || response.Message || errorCode;
                  response.message = message;
                  delete response.Message;
                  return [2 /*return*/, Promise.reject(Object.assign(new Error(message), response))];
          }
      });
  }); };
  export var deserializeAws_json1_1PutRegistryPolicyCommand = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
      var data, contents, response;
      return __generator(this, function (_a) {
          switch (_a.label) {
              case 0:
                  if (output.statusCode >= 300) {
                      return [2 /*return*/, deserializeAws_json1_1PutRegistryPolicyCommandError(output, context)];
                  }
                  return [4 /*yield*/, parseBody(output.body, context)];
              case 1:
                  data = _a.sent();
                  contents = {};
                  contents = deserializeAws_json1_1PutRegistryPolicyResponse(data, context);
                  response = __assign({ $metadata: deserializeMetadata(output) }, contents);
                  return [2 /*return*/, Promise.resolve(response)];
          }
      });
  }); };
  var deserializeAws_json1_1PutRegistryPolicyCommandError = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
      var parsedOutput, _a, response, errorCode, _b, _c, _d, parsedBody, message;
      var _e;
      return __generator(this, function (_f) {
          switch (_f.label) {
              case 0:
                  _a = [__assign({}, output)];
                  _e = {};
                  return [4 /*yield*/, parseBody(output.body, context)];
              case 1:
                  parsedOutput = __assign.apply(void 0, _a.concat([(_e.body = _f.sent(), _e)]));
                  errorCode = "UnknownError";
                  errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
                  _b = errorCode;
                  switch (_b) {
                      case "InvalidParameterException": return [3 /*break*/, 2];
                      case "com.amazonaws.ecr#InvalidParameterException": return [3 /*break*/, 2];
                      case "ServerException": return [3 /*break*/, 4];
                      case "com.amazonaws.ecr#ServerException": return [3 /*break*/, 4];
                  }
                  return [3 /*break*/, 6];
              case 2:
                  _c = [{}];
                  return [4 /*yield*/, deserializeAws_json1_1InvalidParameterExceptionResponse(parsedOutput, context)];
              case 3:
                  response = __assign.apply(void 0, [__assign.apply(void 0, _c.concat([(_f.sent())])), { name: errorCode, $metadata: deserializeMetadata(output) }]);
                  return [3 /*break*/, 7];
              case 4:
                  _d = [{}];
                  return [4 /*yield*/, deserializeAws_json1_1ServerExceptionResponse(parsedOutput, context)];
              case 5:
                  response = __assign.apply(void 0, [__assign.apply(void 0, _d.concat([(_f.sent())])), { name: errorCode, $metadata: deserializeMetadata(output) }]);
                  return [3 /*break*/, 7];
              case 6:
                  parsedBody = parsedOutput.body;
                  errorCode = parsedBody.code || parsedBody.Code || errorCode;
                  response = __assign(__assign({}, parsedBody), { name: "" + errorCode, message: parsedBody.message || parsedBody.Message || errorCode, $fault: "client", $metadata: deserializeMetadata(output) });
                  _f.label = 7;
              case 7:
                  message = response.message || response.Message || errorCode;
                  response.message = message;
                  delete response.Message;
                  return [2 /*return*/, Promise.reject(Object.assign(new Error(message), response))];
          }
      });
  }); };
  export var deserializeAws_json1_1PutReplicationConfigurationCommand = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
      var data, contents, response;
      return __generator(this, function (_a) {
          switch (_a.label) {
              case 0:
                  if (output.statusCode >= 300) {
                      return [2 /*return*/, deserializeAws_json1_1PutReplicationConfigurationCommandError(output, context)];
                  }
                  return [4 /*yield*/, parseBody(output.body, context)];
              case 1:
                  data = _a.sent();
                  contents = {};
                  contents = deserializeAws_json1_1PutReplicationConfigurationResponse(data, context);
                  response = __assign({ $metadata: deserializeMetadata(output) }, contents);
                  return [2 /*return*/, Promise.resolve(response)];
          }
      });
  }); };
  var deserializeAws_json1_1PutReplicationConfigurationCommandError = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
      var parsedOutput, _a, response, errorCode, _b, _c, _d, _e, parsedBody, message;
      var _f;
      return __generator(this, function (_g) {
          switch (_g.label) {
              case 0:
                  _a = [__assign({}, output)];
                  _f = {};
                  return [4 /*yield*/, parseBody(output.body, context)];
              case 1:
                  parsedOutput = __assign.apply(void 0, _a.concat([(_f.body = _g.sent(), _f)]));
                  errorCode = "UnknownError";
                  errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
                  _b = errorCode;
                  switch (_b) {
                      case "InvalidParameterException": return [3 /*break*/, 2];
                      case "com.amazonaws.ecr#InvalidParameterException": return [3 /*break*/, 2];
                      case "ServerException": return [3 /*break*/, 4];
                      case "com.amazonaws.ecr#ServerException": return [3 /*break*/, 4];
                      case "ValidationException": return [3 /*break*/, 6];
                      case "com.amazonaws.ecr#ValidationException": return [3 /*break*/, 6];
                  }
                  return [3 /*break*/, 8];
              case 2:
                  _c = [{}];
                  return [4 /*yield*/, deserializeAws_json1_1InvalidParameterExceptionResponse(parsedOutput, context)];
              case 3:
                  response = __assign.apply(void 0, [__assign.apply(void 0, _c.concat([(_g.sent())])), { name: errorCode, $metadata: deserializeMetadata(output) }]);
                  return [3 /*break*/, 9];
              case 4:
                  _d = [{}];
                  return [4 /*yield*/, deserializeAws_json1_1ServerExceptionResponse(parsedOutput, context)];
              case 5:
                  response = __assign.apply(void 0, [__assign.apply(void 0, _d.concat([(_g.sent())])), { name: errorCode, $metadata: deserializeMetadata(output) }]);
                  return [3 /*break*/, 9];
              case 6:
                  _e = [{}];
                  return [4 /*yield*/, deserializeAws_json1_1ValidationExceptionResponse(parsedOutput, context)];
              case 7:
                  response = __assign.apply(void 0, [__assign.apply(void 0, _e.concat([(_g.sent())])), { name: errorCode, $metadata: deserializeMetadata(output) }]);
                  return [3 /*break*/, 9];
              case 8:
                  parsedBody = parsedOutput.body;
                  errorCode = parsedBody.code || parsedBody.Code || errorCode;
                  response = __assign(__assign({}, parsedBody), { name: "" + errorCode, message: parsedBody.message || parsedBody.Message || errorCode, $fault: "client", $metadata: deserializeMetadata(output) });
                  _g.label = 9;
              case 9:
                  message = response.message || response.Message || errorCode;
                  response.message = message;
                  delete response.Message;
                  return [2 /*return*/, Promise.reject(Object.assign(new Error(message), response))];
          }
      });
  }); };
  export var deserializeAws_json1_1SetRepositoryPolicyCommand = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
      var data, contents, response;
      return __generator(this, function (_a) {
          switch (_a.label) {
              case 0:
                  if (output.statusCode >= 300) {
                      return [2 /*return*/, deserializeAws_json1_1SetRepositoryPolicyCommandError(output, context)];
                  }
                  return [4 /*yield*/, parseBody(output.body, context)];
              case 1:
                  data = _a.sent();
                  contents = {};
                  contents = deserializeAws_json1_1SetRepositoryPolicyResponse(data, context);
                  response = __assign({ $metadata: deserializeMetadata(output) }, contents);
                  return [2 /*return*/, Promise.resolve(response)];
          }
      });
  }); };
  var deserializeAws_json1_1SetRepositoryPolicyCommandError = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
      var parsedOutput, _a, response, errorCode, _b, _c, _d, _e, parsedBody, message;
      var _f;
      return __generator(this, function (_g) {
          switch (_g.label) {
              case 0:
                  _a = [__assign({}, output)];
                  _f = {};
                  return [4 /*yield*/, parseBody(output.body, context)];
              case 1:
                  parsedOutput = __assign.apply(void 0, _a.concat([(_f.body = _g.sent(), _f)]));
                  errorCode = "UnknownError";
                  errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
                  _b = errorCode;
                  switch (_b) {
                      case "InvalidParameterException": return [3 /*break*/, 2];
                      case "com.amazonaws.ecr#InvalidParameterException": return [3 /*break*/, 2];
                      case "RepositoryNotFoundException": return [3 /*break*/, 4];
                      case "com.amazonaws.ecr#RepositoryNotFoundException": return [3 /*break*/, 4];
                      case "ServerException": return [3 /*break*/, 6];
                      case "com.amazonaws.ecr#ServerException": return [3 /*break*/, 6];
                  }
                  return [3 /*break*/, 8];
              case 2:
                  _c = [{}];
                  return [4 /*yield*/, deserializeAws_json1_1InvalidParameterExceptionResponse(parsedOutput, context)];
              case 3:
                  response = __assign.apply(void 0, [__assign.apply(void 0, _c.concat([(_g.sent())])), { name: errorCode, $metadata: deserializeMetadata(output) }]);
                  return [3 /*break*/, 9];
              case 4:
                  _d = [{}];
                  return [4 /*yield*/, deserializeAws_json1_1RepositoryNotFoundExceptionResponse(parsedOutput, context)];
              case 5:
                  response = __assign.apply(void 0, [__assign.apply(void 0, _d.concat([(_g.sent())])), { name: errorCode, $metadata: deserializeMetadata(output) }]);
                  return [3 /*break*/, 9];
              case 6:
                  _e = [{}];
                  return [4 /*yield*/, deserializeAws_json1_1ServerExceptionResponse(parsedOutput, context)];
              case 7:
                  response = __assign.apply(void 0, [__assign.apply(void 0, _e.concat([(_g.sent())])), { name: errorCode, $metadata: deserializeMetadata(output) }]);
                  return [3 /*break*/, 9];
              case 8:
                  parsedBody = parsedOutput.body;
                  errorCode = parsedBody.code || parsedBody.Code || errorCode;
                  response = __assign(__assign({}, parsedBody), { name: "" + errorCode, message: parsedBody.message || parsedBody.Message || errorCode, $fault: "client", $metadata: deserializeMetadata(output) });
                  _g.label = 9;
              case 9:
                  message = response.message || response.Message || errorCode;
                  response.message = message;
                  delete response.Message;
                  return [2 /*return*/, Promise.reject(Object.assign(new Error(message), response))];
          }
      });
  }); };
  export var deserializeAws_json1_1StartImageScanCommand = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
      var data, contents, response;
      return __generator(this, function (_a) {
          switch (_a.label) {
              case 0:
                  if (output.statusCode >= 300) {
                      return [2 /*return*/, deserializeAws_json1_1StartImageScanCommandError(output, context)];
                  }
                  return [4 /*yield*/, parseBody(output.body, context)];
              case 1:
                  data = _a.sent();
                  contents = {};
                  contents = deserializeAws_json1_1StartImageScanResponse(data, context);
                  response = __assign({ $metadata: deserializeMetadata(output) }, contents);
                  return [2 /*return*/, Promise.resolve(response)];
          }
      });
  }); };
  var deserializeAws_json1_1StartImageScanCommandError = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
      var parsedOutput, _a, response, errorCode, _b, _c, _d, _e, _f, _g, _h, parsedBody, message;
      var _j;
      return __generator(this, function (_k) {
          switch (_k.label) {
              case 0:
                  _a = [__assign({}, output)];
                  _j = {};
                  return [4 /*yield*/, parseBody(output.body, context)];
              case 1:
                  parsedOutput = __assign.apply(void 0, _a.concat([(_j.body = _k.sent(), _j)]));
                  errorCode = "UnknownError";
                  errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
                  _b = errorCode;
                  switch (_b) {
                      case "ImageNotFoundException": return [3 /*break*/, 2];
                      case "com.amazonaws.ecr#ImageNotFoundException": return [3 /*break*/, 2];
                      case "InvalidParameterException": return [3 /*break*/, 4];
                      case "com.amazonaws.ecr#InvalidParameterException": return [3 /*break*/, 4];
                      case "LimitExceededException": return [3 /*break*/, 6];
                      case "com.amazonaws.ecr#LimitExceededException": return [3 /*break*/, 6];
                      case "RepositoryNotFoundException": return [3 /*break*/, 8];
                      case "com.amazonaws.ecr#RepositoryNotFoundException": return [3 /*break*/, 8];
                      case "ServerException": return [3 /*break*/, 10];
                      case "com.amazonaws.ecr#ServerException": return [3 /*break*/, 10];
                      case "UnsupportedImageTypeException": return [3 /*break*/, 12];
                      case "com.amazonaws.ecr#UnsupportedImageTypeException": return [3 /*break*/, 12];
                  }
                  return [3 /*break*/, 14];
              case 2:
                  _c = [{}];
                  return [4 /*yield*/, deserializeAws_json1_1ImageNotFoundExceptionResponse(parsedOutput, context)];
              case 3:
                  response = __assign.apply(void 0, [__assign.apply(void 0, _c.concat([(_k.sent())])), { name: errorCode, $metadata: deserializeMetadata(output) }]);
                  return [3 /*break*/, 15];
              case 4:
                  _d = [{}];
                  return [4 /*yield*/, deserializeAws_json1_1InvalidParameterExceptionResponse(parsedOutput, context)];
              case 5:
                  response = __assign.apply(void 0, [__assign.apply(void 0, _d.concat([(_k.sent())])), { name: errorCode, $metadata: deserializeMetadata(output) }]);
                  return [3 /*break*/, 15];
              case 6:
                  _e = [{}];
                  return [4 /*yield*/, deserializeAws_json1_1LimitExceededExceptionResponse(parsedOutput, context)];
              case 7:
                  response = __assign.apply(void 0, [__assign.apply(void 0, _e.concat([(_k.sent())])), { name: errorCode, $metadata: deserializeMetadata(output) }]);
                  return [3 /*break*/, 15];
              case 8:
                  _f = [{}];
                  return [4 /*yield*/, deserializeAws_json1_1RepositoryNotFoundExceptionResponse(parsedOutput, context)];
              case 9:
                  response = __assign.apply(void 0, [__assign.apply(void 0, _f.concat([(_k.sent())])), { name: errorCode, $metadata: deserializeMetadata(output) }]);
                  return [3 /*break*/, 15];
              case 10:
                  _g = [{}];
                  return [4 /*yield*/, deserializeAws_json1_1ServerExceptionResponse(parsedOutput, context)];
              case 11:
                  response = __assign.apply(void 0, [__assign.apply(void 0, _g.concat([(_k.sent())])), { name: errorCode, $metadata: deserializeMetadata(output) }]);
                  return [3 /*break*/, 15];
              case 12:
                  _h = [{}];
                  return [4 /*yield*/, deserializeAws_json1_1UnsupportedImageTypeExceptionResponse(parsedOutput, context)];
              case 13:
                  response = __assign.apply(void 0, [__assign.apply(void 0, _h.concat([(_k.sent())])), { name: errorCode, $metadata: deserializeMetadata(output) }]);
                  return [3 /*break*/, 15];
              case 14:
                  parsedBody = parsedOutput.body;
                  errorCode = parsedBody.code || parsedBody.Code || errorCode;
                  response = __assign(__assign({}, parsedBody), { name: "" + errorCode, message: parsedBody.message || parsedBody.Message || errorCode, $fault: "client", $metadata: deserializeMetadata(output) });
                  _k.label = 15;
              case 15:
                  message = response.message || response.Message || errorCode;
                  response.message = message;
                  delete response.Message;
                  return [2 /*return*/, Promise.reject(Object.assign(new Error(message), response))];
          }
      });
  }); };
  export var deserializeAws_json1_1StartLifecyclePolicyPreviewCommand = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
      var data, contents, response;
      return __generator(this, function (_a) {
          switch (_a.label) {
              case 0:
                  if (output.statusCode >= 300) {
                      return [2 /*return*/, deserializeAws_json1_1StartLifecyclePolicyPreviewCommandError(output, context)];
                  }
                  return [4 /*yield*/, parseBody(output.body, context)];
              case 1:
                  data = _a.sent();
                  contents = {};
                  contents = deserializeAws_json1_1StartLifecyclePolicyPreviewResponse(data, context);
                  response = __assign({ $metadata: deserializeMetadata(output) }, contents);
                  return [2 /*return*/, Promise.resolve(response)];
          }
      });
  }); };
  var deserializeAws_json1_1StartLifecyclePolicyPreviewCommandError = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
      var parsedOutput, _a, response, errorCode, _b, _c, _d, _e, _f, _g, parsedBody, message;
      var _h;
      return __generator(this, function (_j) {
          switch (_j.label) {
              case 0:
                  _a = [__assign({}, output)];
                  _h = {};
                  return [4 /*yield*/, parseBody(output.body, context)];
              case 1:
                  parsedOutput = __assign.apply(void 0, _a.concat([(_h.body = _j.sent(), _h)]));
                  errorCode = "UnknownError";
                  errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
                  _b = errorCode;
                  switch (_b) {
                      case "InvalidParameterException": return [3 /*break*/, 2];
                      case "com.amazonaws.ecr#InvalidParameterException": return [3 /*break*/, 2];
                      case "LifecyclePolicyNotFoundException": return [3 /*break*/, 4];
                      case "com.amazonaws.ecr#LifecyclePolicyNotFoundException": return [3 /*break*/, 4];
                      case "LifecyclePolicyPreviewInProgressException": return [3 /*break*/, 6];
                      case "com.amazonaws.ecr#LifecyclePolicyPreviewInProgressException": return [3 /*break*/, 6];
                      case "RepositoryNotFoundException": return [3 /*break*/, 8];
                      case "com.amazonaws.ecr#RepositoryNotFoundException": return [3 /*break*/, 8];
                      case "ServerException": return [3 /*break*/, 10];
                      case "com.amazonaws.ecr#ServerException": return [3 /*break*/, 10];
                  }
                  return [3 /*break*/, 12];
              case 2:
                  _c = [{}];
                  return [4 /*yield*/, deserializeAws_json1_1InvalidParameterExceptionResponse(parsedOutput, context)];
              case 3:
                  response = __assign.apply(void 0, [__assign.apply(void 0, _c.concat([(_j.sent())])), { name: errorCode, $metadata: deserializeMetadata(output) }]);
                  return [3 /*break*/, 13];
              case 4:
                  _d = [{}];
                  return [4 /*yield*/, deserializeAws_json1_1LifecyclePolicyNotFoundExceptionResponse(parsedOutput, context)];
              case 5:
                  response = __assign.apply(void 0, [__assign.apply(void 0, _d.concat([(_j.sent())])), { name: errorCode, $metadata: deserializeMetadata(output) }]);
                  return [3 /*break*/, 13];
              case 6:
                  _e = [{}];
                  return [4 /*yield*/, deserializeAws_json1_1LifecyclePolicyPreviewInProgressExceptionResponse(parsedOutput, context)];
              case 7:
                  response = __assign.apply(void 0, [__assign.apply(void 0, _e.concat([(_j.sent())])), { name: errorCode, $metadata: deserializeMetadata(output) }]);
                  return [3 /*break*/, 13];
              case 8:
                  _f = [{}];
                  return [4 /*yield*/, deserializeAws_json1_1RepositoryNotFoundExceptionResponse(parsedOutput, context)];
              case 9:
                  response = __assign.apply(void 0, [__assign.apply(void 0, _f.concat([(_j.sent())])), { name: errorCode, $metadata: deserializeMetadata(output) }]);
                  return [3 /*break*/, 13];
              case 10:
                  _g = [{}];
                  return [4 /*yield*/, deserializeAws_json1_1ServerExceptionResponse(parsedOutput, context)];
              case 11:
                  response = __assign.apply(void 0, [__assign.apply(void 0, _g.concat([(_j.sent())])), { name: errorCode, $metadata: deserializeMetadata(output) }]);
                  return [3 /*break*/, 13];
              case 12:
                  parsedBody = parsedOutput.body;
                  errorCode = parsedBody.code || parsedBody.Code || errorCode;
                  response = __assign(__assign({}, parsedBody), { name: "" + errorCode, message: parsedBody.message || parsedBody.Message || errorCode, $fault: "client", $metadata: deserializeMetadata(output) });
                  _j.label = 13;
              case 13:
                  message = response.message || response.Message || errorCode;
                  response.message = message;
                  delete response.Message;
                  return [2 /*return*/, Promise.reject(Object.assign(new Error(message), response))];
          }
      });
  }); };
  export var deserializeAws_json1_1TagResourceCommand = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
      var data, contents, response;
      return __generator(this, function (_a) {
          switch (_a.label) {
              case 0:
                  if (output.statusCode >= 300) {
                      return [2 /*return*/, deserializeAws_json1_1TagResourceCommandError(output, context)];
                  }
                  return [4 /*yield*/, parseBody(output.body, context)];
              case 1:
                  data = _a.sent();
                  contents = {};
                  contents = deserializeAws_json1_1TagResourceResponse(data, context);
                  response = __assign({ $metadata: deserializeMetadata(output) }, contents);
                  return [2 /*return*/, Promise.resolve(response)];
          }
      });
  }); };
  var deserializeAws_json1_1TagResourceCommandError = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
      var parsedOutput, _a, response, errorCode, _b, _c, _d, _e, _f, _g, parsedBody, message;
      var _h;
      return __generator(this, function (_j) {
          switch (_j.label) {
              case 0:
                  _a = [__assign({}, output)];
                  _h = {};
                  return [4 /*yield*/, parseBody(output.body, context)];
              case 1:
                  parsedOutput = __assign.apply(void 0, _a.concat([(_h.body = _j.sent(), _h)]));
                  errorCode = "UnknownError";
                  errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
                  _b = errorCode;
                  switch (_b) {
                      case "InvalidParameterException": return [3 /*break*/, 2];
                      case "com.amazonaws.ecr#InvalidParameterException": return [3 /*break*/, 2];
                      case "InvalidTagParameterException": return [3 /*break*/, 4];
                      case "com.amazonaws.ecr#InvalidTagParameterException": return [3 /*break*/, 4];
                      case "RepositoryNotFoundException": return [3 /*break*/, 6];
                      case "com.amazonaws.ecr#RepositoryNotFoundException": return [3 /*break*/, 6];
                      case "ServerException": return [3 /*break*/, 8];
                      case "com.amazonaws.ecr#ServerException": return [3 /*break*/, 8];
                      case "TooManyTagsException": return [3 /*break*/, 10];
                      case "com.amazonaws.ecr#TooManyTagsException": return [3 /*break*/, 10];
                  }
                  return [3 /*break*/, 12];
              case 2:
                  _c = [{}];
                  return [4 /*yield*/, deserializeAws_json1_1InvalidParameterExceptionResponse(parsedOutput, context)];
              case 3:
                  response = __assign.apply(void 0, [__assign.apply(void 0, _c.concat([(_j.sent())])), { name: errorCode, $metadata: deserializeMetadata(output) }]);
                  return [3 /*break*/, 13];
              case 4:
                  _d = [{}];
                  return [4 /*yield*/, deserializeAws_json1_1InvalidTagParameterExceptionResponse(parsedOutput, context)];
              case 5:
                  response = __assign.apply(void 0, [__assign.apply(void 0, _d.concat([(_j.sent())])), { name: errorCode, $metadata: deserializeMetadata(output) }]);
                  return [3 /*break*/, 13];
              case 6:
                  _e = [{}];
                  return [4 /*yield*/, deserializeAws_json1_1RepositoryNotFoundExceptionResponse(parsedOutput, context)];
              case 7:
                  response = __assign.apply(void 0, [__assign.apply(void 0, _e.concat([(_j.sent())])), { name: errorCode, $metadata: deserializeMetadata(output) }]);
                  return [3 /*break*/, 13];
              case 8:
                  _f = [{}];
                  return [4 /*yield*/, deserializeAws_json1_1ServerExceptionResponse(parsedOutput, context)];
              case 9:
                  response = __assign.apply(void 0, [__assign.apply(void 0, _f.concat([(_j.sent())])), { name: errorCode, $metadata: deserializeMetadata(output) }]);
                  return [3 /*break*/, 13];
              case 10:
                  _g = [{}];
                  return [4 /*yield*/, deserializeAws_json1_1TooManyTagsExceptionResponse(parsedOutput, context)];
              case 11:
                  response = __assign.apply(void 0, [__assign.apply(void 0, _g.concat([(_j.sent())])), { name: errorCode, $metadata: deserializeMetadata(output) }]);
                  return [3 /*break*/, 13];
              case 12:
                  parsedBody = parsedOutput.body;
                  errorCode = parsedBody.code || parsedBody.Code || errorCode;
                  response = __assign(__assign({}, parsedBody), { name: "" + errorCode, message: parsedBody.message || parsedBody.Message || errorCode, $fault: "client", $metadata: deserializeMetadata(output) });
                  _j.label = 13;
              case 13:
                  message = response.message || response.Message || errorCode;
                  response.message = message;
                  delete response.Message;
                  return [2 /*return*/, Promise.reject(Object.assign(new Error(message), response))];
          }
      });
  }); };
  export var deserializeAws_json1_1UntagResourceCommand = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
      var data, contents, response;
      return __generator(this, function (_a) {
          switch (_a.label) {
              case 0:
                  if (output.statusCode >= 300) {
                      return [2 /*return*/, deserializeAws_json1_1UntagResourceCommandError(output, context)];
                  }
                  return [4 /*yield*/, parseBody(output.body, context)];
              case 1:
                  data = _a.sent();
                  contents = {};
                  contents = deserializeAws_json1_1UntagResourceResponse(data, context);
                  response = __assign({ $metadata: deserializeMetadata(output) }, contents);
                  return [2 /*return*/, Promise.resolve(response)];
          }
      });
  }); };
  var deserializeAws_json1_1UntagResourceCommandError = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
      var parsedOutput, _a, response, errorCode, _b, _c, _d, _e, _f, _g, parsedBody, message;
      var _h;
      return __generator(this, function (_j) {
          switch (_j.label) {
              case 0:
                  _a = [__assign({}, output)];
                  _h = {};
                  return [4 /*yield*/, parseBody(output.body, context)];
              case 1:
                  parsedOutput = __assign.apply(void 0, _a.concat([(_h.body = _j.sent(), _h)]));
                  errorCode = "UnknownError";
                  errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
                  _b = errorCode;
                  switch (_b) {
                      case "InvalidParameterException": return [3 /*break*/, 2];
                      case "com.amazonaws.ecr#InvalidParameterException": return [3 /*break*/, 2];
                      case "InvalidTagParameterException": return [3 /*break*/, 4];
                      case "com.amazonaws.ecr#InvalidTagParameterException": return [3 /*break*/, 4];
                      case "RepositoryNotFoundException": return [3 /*break*/, 6];
                      case "com.amazonaws.ecr#RepositoryNotFoundException": return [3 /*break*/, 6];
                      case "ServerException": return [3 /*break*/, 8];
                      case "com.amazonaws.ecr#ServerException": return [3 /*break*/, 8];
                      case "TooManyTagsException": return [3 /*break*/, 10];
                      case "com.amazonaws.ecr#TooManyTagsException": return [3 /*break*/, 10];
                  }
                  return [3 /*break*/, 12];
              case 2:
                  _c = [{}];
                  return [4 /*yield*/, deserializeAws_json1_1InvalidParameterExceptionResponse(parsedOutput, context)];
              case 3:
                  response = __assign.apply(void 0, [__assign.apply(void 0, _c.concat([(_j.sent())])), { name: errorCode, $metadata: deserializeMetadata(output) }]);
                  return [3 /*break*/, 13];
              case 4:
                  _d = [{}];
                  return [4 /*yield*/, deserializeAws_json1_1InvalidTagParameterExceptionResponse(parsedOutput, context)];
              case 5:
                  response = __assign.apply(void 0, [__assign.apply(void 0, _d.concat([(_j.sent())])), { name: errorCode, $metadata: deserializeMetadata(output) }]);
                  return [3 /*break*/, 13];
              case 6:
                  _e = [{}];
                  return [4 /*yield*/, deserializeAws_json1_1RepositoryNotFoundExceptionResponse(parsedOutput, context)];
              case 7:
                  response = __assign.apply(void 0, [__assign.apply(void 0, _e.concat([(_j.sent())])), { name: errorCode, $metadata: deserializeMetadata(output) }]);
                  return [3 /*break*/, 13];
              case 8:
                  _f = [{}];
                  return [4 /*yield*/, deserializeAws_json1_1ServerExceptionResponse(parsedOutput, context)];
              case 9:
                  response = __assign.apply(void 0, [__assign.apply(void 0, _f.concat([(_j.sent())])), { name: errorCode, $metadata: deserializeMetadata(output) }]);
                  return [3 /*break*/, 13];
              case 10:
                  _g = [{}];
                  return [4 /*yield*/, deserializeAws_json1_1TooManyTagsExceptionResponse(parsedOutput, context)];
              case 11:
                  response = __assign.apply(void 0, [__assign.apply(void 0, _g.concat([(_j.sent())])), { name: errorCode, $metadata: deserializeMetadata(output) }]);
                  return [3 /*break*/, 13];
              case 12:
                  parsedBody = parsedOutput.body;
                  errorCode = parsedBody.code || parsedBody.Code || errorCode;
                  response = __assign(__assign({}, parsedBody), { name: "" + errorCode, message: parsedBody.message || parsedBody.Message || errorCode, $fault: "client", $metadata: deserializeMetadata(output) });
                  _j.label = 13;
              case 13:
                  message = response.message || response.Message || errorCode;
                  response.message = message;
                  delete response.Message;
                  return [2 /*return*/, Promise.reject(Object.assign(new Error(message), response))];
          }
      });
  }); };
  export var deserializeAws_json1_1UploadLayerPartCommand = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
      var data, contents, response;
      return __generator(this, function (_a) {
          switch (_a.label) {
              case 0:
                  if (output.statusCode >= 300) {
                      return [2 /*return*/, deserializeAws_json1_1UploadLayerPartCommandError(output, context)];
                  }
                  return [4 /*yield*/, parseBody(output.body, context)];
              case 1:
                  data = _a.sent();
                  contents = {};
                  contents = deserializeAws_json1_1UploadLayerPartResponse(data, context);
                  response = __assign({ $metadata: deserializeMetadata(output) }, contents);
                  return [2 /*return*/, Promise.resolve(response)];
          }
      });
  }); };
  var deserializeAws_json1_1UploadLayerPartCommandError = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
      var parsedOutput, _a, response, errorCode, _b, _c, _d, _e, _f, _g, _h, _j, parsedBody, message;
      var _k;
      return __generator(this, function (_l) {
          switch (_l.label) {
              case 0:
                  _a = [__assign({}, output)];
                  _k = {};
                  return [4 /*yield*/, parseBody(output.body, context)];
              case 1:
                  parsedOutput = __assign.apply(void 0, _a.concat([(_k.body = _l.sent(), _k)]));
                  errorCode = "UnknownError";
                  errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
                  _b = errorCode;
                  switch (_b) {
                      case "InvalidLayerPartException": return [3 /*break*/, 2];
                      case "com.amazonaws.ecr#InvalidLayerPartException": return [3 /*break*/, 2];
                      case "InvalidParameterException": return [3 /*break*/, 4];
                      case "com.amazonaws.ecr#InvalidParameterException": return [3 /*break*/, 4];
                      case "KmsException": return [3 /*break*/, 6];
                      case "com.amazonaws.ecr#KmsException": return [3 /*break*/, 6];
                      case "LimitExceededException": return [3 /*break*/, 8];
                      case "com.amazonaws.ecr#LimitExceededException": return [3 /*break*/, 8];
                      case "RepositoryNotFoundException": return [3 /*break*/, 10];
                      case "com.amazonaws.ecr#RepositoryNotFoundException": return [3 /*break*/, 10];
                      case "ServerException": return [3 /*break*/, 12];
                      case "com.amazonaws.ecr#ServerException": return [3 /*break*/, 12];
                      case "UploadNotFoundException": return [3 /*break*/, 14];
                      case "com.amazonaws.ecr#UploadNotFoundException": return [3 /*break*/, 14];
                  }
                  return [3 /*break*/, 16];
              case 2:
                  _c = [{}];
                  return [4 /*yield*/, deserializeAws_json1_1InvalidLayerPartExceptionResponse(parsedOutput, context)];
              case 3:
                  response = __assign.apply(void 0, [__assign.apply(void 0, _c.concat([(_l.sent())])), { name: errorCode, $metadata: deserializeMetadata(output) }]);
                  return [3 /*break*/, 17];
              case 4:
                  _d = [{}];
                  return [4 /*yield*/, deserializeAws_json1_1InvalidParameterExceptionResponse(parsedOutput, context)];
              case 5:
                  response = __assign.apply(void 0, [__assign.apply(void 0, _d.concat([(_l.sent())])), { name: errorCode, $metadata: deserializeMetadata(output) }]);
                  return [3 /*break*/, 17];
              case 6:
                  _e = [{}];
                  return [4 /*yield*/, deserializeAws_json1_1KmsExceptionResponse(parsedOutput, context)];
              case 7:
                  response = __assign.apply(void 0, [__assign.apply(void 0, _e.concat([(_l.sent())])), { name: errorCode, $metadata: deserializeMetadata(output) }]);
                  return [3 /*break*/, 17];
              case 8:
                  _f = [{}];
                  return [4 /*yield*/, deserializeAws_json1_1LimitExceededExceptionResponse(parsedOutput, context)];
              case 9:
                  response = __assign.apply(void 0, [__assign.apply(void 0, _f.concat([(_l.sent())])), { name: errorCode, $metadata: deserializeMetadata(output) }]);
                  return [3 /*break*/, 17];
              case 10:
                  _g = [{}];
                  return [4 /*yield*/, deserializeAws_json1_1RepositoryNotFoundExceptionResponse(parsedOutput, context)];
              case 11:
                  response = __assign.apply(void 0, [__assign.apply(void 0, _g.concat([(_l.sent())])), { name: errorCode, $metadata: deserializeMetadata(output) }]);
                  return [3 /*break*/, 17];
              case 12:
                  _h = [{}];
                  return [4 /*yield*/, deserializeAws_json1_1ServerExceptionResponse(parsedOutput, context)];
              case 13:
                  response = __assign.apply(void 0, [__assign.apply(void 0, _h.concat([(_l.sent())])), { name: errorCode, $metadata: deserializeMetadata(output) }]);
                  return [3 /*break*/, 17];
              case 14:
                  _j = [{}];
                  return [4 /*yield*/, deserializeAws_json1_1UploadNotFoundExceptionResponse(parsedOutput, context)];
              case 15:
                  response = __assign.apply(void 0, [__assign.apply(void 0, _j.concat([(_l.sent())])), { name: errorCode, $metadata: deserializeMetadata(output) }]);
                  return [3 /*break*/, 17];
              case 16:
                  parsedBody = parsedOutput.body;
                  errorCode = parsedBody.code || parsedBody.Code || errorCode;
                  response = __assign(__assign({}, parsedBody), { name: "" + errorCode, message: parsedBody.message || parsedBody.Message || errorCode, $fault: "client", $metadata: deserializeMetadata(output) });
                  _l.label = 17;
              case 17:
                  message = response.message || response.Message || errorCode;
                  response.message = message;
                  delete response.Message;
                  return [2 /*return*/, Promise.reject(Object.assign(new Error(message), response))];
          }
      });
  }); };
  var deserializeAws_json1_1EmptyUploadExceptionResponse = function (parsedOutput, context) { return __awaiter(void 0, void 0, void 0, function () {
      var body, deserialized, contents;
      return __generator(this, function (_a) {
          body = parsedOutput.body;
          deserialized = deserializeAws_json1_1EmptyUploadException(body, context);
          contents = __assign({ name: "EmptyUploadException", $fault: "client", $metadata: deserializeMetadata(parsedOutput) }, deserialized);
          return [2 /*return*/, contents];
      });
  }); };
  var deserializeAws_json1_1ImageAlreadyExistsExceptionResponse = function (parsedOutput, context) { return __awaiter(void 0, void 0, void 0, function () {
      var body, deserialized, contents;
      return __generator(this, function (_a) {
          body = parsedOutput.body;
          deserialized = deserializeAws_json1_1ImageAlreadyExistsException(body, context);
          contents = __assign({ name: "ImageAlreadyExistsException", $fault: "client", $metadata: deserializeMetadata(parsedOutput) }, deserialized);
          return [2 /*return*/, contents];
      });
  }); };
  var deserializeAws_json1_1ImageDigestDoesNotMatchExceptionResponse = function (parsedOutput, context) { return __awaiter(void 0, void 0, void 0, function () {
      var body, deserialized, contents;
      return __generator(this, function (_a) {
          body = parsedOutput.body;
          deserialized = deserializeAws_json1_1ImageDigestDoesNotMatchException(body, context);
          contents = __assign({ name: "ImageDigestDoesNotMatchException", $fault: "client", $metadata: deserializeMetadata(parsedOutput) }, deserialized);
          return [2 /*return*/, contents];
      });
  }); };
  var deserializeAws_json1_1ImageNotFoundExceptionResponse = function (parsedOutput, context) { return __awaiter(void 0, void 0, void 0, function () {
      var body, deserialized, contents;
      return __generator(this, function (_a) {
          body = parsedOutput.body;
          deserialized = deserializeAws_json1_1ImageNotFoundException(body, context);
          contents = __assign({ name: "ImageNotFoundException", $fault: "client", $metadata: deserializeMetadata(parsedOutput) }, deserialized);
          return [2 /*return*/, contents];
      });
  }); };
  var deserializeAws_json1_1ImageTagAlreadyExistsExceptionResponse = function (parsedOutput, context) { return __awaiter(void 0, void 0, void 0, function () {
      var body, deserialized, contents;
      return __generator(this, function (_a) {
          body = parsedOutput.body;
          deserialized = deserializeAws_json1_1ImageTagAlreadyExistsException(body, context);
          contents = __assign({ name: "ImageTagAlreadyExistsException", $fault: "client", $metadata: deserializeMetadata(parsedOutput) }, deserialized);
          return [2 /*return*/, contents];
      });
  }); };
  var deserializeAws_json1_1InvalidLayerExceptionResponse = function (parsedOutput, context) { return __awaiter(void 0, void 0, void 0, function () {
      var body, deserialized, contents;
      return __generator(this, function (_a) {
          body = parsedOutput.body;
          deserialized = deserializeAws_json1_1InvalidLayerException(body, context);
          contents = __assign({ name: "InvalidLayerException", $fault: "client", $metadata: deserializeMetadata(parsedOutput) }, deserialized);
          return [2 /*return*/, contents];
      });
  }); };
  var deserializeAws_json1_1InvalidLayerPartExceptionResponse = function (parsedOutput, context) { return __awaiter(void 0, void 0, void 0, function () {
      var body, deserialized, contents;
      return __generator(this, function (_a) {
          body = parsedOutput.body;
          deserialized = deserializeAws_json1_1InvalidLayerPartException(body, context);
          contents = __assign({ name: "InvalidLayerPartException", $fault: "client", $metadata: deserializeMetadata(parsedOutput) }, deserialized);
          return [2 /*return*/, contents];
      });
  }); };
  var deserializeAws_json1_1InvalidParameterExceptionResponse = function (parsedOutput, context) { return __awaiter(void 0, void 0, void 0, function () {
      var body, deserialized, contents;
      return __generator(this, function (_a) {
          body = parsedOutput.body;
          deserialized = deserializeAws_json1_1InvalidParameterException(body, context);
          contents = __assign({ name: "InvalidParameterException", $fault: "client", $metadata: deserializeMetadata(parsedOutput) }, deserialized);
          return [2 /*return*/, contents];
      });
  }); };
  var deserializeAws_json1_1InvalidTagParameterExceptionResponse = function (parsedOutput, context) { return __awaiter(void 0, void 0, void 0, function () {
      var body, deserialized, contents;
      return __generator(this, function (_a) {
          body = parsedOutput.body;
          deserialized = deserializeAws_json1_1InvalidTagParameterException(body, context);
          contents = __assign({ name: "InvalidTagParameterException", $fault: "client", $metadata: deserializeMetadata(parsedOutput) }, deserialized);
          return [2 /*return*/, contents];
      });
  }); };
  var deserializeAws_json1_1KmsExceptionResponse = function (parsedOutput, context) { return __awaiter(void 0, void 0, void 0, function () {
      var body, deserialized, contents;
      return __generator(this, function (_a) {
          body = parsedOutput.body;
          deserialized = deserializeAws_json1_1KmsException(body, context);
          contents = __assign({ name: "KmsException", $fault: "client", $metadata: deserializeMetadata(parsedOutput) }, deserialized);
          return [2 /*return*/, contents];
      });
  }); };
  var deserializeAws_json1_1LayerAlreadyExistsExceptionResponse = function (parsedOutput, context) { return __awaiter(void 0, void 0, void 0, function () {
      var body, deserialized, contents;
      return __generator(this, function (_a) {
          body = parsedOutput.body;
          deserialized = deserializeAws_json1_1LayerAlreadyExistsException(body, context);
          contents = __assign({ name: "LayerAlreadyExistsException", $fault: "client", $metadata: deserializeMetadata(parsedOutput) }, deserialized);
          return [2 /*return*/, contents];
      });
  }); };
  var deserializeAws_json1_1LayerInaccessibleExceptionResponse = function (parsedOutput, context) { return __awaiter(void 0, void 0, void 0, function () {
      var body, deserialized, contents;
      return __generator(this, function (_a) {
          body = parsedOutput.body;
          deserialized = deserializeAws_json1_1LayerInaccessibleException(body, context);
          contents = __assign({ name: "LayerInaccessibleException", $fault: "client", $metadata: deserializeMetadata(parsedOutput) }, deserialized);
          return [2 /*return*/, contents];
      });
  }); };
  var deserializeAws_json1_1LayerPartTooSmallExceptionResponse = function (parsedOutput, context) { return __awaiter(void 0, void 0, void 0, function () {
      var body, deserialized, contents;
      return __generator(this, function (_a) {
          body = parsedOutput.body;
          deserialized = deserializeAws_json1_1LayerPartTooSmallException(body, context);
          contents = __assign({ name: "LayerPartTooSmallException", $fault: "client", $metadata: deserializeMetadata(parsedOutput) }, deserialized);
          return [2 /*return*/, contents];
      });
  }); };
  var deserializeAws_json1_1LayersNotFoundExceptionResponse = function (parsedOutput, context) { return __awaiter(void 0, void 0, void 0, function () {
      var body, deserialized, contents;
      return __generator(this, function (_a) {
          body = parsedOutput.body;
          deserialized = deserializeAws_json1_1LayersNotFoundException(body, context);
          contents = __assign({ name: "LayersNotFoundException", $fault: "client", $metadata: deserializeMetadata(parsedOutput) }, deserialized);
          return [2 /*return*/, contents];
      });
  }); };
  var deserializeAws_json1_1LifecyclePolicyNotFoundExceptionResponse = function (parsedOutput, context) { return __awaiter(void 0, void 0, void 0, function () {
      var body, deserialized, contents;
      return __generator(this, function (_a) {
          body = parsedOutput.body;
          deserialized = deserializeAws_json1_1LifecyclePolicyNotFoundException(body, context);
          contents = __assign({ name: "LifecyclePolicyNotFoundException", $fault: "client", $metadata: deserializeMetadata(parsedOutput) }, deserialized);
          return [2 /*return*/, contents];
      });
  }); };
  var deserializeAws_json1_1LifecyclePolicyPreviewInProgressExceptionResponse = function (parsedOutput, context) { return __awaiter(void 0, void 0, void 0, function () {
      var body, deserialized, contents;
      return __generator(this, function (_a) {
          body = parsedOutput.body;
          deserialized = deserializeAws_json1_1LifecyclePolicyPreviewInProgressException(body, context);
          contents = __assign({ name: "LifecyclePolicyPreviewInProgressException", $fault: "client", $metadata: deserializeMetadata(parsedOutput) }, deserialized);
          return [2 /*return*/, contents];
      });
  }); };
  var deserializeAws_json1_1LifecyclePolicyPreviewNotFoundExceptionResponse = function (parsedOutput, context) { return __awaiter(void 0, void 0, void 0, function () {
      var body, deserialized, contents;
      return __generator(this, function (_a) {
          body = parsedOutput.body;
          deserialized = deserializeAws_json1_1LifecyclePolicyPreviewNotFoundException(body, context);
          contents = __assign({ name: "LifecyclePolicyPreviewNotFoundException", $fault: "client", $metadata: deserializeMetadata(parsedOutput) }, deserialized);
          return [2 /*return*/, contents];
      });
  }); };
  var deserializeAws_json1_1LimitExceededExceptionResponse = function (parsedOutput, context) { return __awaiter(void 0, void 0, void 0, function () {
      var body, deserialized, contents;
      return __generator(this, function (_a) {
          body = parsedOutput.body;
          deserialized = deserializeAws_json1_1LimitExceededException(body, context);
          contents = __assign({ name: "LimitExceededException", $fault: "client", $metadata: deserializeMetadata(parsedOutput) }, deserialized);
          return [2 /*return*/, contents];
      });
  }); };
  var deserializeAws_json1_1ReferencedImagesNotFoundExceptionResponse = function (parsedOutput, context) { return __awaiter(void 0, void 0, void 0, function () {
      var body, deserialized, contents;
      return __generator(this, function (_a) {
          body = parsedOutput.body;
          deserialized = deserializeAws_json1_1ReferencedImagesNotFoundException(body, context);
          contents = __assign({ name: "ReferencedImagesNotFoundException", $fault: "client", $metadata: deserializeMetadata(parsedOutput) }, deserialized);
          return [2 /*return*/, contents];
      });
  }); };
  var deserializeAws_json1_1RegistryPolicyNotFoundExceptionResponse = function (parsedOutput, context) { return __awaiter(void 0, void 0, void 0, function () {
      var body, deserialized, contents;
      return __generator(this, function (_a) {
          body = parsedOutput.body;
          deserialized = deserializeAws_json1_1RegistryPolicyNotFoundException(body, context);
          contents = __assign({ name: "RegistryPolicyNotFoundException", $fault: "client", $metadata: deserializeMetadata(parsedOutput) }, deserialized);
          return [2 /*return*/, contents];
      });
  }); };
  var deserializeAws_json1_1RepositoryAlreadyExistsExceptionResponse = function (parsedOutput, context) { return __awaiter(void 0, void 0, void 0, function () {
      var body, deserialized, contents;
      return __generator(this, function (_a) {
          body = parsedOutput.body;
          deserialized = deserializeAws_json1_1RepositoryAlreadyExistsException(body, context);
          contents = __assign({ name: "RepositoryAlreadyExistsException", $fault: "client", $metadata: deserializeMetadata(parsedOutput) }, deserialized);
          return [2 /*return*/, contents];
      });
  }); };
  var deserializeAws_json1_1RepositoryNotEmptyExceptionResponse = function (parsedOutput, context) { return __awaiter(void 0, void 0, void 0, function () {
      var body, deserialized, contents;
      return __generator(this, function (_a) {
          body = parsedOutput.body;
          deserialized = deserializeAws_json1_1RepositoryNotEmptyException(body, context);
          contents = __assign({ name: "RepositoryNotEmptyException", $fault: "client", $metadata: deserializeMetadata(parsedOutput) }, deserialized);
          return [2 /*return*/, contents];
      });
  }); };
  var deserializeAws_json1_1RepositoryNotFoundExceptionResponse = function (parsedOutput, context) { return __awaiter(void 0, void 0, void 0, function () {
      var body, deserialized, contents;
      return __generator(this, function (_a) {
          body = parsedOutput.body;
          deserialized = deserializeAws_json1_1RepositoryNotFoundException(body, context);
          contents = __assign({ name: "RepositoryNotFoundException", $fault: "client", $metadata: deserializeMetadata(parsedOutput) }, deserialized);
          return [2 /*return*/, contents];
      });
  }); };
  var deserializeAws_json1_1RepositoryPolicyNotFoundExceptionResponse = function (parsedOutput, context) { return __awaiter(void 0, void 0, void 0, function () {
      var body, deserialized, contents;
      return __generator(this, function (_a) {
          body = parsedOutput.body;
          deserialized = deserializeAws_json1_1RepositoryPolicyNotFoundException(body, context);
          contents = __assign({ name: "RepositoryPolicyNotFoundException", $fault: "client", $metadata: deserializeMetadata(parsedOutput) }, deserialized);
          return [2 /*return*/, contents];
      });
  }); };
  var deserializeAws_json1_1ScanNotFoundExceptionResponse = function (parsedOutput, context) { return __awaiter(void 0, void 0, void 0, function () {
      var body, deserialized, contents;
      return __generator(this, function (_a) {
          body = parsedOutput.body;
          deserialized = deserializeAws_json1_1ScanNotFoundException(body, context);
          contents = __assign({ name: "ScanNotFoundException", $fault: "client", $metadata: deserializeMetadata(parsedOutput) }, deserialized);
          return [2 /*return*/, contents];
      });
  }); };
  var deserializeAws_json1_1ServerExceptionResponse = function (parsedOutput, context) { return __awaiter(void 0, void 0, void 0, function () {
      var body, deserialized, contents;
      return __generator(this, function (_a) {
          body = parsedOutput.body;
          deserialized = deserializeAws_json1_1ServerException(body, context);
          contents = __assign({ name: "ServerException", $fault: "server", $metadata: deserializeMetadata(parsedOutput) }, deserialized);
          return [2 /*return*/, contents];
      });
  }); };
  var deserializeAws_json1_1TooManyTagsExceptionResponse = function (parsedOutput, context) { return __awaiter(void 0, void 0, void 0, function () {
      var body, deserialized, contents;
      return __generator(this, function (_a) {
          body = parsedOutput.body;
          deserialized = deserializeAws_json1_1TooManyTagsException(body, context);
          contents = __assign({ name: "TooManyTagsException", $fault: "client", $metadata: deserializeMetadata(parsedOutput) }, deserialized);
          return [2 /*return*/, contents];
      });
  }); };
  var deserializeAws_json1_1UnsupportedImageTypeExceptionResponse = function (parsedOutput, context) { return __awaiter(void 0, void 0, void 0, function () {
      var body, deserialized, contents;
      return __generator(this, function (_a) {
          body = parsedOutput.body;
          deserialized = deserializeAws_json1_1UnsupportedImageTypeException(body, context);
          contents = __assign({ name: "UnsupportedImageTypeException", $fault: "client", $metadata: deserializeMetadata(parsedOutput) }, deserialized);
          return [2 /*return*/, contents];
      });
  }); };
  var deserializeAws_json1_1UploadNotFoundExceptionResponse = function (parsedOutput, context) { return __awaiter(void 0, void 0, void 0, function () {
      var body, deserialized, contents;
      return __generator(this, function (_a) {
          body = parsedOutput.body;
          deserialized = deserializeAws_json1_1UploadNotFoundException(body, context);
          contents = __assign({ name: "UploadNotFoundException", $fault: "client", $metadata: deserializeMetadata(parsedOutput) }, deserialized);
          return [2 /*return*/, contents];
      });
  }); };
  var deserializeAws_json1_1ValidationExceptionResponse = function (parsedOutput, context) { return __awaiter(void 0, void 0, void 0, function () {
      var body, deserialized, contents;
      return __generator(this, function (_a) {
          body = parsedOutput.body;
          deserialized = deserializeAws_json1_1ValidationException(body, context);
          contents = __assign({ name: "ValidationException", $fault: "client", $metadata: deserializeMetadata(parsedOutput) }, deserialized);
          return [2 /*return*/, contents];
      });
  }); };
  var serializeAws_json1_1BatchCheckLayerAvailabilityRequest = function (input, context) {
      return __assign(__assign(__assign({}, (input.layerDigests !== undefined &&
          input.layerDigests !== null && {
          layerDigests: serializeAws_json1_1BatchedOperationLayerDigestList(input.layerDigests, context),
      })), (input.registryId !== undefined && input.registryId !== null && { registryId: input.registryId })), (input.repositoryName !== undefined &&
          input.repositoryName !== null && { repositoryName: input.repositoryName }));
  };
  var serializeAws_json1_1BatchDeleteImageRequest = function (input, context) {
      return __assign(__assign(__assign({}, (input.imageIds !== undefined &&
          input.imageIds !== null && { imageIds: serializeAws_json1_1ImageIdentifierList(input.imageIds, context) })), (input.registryId !== undefined && input.registryId !== null && { registryId: input.registryId })), (input.repositoryName !== undefined &&
          input.repositoryName !== null && { repositoryName: input.repositoryName }));
  };
  var serializeAws_json1_1BatchedOperationLayerDigestList = function (input, context) {
      return input
          .filter(function (e) { return e != null; })
          .map(function (entry) {
          if (entry === null) {
              return null;
          }
          return entry;
      });
  };
  var serializeAws_json1_1BatchGetImageRequest = function (input, context) {
      return __assign(__assign(__assign(__assign({}, (input.acceptedMediaTypes !== undefined &&
          input.acceptedMediaTypes !== null && {
          acceptedMediaTypes: serializeAws_json1_1MediaTypeList(input.acceptedMediaTypes, context),
      })), (input.imageIds !== undefined &&
          input.imageIds !== null && { imageIds: serializeAws_json1_1ImageIdentifierList(input.imageIds, context) })), (input.registryId !== undefined && input.registryId !== null && { registryId: input.registryId })), (input.repositoryName !== undefined &&
          input.repositoryName !== null && { repositoryName: input.repositoryName }));
  };
  var serializeAws_json1_1CompleteLayerUploadRequest = function (input, context) {
      return __assign(__assign(__assign(__assign({}, (input.layerDigests !== undefined &&
          input.layerDigests !== null && {
          layerDigests: serializeAws_json1_1LayerDigestList(input.layerDigests, context),
      })), (input.registryId !== undefined && input.registryId !== null && { registryId: input.registryId })), (input.repositoryName !== undefined &&
          input.repositoryName !== null && { repositoryName: input.repositoryName })), (input.uploadId !== undefined && input.uploadId !== null && { uploadId: input.uploadId }));
  };
  var serializeAws_json1_1CreateRepositoryRequest = function (input, context) {
      return __assign(__assign(__assign(__assign(__assign({}, (input.encryptionConfiguration !== undefined &&
          input.encryptionConfiguration !== null && {
          encryptionConfiguration: serializeAws_json1_1EncryptionConfiguration(input.encryptionConfiguration, context),
      })), (input.imageScanningConfiguration !== undefined &&
          input.imageScanningConfiguration !== null && {
          imageScanningConfiguration: serializeAws_json1_1ImageScanningConfiguration(input.imageScanningConfiguration, context),
      })), (input.imageTagMutability !== undefined &&
          input.imageTagMutability !== null && { imageTagMutability: input.imageTagMutability })), (input.repositoryName !== undefined &&
          input.repositoryName !== null && { repositoryName: input.repositoryName })), (input.tags !== undefined && input.tags !== null && { tags: serializeAws_json1_1TagList(input.tags, context) }));
  };
  var serializeAws_json1_1DeleteLifecyclePolicyRequest = function (input, context) {
      return __assign(__assign({}, (input.registryId !== undefined && input.registryId !== null && { registryId: input.registryId })), (input.repositoryName !== undefined &&
          input.repositoryName !== null && { repositoryName: input.repositoryName }));
  };
  var serializeAws_json1_1DeleteRegistryPolicyRequest = function (input, context) {
      return {};
  };
  var serializeAws_json1_1DeleteRepositoryPolicyRequest = function (input, context) {
      return __assign(__assign({}, (input.registryId !== undefined && input.registryId !== null && { registryId: input.registryId })), (input.repositoryName !== undefined &&
          input.repositoryName !== null && { repositoryName: input.repositoryName }));
  };
  var serializeAws_json1_1DeleteRepositoryRequest = function (input, context) {
      return __assign(__assign(__assign({}, (input.force !== undefined && input.force !== null && { force: input.force })), (input.registryId !== undefined && input.registryId !== null && { registryId: input.registryId })), (input.repositoryName !== undefined &&
          input.repositoryName !== null && { repositoryName: input.repositoryName }));
  };
  var serializeAws_json1_1DescribeImageScanFindingsRequest = function (input, context) {
      return __assign(__assign(__assign(__assign(__assign({}, (input.imageId !== undefined &&
          input.imageId !== null && { imageId: serializeAws_json1_1ImageIdentifier(input.imageId, context) })), (input.maxResults !== undefined && input.maxResults !== null && { maxResults: input.maxResults })), (input.nextToken !== undefined && input.nextToken !== null && { nextToken: input.nextToken })), (input.registryId !== undefined && input.registryId !== null && { registryId: input.registryId })), (input.repositoryName !== undefined &&
          input.repositoryName !== null && { repositoryName: input.repositoryName }));
  };
  var serializeAws_json1_1DescribeImagesFilter = function (input, context) {
      return __assign({}, (input.tagStatus !== undefined && input.tagStatus !== null && { tagStatus: input.tagStatus }));
  };
  var serializeAws_json1_1DescribeImagesRequest = function (input, context) {
      return __assign(__assign(__assign(__assign(__assign(__assign({}, (input.filter !== undefined &&
          input.filter !== null && { filter: serializeAws_json1_1DescribeImagesFilter(input.filter, context) })), (input.imageIds !== undefined &&
          input.imageIds !== null && { imageIds: serializeAws_json1_1ImageIdentifierList(input.imageIds, context) })), (input.maxResults !== undefined && input.maxResults !== null && { maxResults: input.maxResults })), (input.nextToken !== undefined && input.nextToken !== null && { nextToken: input.nextToken })), (input.registryId !== undefined && input.registryId !== null && { registryId: input.registryId })), (input.repositoryName !== undefined &&
          input.repositoryName !== null && { repositoryName: input.repositoryName }));
  };
  var serializeAws_json1_1DescribeRegistryRequest = function (input, context) {
      return {};
  };
  var serializeAws_json1_1DescribeRepositoriesRequest = function (input, context) {
      return __assign(__assign(__assign(__assign({}, (input.maxResults !== undefined && input.maxResults !== null && { maxResults: input.maxResults })), (input.nextToken !== undefined && input.nextToken !== null && { nextToken: input.nextToken })), (input.registryId !== undefined && input.registryId !== null && { registryId: input.registryId })), (input.repositoryNames !== undefined &&
          input.repositoryNames !== null && {
          repositoryNames: serializeAws_json1_1RepositoryNameList(input.repositoryNames, context),
      }));
  };
  var serializeAws_json1_1EncryptionConfiguration = function (input, context) {
      return __assign(__assign({}, (input.encryptionType !== undefined &&
          input.encryptionType !== null && { encryptionType: input.encryptionType })), (input.kmsKey !== undefined && input.kmsKey !== null && { kmsKey: input.kmsKey }));
  };
  var serializeAws_json1_1GetAuthorizationTokenRegistryIdList = function (input, context) {
      return input
          .filter(function (e) { return e != null; })
          .map(function (entry) {
          if (entry === null) {
              return null;
          }
          return entry;
      });
  };
  var serializeAws_json1_1GetAuthorizationTokenRequest = function (input, context) {
      return __assign({}, (input.registryIds !== undefined &&
          input.registryIds !== null && {
          registryIds: serializeAws_json1_1GetAuthorizationTokenRegistryIdList(input.registryIds, context),
      }));
  };
  var serializeAws_json1_1GetDownloadUrlForLayerRequest = function (input, context) {
      return __assign(__assign(__assign({}, (input.layerDigest !== undefined && input.layerDigest !== null && { layerDigest: input.layerDigest })), (input.registryId !== undefined && input.registryId !== null && { registryId: input.registryId })), (input.repositoryName !== undefined &&
          input.repositoryName !== null && { repositoryName: input.repositoryName }));
  };
  var serializeAws_json1_1GetLifecyclePolicyPreviewRequest = function (input, context) {
      return __assign(__assign(__assign(__assign(__assign(__assign({}, (input.filter !== undefined &&
          input.filter !== null && { filter: serializeAws_json1_1LifecyclePolicyPreviewFilter(input.filter, context) })), (input.imageIds !== undefined &&
          input.imageIds !== null && { imageIds: serializeAws_json1_1ImageIdentifierList(input.imageIds, context) })), (input.maxResults !== undefined && input.maxResults !== null && { maxResults: input.maxResults })), (input.nextToken !== undefined && input.nextToken !== null && { nextToken: input.nextToken })), (input.registryId !== undefined && input.registryId !== null && { registryId: input.registryId })), (input.repositoryName !== undefined &&
          input.repositoryName !== null && { repositoryName: input.repositoryName }));
  };
  var serializeAws_json1_1GetLifecyclePolicyRequest = function (input, context) {
      return __assign(__assign({}, (input.registryId !== undefined && input.registryId !== null && { registryId: input.registryId })), (input.repositoryName !== undefined &&
          input.repositoryName !== null && { repositoryName: input.repositoryName }));
  };
  var serializeAws_json1_1GetRegistryPolicyRequest = function (input, context) {
      return {};
  };
  var serializeAws_json1_1GetRepositoryPolicyRequest = function (input, context) {
      return __assign(__assign({}, (input.registryId !== undefined && input.registryId !== null && { registryId: input.registryId })), (input.repositoryName !== undefined &&
          input.repositoryName !== null && { repositoryName: input.repositoryName }));
  };
  var serializeAws_json1_1ImageIdentifier = function (input, context) {
      return __assign(__assign({}, (input.imageDigest !== undefined && input.imageDigest !== null && { imageDigest: input.imageDigest })), (input.imageTag !== undefined && input.imageTag !== null && { imageTag: input.imageTag }));
  };
  var serializeAws_json1_1ImageIdentifierList = function (input, context) {
      return input
          .filter(function (e) { return e != null; })
          .map(function (entry) {
          if (entry === null) {
              return null;
          }
          return serializeAws_json1_1ImageIdentifier(entry, context);
      });
  };
  var serializeAws_json1_1ImageScanningConfiguration = function (input, context) {
      return __assign({}, (input.scanOnPush !== undefined && input.scanOnPush !== null && { scanOnPush: input.scanOnPush }));
  };
  var serializeAws_json1_1InitiateLayerUploadRequest = function (input, context) {
      return __assign(__assign({}, (input.registryId !== undefined && input.registryId !== null && { registryId: input.registryId })), (input.repositoryName !== undefined &&
          input.repositoryName !== null && { repositoryName: input.repositoryName }));
  };
  var serializeAws_json1_1LayerDigestList = function (input, context) {
      return input
          .filter(function (e) { return e != null; })
          .map(function (entry) {
          if (entry === null) {
              return null;
          }
          return entry;
      });
  };
  var serializeAws_json1_1LifecyclePolicyPreviewFilter = function (input, context) {
      return __assign({}, (input.tagStatus !== undefined && input.tagStatus !== null && { tagStatus: input.tagStatus }));
  };
  var serializeAws_json1_1ListImagesFilter = function (input, context) {
      return __assign({}, (input.tagStatus !== undefined && input.tagStatus !== null && { tagStatus: input.tagStatus }));
  };
  var serializeAws_json1_1ListImagesRequest = function (input, context) {
      return __assign(__assign(__assign(__assign(__assign({}, (input.filter !== undefined &&
          input.filter !== null && { filter: serializeAws_json1_1ListImagesFilter(input.filter, context) })), (input.maxResults !== undefined && input.maxResults !== null && { maxResults: input.maxResults })), (input.nextToken !== undefined && input.nextToken !== null && { nextToken: input.nextToken })), (input.registryId !== undefined && input.registryId !== null && { registryId: input.registryId })), (input.repositoryName !== undefined &&
          input.repositoryName !== null && { repositoryName: input.repositoryName }));
  };
  var serializeAws_json1_1ListTagsForResourceRequest = function (input, context) {
      return __assign({}, (input.resourceArn !== undefined && input.resourceArn !== null && { resourceArn: input.resourceArn }));
  };
  var serializeAws_json1_1MediaTypeList = function (input, context) {
      return input
          .filter(function (e) { return e != null; })
          .map(function (entry) {
          if (entry === null) {
              return null;
          }
          return entry;
      });
  };
  var serializeAws_json1_1PutImageRequest = function (input, context) {
      return __assign(__assign(__assign(__assign(__assign(__assign({}, (input.imageDigest !== undefined && input.imageDigest !== null && { imageDigest: input.imageDigest })), (input.imageManifest !== undefined && input.imageManifest !== null && { imageManifest: input.imageManifest })), (input.imageManifestMediaType !== undefined &&
          input.imageManifestMediaType !== null && { imageManifestMediaType: input.imageManifestMediaType })), (input.imageTag !== undefined && input.imageTag !== null && { imageTag: input.imageTag })), (input.registryId !== undefined && input.registryId !== null && { registryId: input.registryId })), (input.repositoryName !== undefined &&
          input.repositoryName !== null && { repositoryName: input.repositoryName }));
  };
  var serializeAws_json1_1PutImageScanningConfigurationRequest = function (input, context) {
      return __assign(__assign(__assign({}, (input.imageScanningConfiguration !== undefined &&
          input.imageScanningConfiguration !== null && {
          imageScanningConfiguration: serializeAws_json1_1ImageScanningConfiguration(input.imageScanningConfiguration, context),
      })), (input.registryId !== undefined && input.registryId !== null && { registryId: input.registryId })), (input.repositoryName !== undefined &&
          input.repositoryName !== null && { repositoryName: input.repositoryName }));
  };
  var serializeAws_json1_1PutImageTagMutabilityRequest = function (input, context) {
      return __assign(__assign(__assign({}, (input.imageTagMutability !== undefined &&
          input.imageTagMutability !== null && { imageTagMutability: input.imageTagMutability })), (input.registryId !== undefined && input.registryId !== null && { registryId: input.registryId })), (input.repositoryName !== undefined &&
          input.repositoryName !== null && { repositoryName: input.repositoryName }));
  };
  var serializeAws_json1_1PutLifecyclePolicyRequest = function (input, context) {
      return __assign(__assign(__assign({}, (input.lifecyclePolicyText !== undefined &&
          input.lifecyclePolicyText !== null && { lifecyclePolicyText: input.lifecyclePolicyText })), (input.registryId !== undefined && input.registryId !== null && { registryId: input.registryId })), (input.repositoryName !== undefined &&
          input.repositoryName !== null && { repositoryName: input.repositoryName }));
  };
  var serializeAws_json1_1PutRegistryPolicyRequest = function (input, context) {
      return __assign({}, (input.policyText !== undefined && input.policyText !== null && { policyText: input.policyText }));
  };
  var serializeAws_json1_1PutReplicationConfigurationRequest = function (input, context) {
      return __assign({}, (input.replicationConfiguration !== undefined &&
          input.replicationConfiguration !== null && {
          replicationConfiguration: serializeAws_json1_1ReplicationConfiguration(input.replicationConfiguration, context),
      }));
  };
  var serializeAws_json1_1ReplicationConfiguration = function (input, context) {
      return __assign({}, (input.rules !== undefined &&
          input.rules !== null && { rules: serializeAws_json1_1ReplicationRuleList(input.rules, context) }));
  };
  var serializeAws_json1_1ReplicationDestination = function (input, context) {
      return __assign(__assign({}, (input.region !== undefined && input.region !== null && { region: input.region })), (input.registryId !== undefined && input.registryId !== null && { registryId: input.registryId }));
  };
  var serializeAws_json1_1ReplicationDestinationList = function (input, context) {
      return input
          .filter(function (e) { return e != null; })
          .map(function (entry) {
          if (entry === null) {
              return null;
          }
          return serializeAws_json1_1ReplicationDestination(entry, context);
      });
  };
  var serializeAws_json1_1ReplicationRule = function (input, context) {
      return __assign({}, (input.destinations !== undefined &&
          input.destinations !== null && {
          destinations: serializeAws_json1_1ReplicationDestinationList(input.destinations, context),
      }));
  };
  var serializeAws_json1_1ReplicationRuleList = function (input, context) {
      return input
          .filter(function (e) { return e != null; })
          .map(function (entry) {
          if (entry === null) {
              return null;
          }
          return serializeAws_json1_1ReplicationRule(entry, context);
      });
  };
  var serializeAws_json1_1RepositoryNameList = function (input, context) {
      return input
          .filter(function (e) { return e != null; })
          .map(function (entry) {
          if (entry === null) {
              return null;
          }
          return entry;
      });
  };
  var serializeAws_json1_1SetRepositoryPolicyRequest = function (input, context) {
      return __assign(__assign(__assign(__assign({}, (input.force !== undefined && input.force !== null && { force: input.force })), (input.policyText !== undefined && input.policyText !== null && { policyText: input.policyText })), (input.registryId !== undefined && input.registryId !== null && { registryId: input.registryId })), (input.repositoryName !== undefined &&
          input.repositoryName !== null && { repositoryName: input.repositoryName }));
  };
  var serializeAws_json1_1StartImageScanRequest = function (input, context) {
      return __assign(__assign(__assign({}, (input.imageId !== undefined &&
          input.imageId !== null && { imageId: serializeAws_json1_1ImageIdentifier(input.imageId, context) })), (input.registryId !== undefined && input.registryId !== null && { registryId: input.registryId })), (input.repositoryName !== undefined &&
          input.repositoryName !== null && { repositoryName: input.repositoryName }));
  };
  var serializeAws_json1_1StartLifecyclePolicyPreviewRequest = function (input, context) {
      return __assign(__assign(__assign({}, (input.lifecyclePolicyText !== undefined &&
          input.lifecyclePolicyText !== null && { lifecyclePolicyText: input.lifecyclePolicyText })), (input.registryId !== undefined && input.registryId !== null && { registryId: input.registryId })), (input.repositoryName !== undefined &&
          input.repositoryName !== null && { repositoryName: input.repositoryName }));
  };
  var serializeAws_json1_1Tag = function (input, context) {
      return __assign(__assign({}, (input.Key !== undefined && input.Key !== null && { Key: input.Key })), (input.Value !== undefined && input.Value !== null && { Value: input.Value }));
  };
  var serializeAws_json1_1TagKeyList = function (input, context) {
      return input
          .filter(function (e) { return e != null; })
          .map(function (entry) {
          if (entry === null) {
              return null;
          }
          return entry;
      });
  };
  var serializeAws_json1_1TagList = function (input, context) {
      return input
          .filter(function (e) { return e != null; })
          .map(function (entry) {
          if (entry === null) {
              return null;
          }
          return serializeAws_json1_1Tag(entry, context);
      });
  };
  var serializeAws_json1_1TagResourceRequest = function (input, context) {
      return __assign(__assign({}, (input.resourceArn !== undefined && input.resourceArn !== null && { resourceArn: input.resourceArn })), (input.tags !== undefined && input.tags !== null && { tags: serializeAws_json1_1TagList(input.tags, context) }));
  };
  var serializeAws_json1_1UntagResourceRequest = function (input, context) {
      return __assign(__assign({}, (input.resourceArn !== undefined && input.resourceArn !== null && { resourceArn: input.resourceArn })), (input.tagKeys !== undefined &&
          input.tagKeys !== null && { tagKeys: serializeAws_json1_1TagKeyList(input.tagKeys, context) }));
  };
  var serializeAws_json1_1UploadLayerPartRequest = function (input, context) {
      return __assign(__assign(__assign(__assign(__assign(__assign({}, (input.layerPartBlob !== undefined &&
          input.layerPartBlob !== null && { layerPartBlob: context.base64Encoder(input.layerPartBlob) })), (input.partFirstByte !== undefined && input.partFirstByte !== null && { partFirstByte: input.partFirstByte })), (input.partLastByte !== undefined && input.partLastByte !== null && { partLastByte: input.partLastByte })), (input.registryId !== undefined && input.registryId !== null && { registryId: input.registryId })), (input.repositoryName !== undefined &&
          input.repositoryName !== null && { repositoryName: input.repositoryName })), (input.uploadId !== undefined && input.uploadId !== null && { uploadId: input.uploadId }));
  };
  var deserializeAws_json1_1Attribute = function (output, context) {
      return {
          key: output.key !== undefined && output.key !== null ? output.key : undefined,
          value: output.value !== undefined && output.value !== null ? output.value : undefined,
      };
  };
  var deserializeAws_json1_1AttributeList = function (output, context) {
      return (output || [])
          .filter(function (e) { return e != null; })
          .map(function (entry) {
          if (entry === null) {
              return null;
          }
          return deserializeAws_json1_1Attribute(entry, context);
      });
  };
  var deserializeAws_json1_1AuthorizationData = function (output, context) {
      return {
          authorizationToken: output.authorizationToken !== undefined && output.authorizationToken !== null
              ? output.authorizationToken
              : undefined,
          expiresAt: output.expiresAt !== undefined && output.expiresAt !== null
              ? new Date(Math.round(output.expiresAt * 1000))
              : undefined,
          proxyEndpoint: output.proxyEndpoint !== undefined && output.proxyEndpoint !== null ? output.proxyEndpoint : undefined,
      };
  };
  var deserializeAws_json1_1AuthorizationDataList = function (output, context) {
      return (output || [])
          .filter(function (e) { return e != null; })
          .map(function (entry) {
          if (entry === null) {
              return null;
          }
          return deserializeAws_json1_1AuthorizationData(entry, context);
      });
  };
  var deserializeAws_json1_1BatchCheckLayerAvailabilityResponse = function (output, context) {
      return {
          failures: output.failures !== undefined && output.failures !== null
              ? deserializeAws_json1_1LayerFailureList(output.failures, context)
              : undefined,
          layers: output.layers !== undefined && output.layers !== null
              ? deserializeAws_json1_1LayerList(output.layers, context)
              : undefined,
      };
  };
  var deserializeAws_json1_1BatchDeleteImageResponse = function (output, context) {
      return {
          failures: output.failures !== undefined && output.failures !== null
              ? deserializeAws_json1_1ImageFailureList(output.failures, context)
              : undefined,
          imageIds: output.imageIds !== undefined && output.imageIds !== null
              ? deserializeAws_json1_1ImageIdentifierList(output.imageIds, context)
              : undefined,
      };
  };
  var deserializeAws_json1_1BatchGetImageResponse = function (output, context) {
      return {
          failures: output.failures !== undefined && output.failures !== null
              ? deserializeAws_json1_1ImageFailureList(output.failures, context)
              : undefined,
          images: output.images !== undefined && output.images !== null
              ? deserializeAws_json1_1ImageList(output.images, context)
              : undefined,
      };
  };
  var deserializeAws_json1_1CompleteLayerUploadResponse = function (output, context) {
      return {
          layerDigest: output.layerDigest !== undefined && output.layerDigest !== null ? output.layerDigest : undefined,
          registryId: output.registryId !== undefined && output.registryId !== null ? output.registryId : undefined,
          repositoryName: output.repositoryName !== undefined && output.repositoryName !== null ? output.repositoryName : undefined,
          uploadId: output.uploadId !== undefined && output.uploadId !== null ? output.uploadId : undefined,
      };
  };
  var deserializeAws_json1_1CreateRepositoryResponse = function (output, context) {
      return {
          repository: output.repository !== undefined && output.repository !== null
              ? deserializeAws_json1_1Repository(output.repository, context)
              : undefined,
      };
  };
  var deserializeAws_json1_1DeleteLifecyclePolicyResponse = function (output, context) {
      return {
          lastEvaluatedAt: output.lastEvaluatedAt !== undefined && output.lastEvaluatedAt !== null
              ? new Date(Math.round(output.lastEvaluatedAt * 1000))
              : undefined,
          lifecyclePolicyText: output.lifecyclePolicyText !== undefined && output.lifecyclePolicyText !== null
              ? output.lifecyclePolicyText
              : undefined,
          registryId: output.registryId !== undefined && output.registryId !== null ? output.registryId : undefined,
          repositoryName: output.repositoryName !== undefined && output.repositoryName !== null ? output.repositoryName : undefined,
      };
  };
  var deserializeAws_json1_1DeleteRegistryPolicyResponse = function (output, context) {
      return {
          policyText: output.policyText !== undefined && output.policyText !== null ? output.policyText : undefined,
          registryId: output.registryId !== undefined && output.registryId !== null ? output.registryId : undefined,
      };
  };
  var deserializeAws_json1_1DeleteRepositoryPolicyResponse = function (output, context) {
      return {
          policyText: output.policyText !== undefined && output.policyText !== null ? output.policyText : undefined,
          registryId: output.registryId !== undefined && output.registryId !== null ? output.registryId : undefined,
          repositoryName: output.repositoryName !== undefined && output.repositoryName !== null ? output.repositoryName : undefined,
      };
  };
  var deserializeAws_json1_1DeleteRepositoryResponse = function (output, context) {
      return {
          repository: output.repository !== undefined && output.repository !== null
              ? deserializeAws_json1_1Repository(output.repository, context)
              : undefined,
      };
  };
  var deserializeAws_json1_1DescribeImageScanFindingsResponse = function (output, context) {
      return {
          imageId: output.imageId !== undefined && output.imageId !== null
              ? deserializeAws_json1_1ImageIdentifier(output.imageId, context)
              : undefined,
          imageScanFindings: output.imageScanFindings !== undefined && output.imageScanFindings !== null
              ? deserializeAws_json1_1ImageScanFindings(output.imageScanFindings, context)
              : undefined,
          imageScanStatus: output.imageScanStatus !== undefined && output.imageScanStatus !== null
              ? deserializeAws_json1_1ImageScanStatus(output.imageScanStatus, context)
              : undefined,
          nextToken: output.nextToken !== undefined && output.nextToken !== null ? output.nextToken : undefined,
          registryId: output.registryId !== undefined && output.registryId !== null ? output.registryId : undefined,
          repositoryName: output.repositoryName !== undefined && output.repositoryName !== null ? output.repositoryName : undefined,
      };
  };
  var deserializeAws_json1_1DescribeImagesResponse = function (output, context) {
      return {
          imageDetails: output.imageDetails !== undefined && output.imageDetails !== null
              ? deserializeAws_json1_1ImageDetailList(output.imageDetails, context)
              : undefined,
          nextToken: output.nextToken !== undefined && output.nextToken !== null ? output.nextToken : undefined,
      };
  };
  var deserializeAws_json1_1DescribeRegistryResponse = function (output, context) {
      return {
          registryId: output.registryId !== undefined && output.registryId !== null ? output.registryId : undefined,
          replicationConfiguration: output.replicationConfiguration !== undefined && output.replicationConfiguration !== null
              ? deserializeAws_json1_1ReplicationConfiguration(output.replicationConfiguration, context)
              : undefined,
      };
  };
  var deserializeAws_json1_1DescribeRepositoriesResponse = function (output, context) {
      return {
          nextToken: output.nextToken !== undefined && output.nextToken !== null ? output.nextToken : undefined,
          repositories: output.repositories !== undefined && output.repositories !== null
              ? deserializeAws_json1_1RepositoryList(output.repositories, context)
              : undefined,
      };
  };
  var deserializeAws_json1_1EmptyUploadException = function (output, context) {
      return {
          message: output.message !== undefined && output.message !== null ? output.message : undefined,
      };
  };
  var deserializeAws_json1_1EncryptionConfiguration = function (output, context) {
      return {
          encryptionType: output.encryptionType !== undefined && output.encryptionType !== null ? output.encryptionType : undefined,
          kmsKey: output.kmsKey !== undefined && output.kmsKey !== null ? output.kmsKey : undefined,
      };
  };
  var deserializeAws_json1_1FindingSeverityCounts = function (output, context) {
      return Object.entries(output).reduce(function (acc, _a) {
          var _b;
          var _c = __read(_a, 2), key = _c[0], value = _c[1];
          if (value === null) {
              return acc;
          }
          return __assign(__assign({}, acc), (_b = {}, _b[key] = value, _b));
      }, {});
  };
  var deserializeAws_json1_1GetAuthorizationTokenResponse = function (output, context) {
      return {
          authorizationData: output.authorizationData !== undefined && output.authorizationData !== null
              ? deserializeAws_json1_1AuthorizationDataList(output.authorizationData, context)
              : undefined,
      };
  };
  var deserializeAws_json1_1GetDownloadUrlForLayerResponse = function (output, context) {
      return {
          downloadUrl: output.downloadUrl !== undefined && output.downloadUrl !== null ? output.downloadUrl : undefined,
          layerDigest: output.layerDigest !== undefined && output.layerDigest !== null ? output.layerDigest : undefined,
      };
  };
  var deserializeAws_json1_1GetLifecyclePolicyPreviewResponse = function (output, context) {
      return {
          lifecyclePolicyText: output.lifecyclePolicyText !== undefined && output.lifecyclePolicyText !== null
              ? output.lifecyclePolicyText
              : undefined,
          nextToken: output.nextToken !== undefined && output.nextToken !== null ? output.nextToken : undefined,
          previewResults: output.previewResults !== undefined && output.previewResults !== null
              ? deserializeAws_json1_1LifecyclePolicyPreviewResultList(output.previewResults, context)
              : undefined,
          registryId: output.registryId !== undefined && output.registryId !== null ? output.registryId : undefined,
          repositoryName: output.repositoryName !== undefined && output.repositoryName !== null ? output.repositoryName : undefined,
          status: output.status !== undefined && output.status !== null ? output.status : undefined,
          summary: output.summary !== undefined && output.summary !== null
              ? deserializeAws_json1_1LifecyclePolicyPreviewSummary(output.summary, context)
              : undefined,
      };
  };
  var deserializeAws_json1_1GetLifecyclePolicyResponse = function (output, context) {
      return {
          lastEvaluatedAt: output.lastEvaluatedAt !== undefined && output.lastEvaluatedAt !== null
              ? new Date(Math.round(output.lastEvaluatedAt * 1000))
              : undefined,
          lifecyclePolicyText: output.lifecyclePolicyText !== undefined && output.lifecyclePolicyText !== null
              ? output.lifecyclePolicyText
              : undefined,
          registryId: output.registryId !== undefined && output.registryId !== null ? output.registryId : undefined,
          repositoryName: output.repositoryName !== undefined && output.repositoryName !== null ? output.repositoryName : undefined,
      };
  };
  var deserializeAws_json1_1GetRegistryPolicyResponse = function (output, context) {
      return {
          policyText: output.policyText !== undefined && output.policyText !== null ? output.policyText : undefined,
          registryId: output.registryId !== undefined && output.registryId !== null ? output.registryId : undefined,
      };
  };
  var deserializeAws_json1_1GetRepositoryPolicyResponse = function (output, context) {
      return {
          policyText: output.policyText !== undefined && output.policyText !== null ? output.policyText : undefined,
          registryId: output.registryId !== undefined && output.registryId !== null ? output.registryId : undefined,
          repositoryName: output.repositoryName !== undefined && output.repositoryName !== null ? output.repositoryName : undefined,
      };
  };
  var deserializeAws_json1_1Image = function (output, context) {
      return {
          imageId: output.imageId !== undefined && output.imageId !== null
              ? deserializeAws_json1_1ImageIdentifier(output.imageId, context)
              : undefined,
          imageManifest: output.imageManifest !== undefined && output.imageManifest !== null ? output.imageManifest : undefined,
          imageManifestMediaType: output.imageManifestMediaType !== undefined && output.imageManifestMediaType !== null
              ? output.imageManifestMediaType
              : undefined,
          registryId: output.registryId !== undefined && output.registryId !== null ? output.registryId : undefined,
          repositoryName: output.repositoryName !== undefined && output.repositoryName !== null ? output.repositoryName : undefined,
      };
  };
  var deserializeAws_json1_1ImageAlreadyExistsException = function (output, context) {
      return {
          message: output.message !== undefined && output.message !== null ? output.message : undefined,
      };
  };
  var deserializeAws_json1_1ImageDetail = function (output, context) {
      return {
          artifactMediaType: output.artifactMediaType !== undefined && output.artifactMediaType !== null
              ? output.artifactMediaType
              : undefined,
          imageDigest: output.imageDigest !== undefined && output.imageDigest !== null ? output.imageDigest : undefined,
          imageManifestMediaType: output.imageManifestMediaType !== undefined && output.imageManifestMediaType !== null
              ? output.imageManifestMediaType
              : undefined,
          imagePushedAt: output.imagePushedAt !== undefined && output.imagePushedAt !== null
              ? new Date(Math.round(output.imagePushedAt * 1000))
              : undefined,
          imageScanFindingsSummary: output.imageScanFindingsSummary !== undefined && output.imageScanFindingsSummary !== null
              ? deserializeAws_json1_1ImageScanFindingsSummary(output.imageScanFindingsSummary, context)
              : undefined,
          imageScanStatus: output.imageScanStatus !== undefined && output.imageScanStatus !== null
              ? deserializeAws_json1_1ImageScanStatus(output.imageScanStatus, context)
              : undefined,
          imageSizeInBytes: output.imageSizeInBytes !== undefined && output.imageSizeInBytes !== null ? output.imageSizeInBytes : undefined,
          imageTags: output.imageTags !== undefined && output.imageTags !== null
              ? deserializeAws_json1_1ImageTagList(output.imageTags, context)
              : undefined,
          registryId: output.registryId !== undefined && output.registryId !== null ? output.registryId : undefined,
          repositoryName: output.repositoryName !== undefined && output.repositoryName !== null ? output.repositoryName : undefined,
      };
  };
  var deserializeAws_json1_1ImageDetailList = function (output, context) {
      return (output || [])
          .filter(function (e) { return e != null; })
          .map(function (entry) {
          if (entry === null) {
              return null;
          }
          return deserializeAws_json1_1ImageDetail(entry, context);
      });
  };
  var deserializeAws_json1_1ImageDigestDoesNotMatchException = function (output, context) {
      return {
          message: output.message !== undefined && output.message !== null ? output.message : undefined,
      };
  };
  var deserializeAws_json1_1ImageFailure = function (output, context) {
      return {
          failureCode: output.failureCode !== undefined && output.failureCode !== null ? output.failureCode : undefined,
          failureReason: output.failureReason !== undefined && output.failureReason !== null ? output.failureReason : undefined,
          imageId: output.imageId !== undefined && output.imageId !== null
              ? deserializeAws_json1_1ImageIdentifier(output.imageId, context)
              : undefined,
      };
  };
  var deserializeAws_json1_1ImageFailureList = function (output, context) {
      return (output || [])
          .filter(function (e) { return e != null; })
          .map(function (entry) {
          if (entry === null) {
              return null;
          }
          return deserializeAws_json1_1ImageFailure(entry, context);
      });
  };
  var deserializeAws_json1_1ImageIdentifier = function (output, context) {
      return {
          imageDigest: output.imageDigest !== undefined && output.imageDigest !== null ? output.imageDigest : undefined,
          imageTag: output.imageTag !== undefined && output.imageTag !== null ? output.imageTag : undefined,
      };
  };
  var deserializeAws_json1_1ImageIdentifierList = function (output, context) {
      return (output || [])
          .filter(function (e) { return e != null; })
          .map(function (entry) {
          if (entry === null) {
              return null;
          }
          return deserializeAws_json1_1ImageIdentifier(entry, context);
      });
  };
  var deserializeAws_json1_1ImageList = function (output, context) {
      return (output || [])
          .filter(function (e) { return e != null; })
          .map(function (entry) {
          if (entry === null) {
              return null;
          }
          return deserializeAws_json1_1Image(entry, context);
      });
  };
  var deserializeAws_json1_1ImageNotFoundException = function (output, context) {
      return {
          message: output.message !== undefined && output.message !== null ? output.message : undefined,
      };
  };
  var deserializeAws_json1_1ImageScanFinding = function (output, context) {
      return {
          attributes: output.attributes !== undefined && output.attributes !== null
              ? deserializeAws_json1_1AttributeList(output.attributes, context)
              : undefined,
          description: output.description !== undefined && output.description !== null ? output.description : undefined,
          name: output.name !== undefined && output.name !== null ? output.name : undefined,
          severity: output.severity !== undefined && output.severity !== null ? output.severity : undefined,
          uri: output.uri !== undefined && output.uri !== null ? output.uri : undefined,
      };
  };
  var deserializeAws_json1_1ImageScanFindingList = function (output, context) {
      return (output || [])
          .filter(function (e) { return e != null; })
          .map(function (entry) {
          if (entry === null) {
              return null;
          }
          return deserializeAws_json1_1ImageScanFinding(entry, context);
      });
  };
  var deserializeAws_json1_1ImageScanFindings = function (output, context) {
      return {
          findingSeverityCounts: output.findingSeverityCounts !== undefined && output.findingSeverityCounts !== null
              ? deserializeAws_json1_1FindingSeverityCounts(output.findingSeverityCounts, context)
              : undefined,
          findings: output.findings !== undefined && output.findings !== null
              ? deserializeAws_json1_1ImageScanFindingList(output.findings, context)
              : undefined,
          imageScanCompletedAt: output.imageScanCompletedAt !== undefined && output.imageScanCompletedAt !== null
              ? new Date(Math.round(output.imageScanCompletedAt * 1000))
              : undefined,
          vulnerabilitySourceUpdatedAt: output.vulnerabilitySourceUpdatedAt !== undefined && output.vulnerabilitySourceUpdatedAt !== null
              ? new Date(Math.round(output.vulnerabilitySourceUpdatedAt * 1000))
              : undefined,
      };
  };
  var deserializeAws_json1_1ImageScanFindingsSummary = function (output, context) {
      return {
          findingSeverityCounts: output.findingSeverityCounts !== undefined && output.findingSeverityCounts !== null
              ? deserializeAws_json1_1FindingSeverityCounts(output.findingSeverityCounts, context)
              : undefined,
          imageScanCompletedAt: output.imageScanCompletedAt !== undefined && output.imageScanCompletedAt !== null
              ? new Date(Math.round(output.imageScanCompletedAt * 1000))
              : undefined,
          vulnerabilitySourceUpdatedAt: output.vulnerabilitySourceUpdatedAt !== undefined && output.vulnerabilitySourceUpdatedAt !== null
              ? new Date(Math.round(output.vulnerabilitySourceUpdatedAt * 1000))
              : undefined,
      };
  };
  var deserializeAws_json1_1ImageScanningConfiguration = function (output, context) {
      return {
          scanOnPush: output.scanOnPush !== undefined && output.scanOnPush !== null ? output.scanOnPush : undefined,
      };
  };
  var deserializeAws_json1_1ImageScanStatus = function (output, context) {
      return {
          description: output.description !== undefined && output.description !== null ? output.description : undefined,
          status: output.status !== undefined && output.status !== null ? output.status : undefined,
      };
  };
  var deserializeAws_json1_1ImageTagAlreadyExistsException = function (output, context) {
      return {
          message: output.message !== undefined && output.message !== null ? output.message : undefined,
      };
  };
  var deserializeAws_json1_1ImageTagList = function (output, context) {
      return (output || [])
          .filter(function (e) { return e != null; })
          .map(function (entry) {
          if (entry === null) {
              return null;
          }
          return entry;
      });
  };
  var deserializeAws_json1_1InitiateLayerUploadResponse = function (output, context) {
      return {
          partSize: output.partSize !== undefined && output.partSize !== null ? output.partSize : undefined,
          uploadId: output.uploadId !== undefined && output.uploadId !== null ? output.uploadId : undefined,
      };
  };
  var deserializeAws_json1_1InvalidLayerException = function (output, context) {
      return {
          message: output.message !== undefined && output.message !== null ? output.message : undefined,
      };
  };
  var deserializeAws_json1_1InvalidLayerPartException = function (output, context) {
      return {
          lastValidByteReceived: output.lastValidByteReceived !== undefined && output.lastValidByteReceived !== null
              ? output.lastValidByteReceived
              : undefined,
          message: output.message !== undefined && output.message !== null ? output.message : undefined,
          registryId: output.registryId !== undefined && output.registryId !== null ? output.registryId : undefined,
          repositoryName: output.repositoryName !== undefined && output.repositoryName !== null ? output.repositoryName : undefined,
          uploadId: output.uploadId !== undefined && output.uploadId !== null ? output.uploadId : undefined,
      };
  };
  var deserializeAws_json1_1InvalidParameterException = function (output, context) {
      return {
          message: output.message !== undefined && output.message !== null ? output.message : undefined,
      };
  };
  var deserializeAws_json1_1InvalidTagParameterException = function (output, context) {
      return {
          message: output.message !== undefined && output.message !== null ? output.message : undefined,
      };
  };
  var deserializeAws_json1_1KmsException = function (output, context) {
      return {
          kmsError: output.kmsError !== undefined && output.kmsError !== null ? output.kmsError : undefined,
          message: output.message !== undefined && output.message !== null ? output.message : undefined,
      };
  };
  var deserializeAws_json1_1Layer = function (output, context) {
      return {
          layerAvailability: output.layerAvailability !== undefined && output.layerAvailability !== null
              ? output.layerAvailability
              : undefined,
          layerDigest: output.layerDigest !== undefined && output.layerDigest !== null ? output.layerDigest : undefined,
          layerSize: output.layerSize !== undefined && output.layerSize !== null ? output.layerSize : undefined,
          mediaType: output.mediaType !== undefined && output.mediaType !== null ? output.mediaType : undefined,
      };
  };
  var deserializeAws_json1_1LayerAlreadyExistsException = function (output, context) {
      return {
          message: output.message !== undefined && output.message !== null ? output.message : undefined,
      };
  };
  var deserializeAws_json1_1LayerFailure = function (output, context) {
      return {
          failureCode: output.failureCode !== undefined && output.failureCode !== null ? output.failureCode : undefined,
          failureReason: output.failureReason !== undefined && output.failureReason !== null ? output.failureReason : undefined,
          layerDigest: output.layerDigest !== undefined && output.layerDigest !== null ? output.layerDigest : undefined,
      };
  };
  var deserializeAws_json1_1LayerFailureList = function (output, context) {
      return (output || [])
          .filter(function (e) { return e != null; })
          .map(function (entry) {
          if (entry === null) {
              return null;
          }
          return deserializeAws_json1_1LayerFailure(entry, context);
      });
  };
  var deserializeAws_json1_1LayerInaccessibleException = function (output, context) {
      return {
          message: output.message !== undefined && output.message !== null ? output.message : undefined,
      };
  };
  var deserializeAws_json1_1LayerList = function (output, context) {
      return (output || [])
          .filter(function (e) { return e != null; })
          .map(function (entry) {
          if (entry === null) {
              return null;
          }
          return deserializeAws_json1_1Layer(entry, context);
      });
  };
  var deserializeAws_json1_1LayerPartTooSmallException = function (output, context) {
      return {
          message: output.message !== undefined && output.message !== null ? output.message : undefined,
      };
  };
  var deserializeAws_json1_1LayersNotFoundException = function (output, context) {
      return {
          message: output.message !== undefined && output.message !== null ? output.message : undefined,
      };
  };
  var deserializeAws_json1_1LifecyclePolicyNotFoundException = function (output, context) {
      return {
          message: output.message !== undefined && output.message !== null ? output.message : undefined,
      };
  };
  var deserializeAws_json1_1LifecyclePolicyPreviewInProgressException = function (output, context) {
      return {
          message: output.message !== undefined && output.message !== null ? output.message : undefined,
      };
  };
  var deserializeAws_json1_1LifecyclePolicyPreviewNotFoundException = function (output, context) {
      return {
          message: output.message !== undefined && output.message !== null ? output.message : undefined,
      };
  };
  var deserializeAws_json1_1LifecyclePolicyPreviewResult = function (output, context) {
      return {
          action: output.action !== undefined && output.action !== null
              ? deserializeAws_json1_1LifecyclePolicyRuleAction(output.action, context)
              : undefined,
          appliedRulePriority: output.appliedRulePriority !== undefined && output.appliedRulePriority !== null
              ? output.appliedRulePriority
              : undefined,
          imageDigest: output.imageDigest !== undefined && output.imageDigest !== null ? output.imageDigest : undefined,
          imagePushedAt: output.imagePushedAt !== undefined && output.imagePushedAt !== null
              ? new Date(Math.round(output.imagePushedAt * 1000))
              : undefined,
          imageTags: output.imageTags !== undefined && output.imageTags !== null
              ? deserializeAws_json1_1ImageTagList(output.imageTags, context)
              : undefined,
      };
  };
  var deserializeAws_json1_1LifecyclePolicyPreviewResultList = function (output, context) {
      return (output || [])
          .filter(function (e) { return e != null; })
          .map(function (entry) {
          if (entry === null) {
              return null;
          }
          return deserializeAws_json1_1LifecyclePolicyPreviewResult(entry, context);
      });
  };
  var deserializeAws_json1_1LifecyclePolicyPreviewSummary = function (output, context) {
      return {
          expiringImageTotalCount: output.expiringImageTotalCount !== undefined && output.expiringImageTotalCount !== null
              ? output.expiringImageTotalCount
              : undefined,
      };
  };
  var deserializeAws_json1_1LifecyclePolicyRuleAction = function (output, context) {
      return {
          type: output.type !== undefined && output.type !== null ? output.type : undefined,
      };
  };
  var deserializeAws_json1_1LimitExceededException = function (output, context) {
      return {
          message: output.message !== undefined && output.message !== null ? output.message : undefined,
      };
  };
  var deserializeAws_json1_1ListImagesResponse = function (output, context) {
      return {
          imageIds: output.imageIds !== undefined && output.imageIds !== null
              ? deserializeAws_json1_1ImageIdentifierList(output.imageIds, context)
              : undefined,
          nextToken: output.nextToken !== undefined && output.nextToken !== null ? output.nextToken : undefined,
      };
  };
  var deserializeAws_json1_1ListTagsForResourceResponse = function (output, context) {
      return {
          tags: output.tags !== undefined && output.tags !== null
              ? deserializeAws_json1_1TagList(output.tags, context)
              : undefined,
      };
  };
  var deserializeAws_json1_1PutImageResponse = function (output, context) {
      return {
          image: output.image !== undefined && output.image !== null
              ? deserializeAws_json1_1Image(output.image, context)
              : undefined,
      };
  };
  var deserializeAws_json1_1PutImageScanningConfigurationResponse = function (output, context) {
      return {
          imageScanningConfiguration: output.imageScanningConfiguration !== undefined && output.imageScanningConfiguration !== null
              ? deserializeAws_json1_1ImageScanningConfiguration(output.imageScanningConfiguration, context)
              : undefined,
          registryId: output.registryId !== undefined && output.registryId !== null ? output.registryId : undefined,
          repositoryName: output.repositoryName !== undefined && output.repositoryName !== null ? output.repositoryName : undefined,
      };
  };
  var deserializeAws_json1_1PutImageTagMutabilityResponse = function (output, context) {
      return {
          imageTagMutability: output.imageTagMutability !== undefined && output.imageTagMutability !== null
              ? output.imageTagMutability
              : undefined,
          registryId: output.registryId !== undefined && output.registryId !== null ? output.registryId : undefined,
          repositoryName: output.repositoryName !== undefined && output.repositoryName !== null ? output.repositoryName : undefined,
      };
  };
  var deserializeAws_json1_1PutLifecyclePolicyResponse = function (output, context) {
      return {
          lifecyclePolicyText: output.lifecyclePolicyText !== undefined && output.lifecyclePolicyText !== null
              ? output.lifecyclePolicyText
              : undefined,
          registryId: output.registryId !== undefined && output.registryId !== null ? output.registryId : undefined,
          repositoryName: output.repositoryName !== undefined && output.repositoryName !== null ? output.repositoryName : undefined,
      };
  };
  var deserializeAws_json1_1PutRegistryPolicyResponse = function (output, context) {
      return {
          policyText: output.policyText !== undefined && output.policyText !== null ? output.policyText : undefined,
          registryId: output.registryId !== undefined && output.registryId !== null ? output.registryId : undefined,
      };
  };
  var deserializeAws_json1_1PutReplicationConfigurationResponse = function (output, context) {
      return {
          replicationConfiguration: output.replicationConfiguration !== undefined && output.replicationConfiguration !== null
              ? deserializeAws_json1_1ReplicationConfiguration(output.replicationConfiguration, context)
              : undefined,
      };
  };
  var deserializeAws_json1_1ReferencedImagesNotFoundException = function (output, context) {
      return {
          message: output.message !== undefined && output.message !== null ? output.message : undefined,
      };
  };
  var deserializeAws_json1_1RegistryPolicyNotFoundException = function (output, context) {
      return {
          message: output.message !== undefined && output.message !== null ? output.message : undefined,
      };
  };
  var deserializeAws_json1_1ReplicationConfiguration = function (output, context) {
      return {
          rules: output.rules !== undefined && output.rules !== null
              ? deserializeAws_json1_1ReplicationRuleList(output.rules, context)
              : undefined,
      };
  };
  var deserializeAws_json1_1ReplicationDestination = function (output, context) {
      return {
          region: output.region !== undefined && output.region !== null ? output.region : undefined,
          registryId: output.registryId !== undefined && output.registryId !== null ? output.registryId : undefined,
      };
  };
  var deserializeAws_json1_1ReplicationDestinationList = function (output, context) {
      return (output || [])
          .filter(function (e) { return e != null; })
          .map(function (entry) {
          if (entry === null) {
              return null;
          }
          return deserializeAws_json1_1ReplicationDestination(entry, context);
      });
  };
  var deserializeAws_json1_1ReplicationRule = function (output, context) {
      return {
          destinations: output.destinations !== undefined && output.destinations !== null
              ? deserializeAws_json1_1ReplicationDestinationList(output.destinations, context)
              : undefined,
      };
  };
  var deserializeAws_json1_1ReplicationRuleList = function (output, context) {
      return (output || [])
          .filter(function (e) { return e != null; })
          .map(function (entry) {
          if (entry === null) {
              return null;
          }
          return deserializeAws_json1_1ReplicationRule(entry, context);
      });
  };
  var deserializeAws_json1_1Repository = function (output, context) {
      return {
          createdAt: output.createdAt !== undefined && output.createdAt !== null
              ? new Date(Math.round(output.createdAt * 1000))
              : undefined,
          encryptionConfiguration: output.encryptionConfiguration !== undefined && output.encryptionConfiguration !== null
              ? deserializeAws_json1_1EncryptionConfiguration(output.encryptionConfiguration, context)
              : undefined,
          imageScanningConfiguration: output.imageScanningConfiguration !== undefined && output.imageScanningConfiguration !== null
              ? deserializeAws_json1_1ImageScanningConfiguration(output.imageScanningConfiguration, context)
              : undefined,
          imageTagMutability: output.imageTagMutability !== undefined && output.imageTagMutability !== null
              ? output.imageTagMutability
              : undefined,
          registryId: output.registryId !== undefined && output.registryId !== null ? output.registryId : undefined,
          repositoryArn: output.repositoryArn !== undefined && output.repositoryArn !== null ? output.repositoryArn : undefined,
          repositoryName: output.repositoryName !== undefined && output.repositoryName !== null ? output.repositoryName : undefined,
          repositoryUri: output.repositoryUri !== undefined && output.repositoryUri !== null ? output.repositoryUri : undefined,
      };
  };
  var deserializeAws_json1_1RepositoryAlreadyExistsException = function (output, context) {
      return {
          message: output.message !== undefined && output.message !== null ? output.message : undefined,
      };
  };
  var deserializeAws_json1_1RepositoryList = function (output, context) {
      return (output || [])
          .filter(function (e) { return e != null; })
          .map(function (entry) {
          if (entry === null) {
              return null;
          }
          return deserializeAws_json1_1Repository(entry, context);
      });
  };
  var deserializeAws_json1_1RepositoryNotEmptyException = function (output, context) {
      return {
          message: output.message !== undefined && output.message !== null ? output.message : undefined,
      };
  };
  var deserializeAws_json1_1RepositoryNotFoundException = function (output, context) {
      return {
          message: output.message !== undefined && output.message !== null ? output.message : undefined,
      };
  };
  var deserializeAws_json1_1RepositoryPolicyNotFoundException = function (output, context) {
      return {
          message: output.message !== undefined && output.message !== null ? output.message : undefined,
      };
  };
  var deserializeAws_json1_1ScanNotFoundException = function (output, context) {
      return {
          message: output.message !== undefined && output.message !== null ? output.message : undefined,
      };
  };
  var deserializeAws_json1_1ServerException = function (output, context) {
      return {
          message: output.message !== undefined && output.message !== null ? output.message : undefined,
      };
  };
  var deserializeAws_json1_1SetRepositoryPolicyResponse = function (output, context) {
      return {
          policyText: output.policyText !== undefined && output.policyText !== null ? output.policyText : undefined,
          registryId: output.registryId !== undefined && output.registryId !== null ? output.registryId : undefined,
          repositoryName: output.repositoryName !== undefined && output.repositoryName !== null ? output.repositoryName : undefined,
      };
  };
  var deserializeAws_json1_1StartImageScanResponse = function (output, context) {
      return {
          imageId: output.imageId !== undefined && output.imageId !== null
              ? deserializeAws_json1_1ImageIdentifier(output.imageId, context)
              : undefined,
          imageScanStatus: output.imageScanStatus !== undefined && output.imageScanStatus !== null
              ? deserializeAws_json1_1ImageScanStatus(output.imageScanStatus, context)
              : undefined,
          registryId: output.registryId !== undefined && output.registryId !== null ? output.registryId : undefined,
          repositoryName: output.repositoryName !== undefined && output.repositoryName !== null ? output.repositoryName : undefined,
      };
  };
  var deserializeAws_json1_1StartLifecyclePolicyPreviewResponse = function (output, context) {
      return {
          lifecyclePolicyText: output.lifecyclePolicyText !== undefined && output.lifecyclePolicyText !== null
              ? output.lifecyclePolicyText
              : undefined,
          registryId: output.registryId !== undefined && output.registryId !== null ? output.registryId : undefined,
          repositoryName: output.repositoryName !== undefined && output.repositoryName !== null ? output.repositoryName : undefined,
          status: output.status !== undefined && output.status !== null ? output.status : undefined,
      };
  };
  var deserializeAws_json1_1Tag = function (output, context) {
      return {
          Key: output.Key !== undefined && output.Key !== null ? output.Key : undefined,
          Value: output.Value !== undefined && output.Value !== null ? output.Value : undefined,
      };
  };
  var deserializeAws_json1_1TagList = function (output, context) {
      return (output || [])
          .filter(function (e) { return e != null; })
          .map(function (entry) {
          if (entry === null) {
              return null;
          }
          return deserializeAws_json1_1Tag(entry, context);
      });
  };
  var deserializeAws_json1_1TagResourceResponse = function (output, context) {
      return {};
  };
  var deserializeAws_json1_1TooManyTagsException = function (output, context) {
      return {
          message: output.message !== undefined && output.message !== null ? output.message : undefined,
      };
  };
  var deserializeAws_json1_1UnsupportedImageTypeException = function (output, context) {
      return {
          message: output.message !== undefined && output.message !== null ? output.message : undefined,
      };
  };
  var deserializeAws_json1_1UntagResourceResponse = function (output, context) {
      return {};
  };
  var deserializeAws_json1_1UploadLayerPartResponse = function (output, context) {
      return {
          lastByteReceived: output.lastByteReceived !== undefined && output.lastByteReceived !== null ? output.lastByteReceived : undefined,
          registryId: output.registryId !== undefined && output.registryId !== null ? output.registryId : undefined,
          repositoryName: output.repositoryName !== undefined && output.repositoryName !== null ? output.repositoryName : undefined,
          uploadId: output.uploadId !== undefined && output.uploadId !== null ? output.uploadId : undefined,
      };
  };
  var deserializeAws_json1_1UploadNotFoundException = function (output, context) {
      return {
          message: output.message !== undefined && output.message !== null ? output.message : undefined,
      };
  };
  var deserializeAws_json1_1ValidationException = function (output, context) {
      return {
          message: output.message !== undefined && output.message !== null ? output.message : undefined,
      };
  };
  var deserializeMetadata = function (output) {
      var _a;
      return ({
          httpStatusCode: output.statusCode,
          requestId: (_a = output.headers["x-amzn-requestid"]) !== null && _a !== void 0 ? _a : output.headers["x-amzn-request-id"],
          extendedRequestId: output.headers["x-amz-id-2"],
          cfId: output.headers["x-amz-cf-id"],
      });
  };
  // Collect low-level response body stream to Uint8Array.
  var collectBody = function (streamBody, context) {
      if (streamBody === void 0) { streamBody = new Uint8Array(); }
      if (streamBody instanceof Uint8Array) {
          return Promise.resolve(streamBody);
      }
      return context.streamCollector(streamBody) || Promise.resolve(new Uint8Array());
  };
  // Encode Uint8Array data into string with utf-8.
  var collectBodyString = function (streamBody, context) {
      return collectBody(streamBody, context).then(function (body) { return context.utf8Encoder(body); });
  };
  var buildHttpRpcRequest = function (context, headers, path, resolvedHostname, body) { return __awaiter(void 0, void 0, void 0, function () {
      var _a, hostname, _b, protocol, port, contents;
      return __generator(this, function (_c) {
          switch (_c.label) {
              case 0: return [4 /*yield*/, context.endpoint()];
              case 1:
                  _a = _c.sent(), hostname = _a.hostname, _b = _a.protocol, protocol = _b === void 0 ? "https" : _b, port = _a.port;
                  contents = {
                      protocol: protocol,
                      hostname: hostname,
                      port: port,
                      method: "POST",
                      path: path,
                      headers: headers,
                  };
                  if (resolvedHostname !== undefined) {
                      contents.hostname = resolvedHostname;
                  }
                  if (body !== undefined) {
                      contents.body = body;
                  }
                  return [2 /*return*/, new __HttpRequest(contents)];
          }
      });
  }); };
  var parseBody = function (streamBody, context) {
      return collectBodyString(streamBody, context).then(function (encoded) {
          if (encoded.length) {
              return JSON.parse(encoded);
          }
          return {};
      });
  };
  /**
   * Load an error code for the aws.rest-json-1.1 protocol.
   */
  var loadRestJsonErrorCode = function (output, data) {
      var findKey = function (object, key) { return Object.keys(object).find(function (k) { return k.toLowerCase() === key.toLowerCase(); }); };
      var sanitizeErrorCode = function (rawValue) {
          var cleanValue = rawValue;
          if (cleanValue.indexOf(":") >= 0) {
              cleanValue = cleanValue.split(":")[0];
          }
          if (cleanValue.indexOf("#") >= 0) {
              cleanValue = cleanValue.split("#")[1];
          }
          return cleanValue;
      };
      var headerKey = findKey(output.headers, "x-amzn-errortype");
      if (headerKey !== undefined) {
          return sanitizeErrorCode(output.headers[headerKey]);
      }
      if (data.code !== undefined) {
          return sanitizeErrorCode(data.code);
      }
      if (data["__type"] !== undefined) {
          return sanitizeErrorCode(data["__type"]);
      }
      return "";
  };
  //# sourceMappingURL=Aws_json1_1.js.map