class GoogleCloudStorageWriteChannel extends AbstractGoogleAsyncWriteChannel<Insert, StorageObject> implements GoogleCloudStorageItemInfo.Provider {

  @Override
  public Insert createRequest(InputStreamContent inputStream) throws IOException {
    // Create object with the given name and metadata.
    StorageObject object =
        new StorageObject()
            .setContentEncoding(createOptions.getContentEncoding())
            .setMetadata(encodeMetadata(createOptions.getMetadata()))
            .setName(resourceId.getObjectName());

    Insert insert =
        gcs.objects()
            .insert(resourceId.getBucketName(), object, inputStream)
            .setName(resourceId.getObjectName())
            .setKmsKeyName(createOptions.getKmsKeyName());
    writeConditions.apply(insert);
    if (insert.getMediaHttpUploader() != null) {
      insert
          .getMediaHttpUploader()
          .setDirectUploadEnabled(isDirectUploadEnabled())
          .setProgressListener(
              new LoggingMediaHttpUploaderProgressListener(
                  resourceId.getObjectName(), MIN_LOGGING_INTERVAL_MS));
    }
    return insert;
  }

  public  GoogleCloudStorageWriteChannel(
      Storage gcs,
      ClientRequestHelper<StorageObject> requestHelper,
      ExecutorService uploadThreadPool,
      AsyncWriteChannelOptions channelOptions,
      StorageResourceId resourceId,
      CreateObjectOptions createOptions,
      ObjectWriteConditions writeConditions);

}