Run dotnet build /t:GenerateCode to generate code.
input-file:
- C:\azure-rest-api-specs\specification\storage\data-plane\Microsoft.BlobStorage\stable\2024-08-04\blob.json
generation1-convenience-client: true
# https://github.com/Azure/autorest/issues/4075
skip-semantics-validation: true
keep-non-overloadable-protocol-signature: true
modelerfour:
seal-single-value-enum-by-default: trueprotocol-method-list:
- Blob_GetProperties
- Blob_AcquireLease
- Container_AcquireLeasedirective:
- from: swagger-document
where: $["x-ms-paths"]
transform: >
for (const property in $)
{
if (property.includes('/{containerName}/{blob}'))
{
$[property]["parameters"] = $[property]["parameters"].filter(function(param) { return (typeof param['$ref'] === "undefined") || (false == param['$ref'].endsWith("#/parameters/ContainerName") && false == param['$ref'].endsWith("#/parameters/Blob"))});
}
else if (property.includes('/{containerName}'))
{
$[property]["parameters"] = $[property]["parameters"].filter(function(param) { return (typeof param['$ref'] === "undefined") || (false == param['$ref'].endsWith("#/parameters/ContainerName"))});
}
}directive:
- from: swagger-document
where: $.parameters
transform: >
delete $.ContainerName["x-ms-parameter-location"];
delete $.Blob["x-ms-parameter-location"];directive:
- from: swagger-document
where: $.parameters
transform: >
$.Blob["x-ms-skip-url-encoding"] = true;
$.ContainerName["x-ms-skip-url-encoding"] = true;directive:
- from: swagger-document
where: $.definitions.ErrorCode["x-ms-enum"]
transform: >
$.name = "BlobErrorCode";directive:
- from: swagger-document
where: $.parameters
transform: >
delete $.IfMatch["x-ms-parameter-grouping"];
delete $.IfModifiedSince["x-ms-parameter-grouping"];
delete $.IfNoneMatch["x-ms-parameter-grouping"];
delete $.IfUnmodifiedSince["x-ms-parameter-grouping"];
delete $.LeaseIdOptional["x-ms-parameter-grouping"];
delete $.IfTags["x-ms-parameter-grouping"];
delete $.BlobConditionMaxSize["x-ms-parameter-grouping"];
delete $.BlobConditionAppendPos["x-ms-parameter-grouping"];
delete $.SourceIfModifiedSince["x-ms-parameter-grouping"];
delete $.SourceIfUnmodifiedSince["x-ms-parameter-grouping"];
delete $.SourceIfMatch["x-ms-parameter-grouping"];
delete $.SourceIfNoneMatch["x-ms-parameter-grouping"];
delete $.SourceIfTags["x-ms-parameter-grouping"];
delete $.IfSequenceNumberLessThanOrEqualTo["x-ms-parameter-grouping"];
delete $.IfSequenceNumberLessThan["x-ms-parameter-grouping"];
delete $.IfSequenceNumberEqualTo["x-ms-parameter-grouping"];directive:
- from: swagger-document
where: $.parameters
transform: >
delete $.BlobCacheControl["x-ms-parameter-grouping"];
delete $.BlobContentType["x-ms-parameter-grouping"];
delete $.BlobContentMD5["x-ms-parameter-grouping"];
delete $.BlobContentEncoding["x-ms-parameter-grouping"];
delete $.BlobContentLanguage["x-ms-parameter-grouping"];
delete $.BlobContentDisposition["x-ms-parameter-grouping"];directive:
- from: swagger-document
where: $.parameters
transform: >
delete $.DefaultEncryptionScope["x-ms-parameter-grouping"];
delete $.DenyEncryptionScopeOverride["x-ms-parameter-grouping"];directive:
- from: swagger-document
where: $.parameters
transform: >
delete $.EncryptionKey["x-ms-parameter-grouping"];
delete $.EncryptionKeySha256["x-ms-parameter-grouping"];
delete $.EncryptionAlgorithm["x-ms-parameter-grouping"];
delete $.EncryptionScope["x-ms-parameter-grouping"];Remove Container_GetAccountInfo and Blob_GetAccountInfo. Unused and clashes with Service_GetAccountInfo after removal of path params.
directive:
- from: swagger-document
where: $["x-ms-paths"]
transform: >
for (const property in $)
{
if (property.includes('/{containerName}?restype=account&comp=properties'))
{
delete $[property];
}
if (property.includes('/{containerName}/{blob}?restype=account&comp=properties'))
{
delete $[property];
}
}directive:
- from: swagger-document
where: $["x-ms-paths"]["/{containerName}/{blob}"]
transform: >
$.get.responses["304"] = {
"description": "The condition specified using HTTP conditional header(s) is not met.",
"x-az-response-name": "ConditionNotMetError",
"headers": { "x-ms-error-code": { "x-ms-client-name": "ErrorCode", "type": "string" } }
};directive:
- from: swagger-document
where: $["x-ms-paths"]
transform: >
for (const property in $)
{
if (property.includes('/{containerName}/{blob}'))
{
var oldName = property;
var newName = property.replace('/{containerName}/{blob}', '');
$[newName] = $[oldName];
delete $[oldName];
}
else if (property.includes('/{containerName}'))
{
var oldName = property;
var newName = property.replace('/{containerName}', '');
$[newName] = $[oldName];
delete $[oldName];
}
}directive:
- from: swagger-document
where: $["x-ms-paths"]
transform: >
for (const property in $)
{
if (property.includes('filesystem'))
{
delete $[property];
}
}directive:
- from: swagger-document
where: $.definitions
transform: >
$.Metrics.type = "object";directive:
- from: swagger-document
where: $.definitions
transform: >
delete $.DataLakeStorageError;directive:
- from: swagger-document
where: $.parameters
transform: >
$.LeaseDuration.format = "int64";
$.LeaseBreakPeriod.format = "int64";directive:
- from: swagger-document
where: $.definitions
transform: >
delete $.BlobMetadata["properties"];directive:
- from: swagger-document
where: $.parameters
transform: >
delete $.SourceUrl.format;
delete $.PrevSnapshotUrl.format;
delete $.CopySource.format;directive:
- from: swagger-document
where: $.definitions
transform: >
delete $.GeoReplication.properties.Status["x-ms-enum"];
$.GeoReplication.properties.Status["x-ms-enum"] = {
"name": "BlobGeoReplicationStatus",
"modelAsString": false
};directive:
- from: swagger-document
where: $.definitions
transform: >
delete $.RehydratePriority["x-ms-enum"];
$.RehydratePriority["x-ms-enum"] = {
"name": "RehydratePriority",
"modelAsString": false
};directive:
- from: swagger-document
where: $.definitions
transform: >
delete $.ArchiveStatus["x-ms-enum"];
$.ArchiveStatus["x-ms-enum"] = {
"name": "ArchiveStatus",
"modelAsString": false
};directive:
- from: swagger-document
where: $.definitions
transform: >
delete $.KeyInfo.required;
$.KeyInfo.required = [
"Expiry"
];directive:
- from: swagger-document
where: $.parameters
transform: >
delete $.Delimiter.required;directive:
- from: swagger-document
where: $.parameters
transform: >
delete $.BlobDeleteType.enum;
$.BlobDeleteType.enum = [
"None",
"Permanent"
];directive:
- from: swagger-document
where: $.parameters
transform: >
delete $.EncryptionAlgorithm.enum;
$.EncryptionAlgorithm.enum = [
"None",
"AES256"
];directive:
- from: swagger-document
where: $..[?(@.operationId=='Blob_Query' || @.operationId=='Blob_Download')]
transform: $["x-csharp-buffer-response"] = false;directive:
- from: swagger-document
where: $.definitions
transform: >
$.BlobItemInternal.properties["OrMetadata"] = $.BlobItemInternal.properties["ObjectReplicationMetadata"];
delete $.BlobItemInternal.properties["ObjectReplicationMetadata"];