title: gcloud sql instances patch fails with invalid data error
body: <p>When trying to add high availability on an existing Cloud SQL instance using:</p>
  
  <p><code>gcloud sql instances patch $INSTANCE --project $PROJECT --availability-type regional</code></p>
  
  <p>the process fails with this message</p>
  
  <p><code>The following message will be used for the patch API method.
  {"project": "$PROJECT", "name": "$INSTANCE", "settings": {"availabilityType": "REGIONAL", "databaseFlags": [{"name": "sql_mode", "value": "TRADITIONAL"}, {"name": "default_time_zone", "value": "+01:00"}]}}
  ERROR: (gcloud.sql.instances.patch) HTTPError 400: The incoming request contained invalid data.</code></p>
  
  <p>It also fails using the web interface.
  Gcloud version <code>Google Cloud SDK [280.0.0]</code>
  This is the output of the log (not much help that I can see):</p>
  
  <pre><code>2020-02-14 11:01:34,476 DEBUG    root            Loaded Command Group: [u'gcloud', u'sql', u'instances']
  2020-02-14 11:01:34,510 DEBUG    root            Loaded Command Group: [u'gcloud', u'sql', u'instances', u'patch']
  2020-02-14 11:01:34,517 DEBUG    root            Running [gcloud.sql.instances.patch] with arguments: [--availability-type: "regional", --project: "$PROJECT", INSTANCE: "$INSTANCE"]
  2020-02-14 11:01:35,388 INFO     ___FILE_ONLY___ The following message will be used for the patch API method.
  
  2020-02-14 11:01:35,398 INFO     ___FILE_ONLY___ {"project": "$PROJECT", "name": "$INSTANCE", "settings": {"availabilityType": "REGIONAL", "databaseFlags": [{"name": "sql_mode", "value": "TRADITIONAL"}, {"name": "default_time_zone", "value": "+01:00"}]}}
  
  2020-02-14 11:01:35,865 DEBUG    root            (gcloud.sql.instances.patch) HTTPError 400: The incoming request contained invalid data.
  Traceback (most recent call last):
    File "C:\Users\udAL\AppData\Local\Google\Cloud SDK\google-cloud-sdk\lib\googlecloudsdk\calliope\cli.py", line 981, in Execute
      resources = calliope_command.Run(cli=self, args=args)
    File "C:\Users\udAL\AppData\Local\Google\Cloud SDK\google-cloud-sdk\lib\googlecloudsdk\calliope\backend.py", line 807, in Run
      resources = command_instance.Run(args)
    File "C:\Users\udAL\AppData\Local\Google\Cloud SDK\google-cloud-sdk\lib\surface\sql\instances\patch.py", line 306, in Run
      return RunBasePatchCommand(args, self.ReleaseTrack())
    File "C:\Users\udAL\AppData\Local\Google\Cloud SDK\google-cloud-sdk\lib\surface\sql\instances\patch.py", line 278, in RunBasePatchCommand
      instance=instance_ref.instance))
    File "C:\Users\udAL\AppData\Local\Google\Cloud SDK\google-cloud-sdk\lib\googlecloudsdk\third_party\apis\sql\v1beta4\sql_v1beta4_client.py", line 697, in Patch
      config, request, global_params=global_params)
    File "C:\Users\udAL\AppData\Local\Google\Cloud SDK\google-cloud-sdk\bin\..\lib\third_party\apitools\base\py\base_api.py", line 731, in _RunMethod
      return self.ProcessHttpResponse(method_config, http_response, request)
    File "C:\Users\udAL\AppData\Local\Google\Cloud SDK\google-cloud-sdk\bin\..\lib\third_party\apitools\base\py\base_api.py", line 737, in ProcessHttpResponse
      self.__ProcessHttpResponse(method_config, http_response, request))
    File "C:\Users\udAL\AppData\Local\Google\Cloud SDK\google-cloud-sdk\bin\..\lib\third_party\apitools\base\py\base_api.py", line 604, in __ProcessHttpResponse
      http_response, method_config=method_config, request=request)
  HttpBadRequestError: HttpError accessing &lt;https://sqladmin.googleapis.com/sql/v1beta4/projects/$PROJECT/instances/$INSTANCE?alt=json&gt;: response: &lt;{'status': '400', 'content-length': '269', 'x-xss-protection': '0', 'x-content-type-options': 'nosniff', 'transfer-encoding': 'chunked', 'vary': 'Origin, X-Origin, Referer', 'server': 'ESF', '-content-encoding': 'gzip', 'cache-control': 'private', 'date': 'Fri, 14 Feb 2020 10:01:35 GMT', 'x-frame-options': 'SAMEORIGIN', 'alt-svc': 'quic=":443"; ma=2592000; v="46,43",h3-Q050=":443"; ma=2592000,h3-Q049=":443"; ma=2592000,h3-Q048=":443"; ma=2592000,h3-Q046=":443"; ma=2592000,h3-Q043=":443"; ma=2592000', 'content-type': 'application/json; charset=UTF-8'}&gt;, content &lt;{
    "error": {
      "code": 400,
      "message": "The incoming request contained invalid data.",
      "errors": [
        {
          "message": "The incoming request contained invalid data.",
          "domain": "global",
          "reason": "invalidRequest"
        }
      ]
    }
  }
  &gt;
  2020-02-14 11:01:35,868 ERROR    root            (gcloud.sql.instances.patch) HTTPError 400: The incoming request contained invalid data.
  2020-02-14 11:01:35,898 DEBUG    root            Metrics reporting process started...
  </code></pre>
  
  <p><strong>Edit:</strong></p>
  
  <p>When using the gcloud cli command:</p>
  
  <p>gcloud patch with 3 input parameters</p>
  
  <ol>
  <li>Both $PROJECT and $INSTANCE do exist since I can <code>gcloud sql databases list --instance $INSTANCE --project $PROJECT</code> and it works fine.</li>
  <li>availability-type=regional it's documented so should work</li>
  </ol>
  
  <p>I'm not constructing the request manually, I'm using gcloud CLI</p>
  
  <p>When using the console.cloud.google.com web interface:</p>
  
  <p>Main menu -> SQL -> <em>select instance</em> -> Enable High Availability.
  It's a button, no parameters added by myself.</p>
  
  <p>Both return the same error "The incoming request contained invalid data." 
  Can't see how I may be doing it wrong.</p>