sdk/storage/Azure.Storage.Blobs.Batch/swagger/readme.md
# Generate blob storage
input-file: https://raw.githubusercontent.com/Azure/azure-rest-api-specs/5da3c08b92d05858b728b013b69502dc93485373/specification/storage/data-plane/Microsoft.BlobStorage/stable/2021-12-02/blob.json
output-folder: ../src/Generated
clear-output-folder: false
# Use the Azure C# Track 2 generator
# use: C:\src\Storage\Swagger\Generator
# We can't use relative paths here, so use a relative path in generate.ps1
azure-track2-csharp: true
See the AutoRest samples for more about how we're customizing things.
directive:
- from: swagger-document
where: $.info["x-ms-code-generation-settings"]
transform: >
$.namespace = "Azure.Storage.Blobs";
$["client-name"] = "BatchRestClient";
$["client-extensions-name"] = "BlobsExtensions";
$["client-model-factory-name"] = "BlobsModelFactory";
$["x-az-skip-path-components"] = true;
$["x-az-include-sync-methods"] = true;
$["x-az-public"] = false;
To avoid an arbitrary limitation in our generator
directive:
- from: swagger-document
where: $.consumes
transform: >
return ["application/xml"];
- from: swagger-document
where: $.produces
transform: >
return ["application/xml"];
directive:
- from: swagger-document
where: $.parameters.Url
transform: >
$["x-ms-client-name"] = "resourceUri";
$.format = "url";
$["x-az-trace"] = true;
directive:
- from: swagger-document
where: $["x-ms-paths"]..responses..headers["x-ms-request-id"]
transform: >
$["x-az-demote-header"] = true;
- from: swagger-document
where: $["x-ms-paths"]..responses..headers["x-ms-version"]
transform: >
$["x-az-demote-header"] = true;
- from: swagger-document
where: $["x-ms-paths"]..responses..headers["Date"]
transform: >
$["x-az-demote-header"] = true;
- from: swagger-document
where: $["x-ms-paths"]..responses..headers["x-ms-client-request-id"]
transform: >
$["x-az-demote-header"] = true;
directive:
- from: swagger-document
where: $["x-ms-paths"]..responses.default
transform: >
delete $.headers;
$["x-az-response-name"] = "StorageErrorResult";
$["x-az-create-exception"] = true;
$["x-az-public"] = false;
directive:
- from: swagger-document
where: $["x-ms-paths"]["/?comp=batch"].get.responses["200"].headers["Content-Type"]
transform: >
$.description = $.description.replace("<GUID>", "{GUID}");
- from: swagger-document
where: $.parameters.MultipartContentType
transform: >
$.description = $.description.replace("<GUID>", "{GUID}");
directive:
- from: swagger-document
where: $["x-ms-paths"]["/?comp=batch"].post.responses
transform: >
const response = $["200"];
if (response) {
delete $["200"];
$["202"] = response;
$["202"]["x-az-public"] = false;
$["202"]["x-az-response-name"] = "BlobBatchResult";
$["202"]["x-az-response-schema-name"] = "Content";
}
directive:
- from: swagger-document
where: $["x-ms-paths"]["/{containerName}?restype=container&comp=batch"].post.responses
transform: >
const response = $["202"];
if (response) {
delete $["202"];
$["202"] = response;
$["202"]["x-az-public"] = false;
$["202"]["x-az-response-name"] = "BlobBatchResult";
$["202"]["x-az-response-schema-name"] = "Content";
}
directive:
- from: swagger-document
where: $["x-ms-paths"]
transform: >
return {
"/?comp=batch": $["/?comp=batch"],
"/{containerName}?restype=container&comp=batch": $["/{containerName}?restype=container&comp=batch"],
"/{containerName}/{blob}?comp=tier": {
"put": {
...$["/{containerName}/{blob}?comp=tier"].put,
operationId: "Blob_SetAccessTier"
},
"parameters": $["/{containerName}/{blob}?comp=tier"].parameters
},
"/{containerName}/{blob}": { "delete": $["/{containerName}/{blob}"].delete }
};
directive:
- from: swagger-document
where: $.definitions
transform: >
return {
"StorageError": {
...$.StorageError,
"x-az-public": false,
properties: {
...$.StorageError.properties,
Code: { "type": "string" }
}
}
};
directive:
- from: swagger-document
where: $.parameters
transform: >
$ = {
"Body": $.Body,
"ContentLength": $.ContentLength,
"MultipartContentType": $.MultipartContentType,
"Timeout": $.Timeout,
"ApiVersionParameter": $.ApiVersionParameter,
"ClientRequestId": $.ClientRequestId,
"Url": $.Url,
"AccessTierRequired": $.AccessTierRequired,
"RehydratePriority": $.RehydratePriority,
"LeaseIdOptional": $.LeaseIdOptional,
"Snapshot": $.Snapshot,
"DeleteSnapshots": $.DeleteSnapshots,
"IfModifiedSince": $.IfModifiedSince,
"IfUnmodifiedSince": $.IfUnmodifiedSince,
"IfMatch": $.IfMatch,
"IfNoneMatch": $.IfNoneMatch,
"VersionId": $.VersionId,
"IfTags": $.IfTags,
"BlobDeleteType": $.BlobDeleteType
};
$.AccessTierRequired["x-az-external"] = true;
$.RehydratePriority["x-az-external"] = true;
$.RehydratePriority["x-ms-enum"].modelAsString = false;
$.DeleteSnapshots["x-az-external"] = true;
$.DeleteSnapshots["x-ms-enum"].name = "DeleteSnapshotsOption";
$.DeleteSnapshots.enum = [ "none", "include", "only" ];
$.DeleteSnapshots["x-ms-enum"].values = [ { name: "none", value: null }, { name: "IncludeSnapshots", value: "include" }, { name: "OnlySnapshots", value: "only" }];
$.DeleteSnapshots["x-az-enum-skip-value"] = "none";
return $;
directive:
- from: swagger-document
where: $.parameters.BlobDeleteType
transform: >
$["x-az-public"] = false;
directive:
- from: swagger-document
where: $.parameters.ApiVersionParameter
transform: >
delete $.enum