Skip to content

Latest commit

 

History

History
357 lines (296 loc) · 9.81 KB

File metadata and controls

357 lines (296 loc) · 9.81 KB

Azure Storage TypeScript Protocol Layer

see https://aka.ms/autorest

Configuration

package-name: azure-storage-datalake
title: StorageClient
description: Storage Client
enable-xml: true
generate-metadata: false
license-header: MICROSOFT_MIT_NO_VERSION
output-folder: ../src/generated
input-file: https://raw.githubusercontent.com/Azure/azure-rest-api-specs/0b1123325e02aa5515ed7641923a8f7a6c8b545a/specification/storage/data-plane/Azure.Storage.Files.DataLake/preview/2021-06-08/DataLakeStorage.json
model-date-time-as-string: true
optional-response-headers: true
v3: true
disable-async-iterators: true
add-credentials: false
use-extension:
  "@autorest/typescript": "6.0.0-dev.20210223.1"
package-version: 12.11.0

Customizations for Track 2 Generator

See the AutoRest samples for more about how we're customizing things.

Don't include container or blob in path - we have direct URIs.

directive:
  - from: swagger-document
    where: $["x-ms-paths"]
    transform: >
      for (const property in $)
      {
          if (property.includes('/{filesystem}/{path}'))
          {
              $[property]["parameters"] = $[property]["parameters"].filter(function(param) { return (typeof param['$ref'] === "undefined") || (false == param['$ref'].endsWith("#/parameters/FileSystem") && false == param['$ref'].endsWith("#/parameters/Path"))});
          } 
          else if (property.includes('/{filesystem}'))
          {
              $[property]["parameters"] = $[property]["parameters"].filter(function(param) { return (typeof param['$ref'] === "undefined") || (false == param['$ref'].endsWith("#/parameters/FileSystem"))});
          }
      }

Update DataLakeStorageClientContext to StorageClientContext

directive:
  - from: swagger-document
    where: $.info["x-ms-code-generation-settings"]
    transform: >
      $.name = "StorageClient"

Remove parameter FileSystem

directive:
  - from: swagger-document
    where: $.parameters
    transform: >
      $.FileSystem = undefined

Remove parameter Path

directive:
  - from: swagger-document
    where: $.parameters
    transform: >
      $.Path = undefined

workaround: adding parameter location for PathSetAccessControlRecursiveMode

directive:
  - from: swagger-document
    where: $["parameters"].PathSetAccessControlRecursiveMode
    transform: >
      $["x-ms-parameter-location"] = "method";

Rename path-HTTP-headers to path-Http-headers

directive:
  - from: swagger-document
    where: $.parameters
    transform: >
      $.CacheControl["x-ms-parameter-grouping"].name = "path-Http-headers";
      $.ContentDisposition["x-ms-parameter-grouping"].name = "path-Http-headers";
      $.ContentEncoding["x-ms-parameter-grouping"].name = "path-Http-headers";
      $.ContentLanguage["x-ms-parameter-grouping"].name = "path-Http-headers";
      $.ContentType["x-ms-parameter-grouping"].name = "path-Http-headers";
      $.TransactionalContentMD5["x-ms-parameter-grouping"].name = "path-Http-headers";
      $.ContentMD5["x-ms-parameter-grouping"].name = "path-Http-headers";

Rename response property ACL to acl for Path_GetProperties

directive:
  - from: swagger-document
    where: $["x-ms-paths"]["/{filesystem}/{path}"].head.responses["200"].headers["x-ms-acl"]
    transform: >
      $["x-ms-client-name"] = "acl";

Update last modified property from string type to Date for FileSystem and Path models

directive:
  - from: swagger-document
    where: $.definitions
    transform: >
      $.FileSystem.properties.lastModified.format = "date-time-rfc1123";
      $.Path.properties.lastModified.format = "date-time-rfc1123";

Rename eTag -> etag

directive:
  - from: swagger-document
    where: $["x-ms-paths"]..responses..headers["ETag"]
    transform: >
      $["x-ms-client-name"] = "etag";
  - from: swagger-document
    where: $["definitions"]..["eTag"]
    transform: >
      $["x-ms-client-name"] = "etag";

workaround: adding parameter location for PathSetAccessControlRecursiveMode

directive:
  - from: swagger-document
    where: $["parameters"].PathSetAccessControlRecursiveMode
    transform: >
      $["x-ms-parameter-location"] = "method";

Add Code to StorageError properties

directive:
  - from: swagger-document
    where: $.definitions.StorageError
    transform: >
      $.properties.Code = { "type": "string" };

Add ErrorCode to Path_Create response headers

directive:
  - from: swagger-document
    where: $["x-ms-paths"]["/{filesystem}/{path}"]["put"]["responses"]["201"]["headers"]
    transform: >
      $["x-ms-error-code"] = {};
      $["x-ms-error-code"]["x-ms-client-name"] = "ErrorCode";
      $["x-ms-error-code"]["type"] = "string";
      $["x-ms-error-code"]["description"] = "Error Code";

Add ErrorCode to Path_Delete response headers

directive:
  - from: swagger-document
    where: $["x-ms-paths"]["/{filesystem}/{path}"]["delete"]["responses"]["200"]["headers"]
    transform: >
      $["x-ms-error-code"] = {};
      $["x-ms-error-code"]["x-ms-client-name"] = "ErrorCode";
      $["x-ms-error-code"]["type"] = "string";
      $["x-ms-error-code"]["description"] = "Error Code";

Add ErrorCode to Path_SetExpiry response headers

directive:
  - from: swagger-document
    where: $["x-ms-paths"]["/{filesystem}/{path}?comp=expiry"]["put"]["responses"]["200"]["headers"]
    transform: >
      $["x-ms-error-code"] = {};
      $["x-ms-error-code"]["x-ms-client-name"] = "ErrorCode";
      $["x-ms-error-code"]["type"] = "string";
      $["x-ms-error-code"]["description"] = "Error Code";

Add ErrorCode to FileSystem_ListPaths response headers

directive:
  - from: swagger-document
    where: $["x-ms-paths"]["/{filesystem}?resource=filesystem"]["get"]["responses"]["200"]["headers"]
    transform: >
      $["x-ms-error-code"] = {};
      $["x-ms-error-code"]["x-ms-client-name"] = "ErrorCode";
      $["x-ms-error-code"]["type"] = "string";
      $["x-ms-error-code"]["description"] = "Error Code";

Add ErrorCode to Path_Update response headers

directive:
  - from: swagger-document
    where: $["x-ms-paths"]["/{filesystem}/{path}"]["patch"]["responses"]["200"]["headers"]
    transform: >
      $["x-ms-error-code"] = {};
      $["x-ms-error-code"]["x-ms-client-name"] = "ErrorCode";
      $["x-ms-error-code"]["type"] = "string";
      $["x-ms-error-code"]["description"] = "Error Code";

Add ErrorCode to Path_Update response headers

directive:
  - from: swagger-document
    where: $["x-ms-paths"]["/{filesystem}/{path}"]["patch"]["responses"]["202"]["headers"]
    transform: >
      $["x-ms-error-code"] = {};
      $["x-ms-error-code"]["x-ms-client-name"] = "ErrorCode";
      $["x-ms-error-code"]["type"] = "string";
      $["x-ms-error-code"]["description"] = "Error Code";

Add ErrorCode to Path_GetProperties response headers

directive:
  - from: swagger-document
    where: $["x-ms-paths"]["/{filesystem}/{path}"]["head"]["responses"]["200"]["headers"]
    transform: >
      $["x-ms-error-code"] = {};
      $["x-ms-error-code"]["x-ms-client-name"] = "ErrorCode";
      $["x-ms-error-code"]["type"] = "string";
      $["x-ms-error-code"]["description"] = "Error Code";

Define PathExpiryOptions as enum type

directive:
  - from: swagger-document
    where: $["parameters"].PathExpiryOptions
    transform: >
      delete $["x-ms-enum"]["modelAsString"];

Add ErrorCode to FileSystem_ListBlobHierarchySegment response headers

directive:
  - from: swagger-document
    where: $["x-ms-paths"]["/{filesystem}?restype=container&comp=list&hierarchy"]["get"]["responses"]["200"]["headers"]
    transform: >
      $["x-ms-error-code"] = {};
      $["x-ms-error-code"]["x-ms-client-name"] = "ErrorCode";
      $["x-ms-error-code"]["type"] = "string";
      $["x-ms-error-code"]["description"] = "Error Code";

Hide x-ms-pageable in FileSystem_ListBlobHierarchySegment

directive:
  - from: swagger-document
    where: $["x-ms-paths"]["/{filesystem}?restype=container&comp=list&hierarchy"]["get"]
    transform: >
      delete $["x-ms-pageable"];

Rename "BlobItemInternal" to "BlobItemModel" to avoid "internal" word in interface.

directive:
  - from: swagger-document
    where: $["definitions"]["BlobItemInternal"]
    transform: >
      $["x-ms-client-name"] = "BlobItemModel";

Rename "BlobPropertiesInternal" to "BlobPropertiesModel" to avoid "internal" word in interface.

directive:
  - from: swagger-document
    where: $["definitions"]["BlobPropertiesInternal"]
    transform: >
      $["x-ms-client-name"] = "BlobPropertiesModel";

Remove "is" prefix from boolean variable: "isSealed"

directive:
  - from: swagger-document
    where: $["definitions"]["BlobPropertiesInternal"]
    transform: >
      delete $["properties"]["Sealed"]["x-ms-client-name"];

Remove duplicated "DeleteTime" property

directive:
  - from: swagger-document
    where: $["definitions"]["BlobPropertiesInternal"]
    transform: >
      delete $["properties"]["DeleteTime"]

Use model enum as string for EncryptionAlgorithm

directive:
  - from: swagger-document
    where: $.parameters.EncryptionAlgorithm
    transform: >
      $["x-ms-enum"]["modelAsString"] = true;

Fix EncryptionAlgorithm

directive:
  - from: swagger-document
    where: $.parameters
    transform: >
      delete $.EncryptionAlgorithm.enum;
      $.EncryptionAlgorithm.enum = [
        "None",
        "AES256"
      ];

Update service version from "2021-06-08" to "2021-10-04"

directive:
  - from: swagger-document
    where: $.parameters.ApiVersionParameter
    transform: $.enum = [ "2021-10-04" ];