code: public Observable<ServiceResponse<VirtualMachineCaptureResultInner>> captureWithServiceResponseAsync(String resourceGroupName, String vmName, VirtualMachineCaptureParameters parameters) {
          if (resourceGroupName == null) {
              throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.");
          }
          if (vmName == null) {
              throw new IllegalArgumentException("Parameter vmName is required and cannot be null.");
          }
          if (this.client.subscriptionId() == null) {
              throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null.");
          }
          if (parameters == null) {
              throw new IllegalArgumentException("Parameter parameters is required and cannot be null.");
          }
          if (this.client.apiVersion() == null) {
              throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null.");
          }
          Validator.validate(parameters);
          Observable<Response<ResponseBody>> observable = service.capture(resourceGroupName, vmName, this.client.subscriptionId(), parameters, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent());
          return client.getAzureClient().getPostOrDeleteResultAsync(observable, new TypeToken<VirtualMachineCaptureResultInner>() { }.getType());
      }
docs: Captures the VM by copying virtual hard disks of the VM and outputs a template that can be used to create similar VMs.
  
  @param resourceGroupName The name of the resource group.
  @param vmName The name of the virtual machine.
  @param parameters Parameters supplied to the Capture Virtual Machine operation.
  @throws IllegalArgumentException thrown if parameters fail the validation
  @return the observable for the request