Project: Cortex (Observability and Analysis / Observability)
File: autorest.md

```yaml go: true clear-output-folder: false version: "^3.0.0" license-header: MICROSOFTMITNO_VERSION input-file: "https://raw.githubusercontent.com/Azure/azure-rest-api-specs/a32d0b2423d19835246bb2ef92941503bfd5e734/specification/storage/data-plane/Microsoft.BlobStorage/preview/2021-12-02/blob.json" credential-scope: "https://storage.azure.com/.default" output-folder: ../generated file-prefix: "zz_" openapi-type: "data-plane" verbose: true security: AzureKey modelerfour: group-parameters: false seal-single-value-enum-by-default: true lenient-model-deduplication: true export-clients: true use: "@autorest/go@4.0.0-preview.61" ``` ```yaml directive: from: zzappendblobclient.go zzblobclient.go zzblockblobclient.go zzcontainerclient.go zzpageblobclient.go zzserviceclient.go where: $ transform: >- return $. replaceAll(`[]string{"2021-12-02"}`, `[]string{ServiceVersion}`). replaceAll(`2021-12-02`, `2023-11-03`); ``` ``` yaml directive: from: zz_models.go where: $ transform: >- return $. replace(/Name\s+\BlobName/g, `Name string`); ``` ```yaml directive: from: swagger-document where: $.definitions transform: > $.BlobItemInternal["x-ms-go-omit-serde-methods"] = true; ``` ``` yaml directive: from: zzcontainerclient.go where: $ transform: >- return $. replace(/func \(client \*ContainerClient\) NewListBlobFlatSegmentPager\(.+\/\/ listBlobFlatSegmentCreateRequest creates the ListBlobFlatSegment request/s, `//\n// listBlobFlatSegmentCreateRequest creates the ListBlobFlatSegment request`). replace(/\(client \ContainerClient\) listBlobFlatSegmentCreateRequest\(/, `(client ContainerClient) ListBlobFlatSegmentCreateRequest(`). replace(/\(client \ContainerClient\) listBlobFlatSegmentHandleResponse\(/, `(client ContainerClient) ListBlobFlatSegmentHandleResponse(`); ``` ``` yaml directive: from: zzserviceclient.go where: $ transform: >- return $. replace(/func \(client \*ServiceClient\) NewListContainersSegmentPager\(.+\/\/ listContainersSegmentCreateRequest creates the ListContainersSegment request/s, `//\n// listContainersSegmentCreateRequest creates the ListContainersSegment request`). replace(/\(client \ServiceClient\) listContainersSegmentCreateRequest\(/, `(client ServiceClient) ListContainersSegmentCreateRequest(`). replace(/\(client \ServiceClient\) listContainersSegmentHandleResponse\(/, `(client ServiceClient) ListContainersSegmentHandleResponse(`); ``` ``` yaml directive: from: swagger-document where: $.definitions transform: > delete $.BlobMetadata["properties"]; ``` ``` yaml directive: from: swagger-document where: $["x-ms-paths"] transform: > for (const property in $) { if (property.includes('/{containerName}/{blob}')) { $ = $.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}')) { $ = $.filter(function(param) { return (typeof param['$ref'] === "undefined") || (false == param['$ref'].endsWith("#/parameters/ContainerName"))}); } } ``` ``` yaml directive: from: swagger-document where: $["x-ms-paths"] transform: > for (const property in $) { if (property.includes('filesystem')) { delete $[property]; } } ``` ``` yaml directive: from: swagger-document where: $.definitions transform: > delete $.DataLakeStorageError; ``` ``` yaml directive: from: swagger-document where: $ 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" } } }; ``` ``` yaml directive: from: swagger-document where: $.definitions transform: > delete $.GeoReplication.properties.Status["x-ms-enum"]; $.GeoReplication.properties.Status["x-ms-enum"] = { "name": "BlobGeoReplicationStatus", "modelAsString": false }; ``` ``` yaml directive: from: swagger-document where: $.definitions transform: > delete $.RehydratePriority["x-ms-enum"]; $.RehydratePriority["x-ms-enum"] = { "name": "RehydratePriority", "modelAsString": false }; ``` ``` yaml directive: from: swagger-document where: $.parameters transform: > delete $.BlobDeleteType.enum; $.BlobDeleteType.enum = [ "None", "Permanent" ]; ``` ``` yaml directive: from: swagger-document where: $.parameters transform: > delete $.EncryptionAlgorithm.enum; $.EncryptionAlgorithm.enum = [ "None", "AES256" ]; ``` ``` yaml directive: from: swagger-document where: $.definitions transform: > $.BlobItemInternal.properties["OrMetadata"] = $.BlobItemInternal.properties["ObjectReplicationMetadata"]; delete $.BlobItemInternal.properties["ObjectReplicationMetadata"]; ``` ``` yaml directive: from: zzcontainerclient.go where: $ transform: >- return $. replace(/listBlobHierarchySegmentCreateRequest/g, function(_, s) { return `ListBlobHierarchySegmentCreateRequest`

replace(/listBlobHierarchySegmentHandleResponse/g, function(_, s) { return `ListBlobHierarchySegmentHandleResponse` }); from: zzpageblobclient.go where: $ transform: >- return $. replace(/getPageRanges(Diff)?CreateRequest/g, function(_, s) { if (s === undefined) { s = '' }; return `GetPageRanges${s}CreateRequest` }). replace(/getPageRanges(Diff)?HandleResponse/g, function(_, s) { if (s === undefined) { s = '' }; return `GetPageRanges${s}HandleResponse` }); ``` ``` yaml directive: from: swagger-document where: $.parameters['BlobDeleteType'] transform: > $["x-ms-enum"].name = "DeleteType"; $["x-ms-client-name"] = "DeleteType"; from: swagger-document where: $.parameters['BlobExpiryOptions'] transform: > $["x-ms-enum"].name = "ExpiryOptions"; $["x-ms-client-name"].name = "ExpiryOptions"; from: swagger-document where: $..responses[].headers["x-ms-immutability-policy-mode"] transform: > $["x-ms-client-name"].name = "ImmutabilityPolicyMode"; $.enum = [ "Mutable", "Unlocked", "Locked"]; $["x-ms-enum"] = { "name": "ImmutabilityPolicyMode", "modelAsString": false }; from: swagger-document where: $.parameters['ImmutabilityPolicyMode'] transform: > $["x-ms-enum"].name = "ImmutabilityPolicySetting"; $["x-ms-client-name"].name = "ImmutabilityPolicySetting"; from: swagger-document where: $.definitions['BlobPropertiesInternal'] transform: > $.properties.ImmutabilityPolicyMode["x-ms-enum"].name = "ImmutabilityPolicyMode"; ``` ``` yaml directive: from: zz_models.go zz_options.go where: $ transform: >- return $. replace(/import "time"/, `import (\n\t"time"\n\t"github.com/Azure/azure-sdk-for-go/sdk/azcore"\n)`). replace(/Etag\s+\string/g, `ETag azcore.ETag`). replace(/IfMatch\s+\string/g, `IfMatch azcore.ETag`). replace(/IfNoneMatch\s+\string/g, `IfNoneMatch azcore.ETag`). replace(/SourceIfMatch\s+\string/g, `SourceIfMatch azcore.ETag`). replace(/SourceIfNoneMatch\s+\string/g, `SourceIfNoneMatch azcore.ETag`); from: zzresponsetypes.go where: $ transform: >- return $. replace(/"time"/, `"time"\n\t"github.com/Azure/azure-sdk-for-go/sdk/azcore"`). replace(/ETag\s+\string/g, `ETag azcore.ETag`); from: zzappendblobclient.go zzblobclient.go zzblockblobclient.go zzcontainerclient.go zzpageblobclient.go where: $ transform: >- return $. replace(/"github\.com\/Azure\/azure\-sdk\-for\-go\/sdk\/azcore\/policy"/, `"github.com/Azure/azure-sdk-for-go/sdk/azcore"\n\t"github.com/Azure/azure-sdk-for-go/sdk/azcore/policy"`). replace(/result\.ETag\s+=\s+&val/g, `result.ETag = (*azcore.ETag)(&val)`). replace(/\modifiedAccessConditions.IfMatch/g, `string(modifiedAccessConditions.IfMatch)`). replace(/\modifiedAccessConditions.IfNoneMatch/g, `string(modifiedAccessConditions.IfNoneMatch)`). replace(/\sourceModifiedAccessConditions.SourceIfMatch/g, `string(sourceModifiedAccessConditions.SourceIfMatch)`). replace(/\sourceModifiedAccessConditions.SourceIfNoneMatch/g, `string(sourceModifiedAccessConditions.SourceIfNoneMatch)`); ``` ``` yaml directive: from: zz_models.go where: $ transform: >- return $. replace(/SignedOid\s+\string/g, `SignedOID string`). replace(/SignedTid\s+\string/g, `SignedTID string`); ``` ``` yaml directive: from: zz_constants.go where: $ transform: >- return $. replace(/IncrementalCopyOfEralierVersionSnapshotNotAllowed/g, "IncrementalCopyOfEarlierVersionSnapshotNotAllowed"); ``` ``` yaml directive: from: swagger-document where: $.x-ms-paths...responses.*.headers.x-ms-content-crc64 transform: > $["x-ms-client-name"] = "ContentCRC64" ``` ``` yaml directive: rename-model: from: BlobItemInternal to: BlobItem rename-model: from: BlobPropertiesInternal to: BlobProperties ``` ``` yaml directive: from: zzserviceclient.go where: $ transform: >- return $. replace(/req.Raw\(\).URL.RawQuery \= reqQP.Encode\(\)/, `req.Raw().URL.RawQuery = strings.Replace(reqQP.Encode(), "+", "%20", -1)`) ``` ``` yaml directive: from: swagger-document where: $.parameters.FilterBlobsWhere transform: > $.required = true; ``` ``` yaml directive: from: swagger-document where: $.parameters.LeaseDuration transform: > $.required = true; ``` ``` yaml directive: from: source-file-go where: $ transform: >- return $. replace(/Cpk/g, "CPK"); ``` ``` yaml directive: from: source-file-go where: $ transform: >- return $. replace(/Cors/g, "CORS"); ``` ``` yaml directive: from: source-file-go where: $ transform: >- return $. replace(/xml:"CORS>CORSRule"/g, "xml:\"Cors>CorsRule\""); ``` ``` yaml directive: from: zzcontainerclient.go zzserviceclient.go where: $ transform: >- return $. replace (/req.SetBody\(body\,\s+\"application\/xml\"\)/g, `req.SetBody(body, multipartContentType)`); ``` ``` yaml directive: from: zzserviceclient.go where: $ transform: >- return $. replace(/if\s+!runtime\.HasStatusCode\(httpResp,\s+http\.StatusOK\)\s+\{\s+err\s+=\s+runtime\.NewResponseError\(httpResp\)\s+return ServiceClientSubmitBatchResponse\{\}\,\s+err\s+}/g, `if !runtime.HasStatusCode(httpResp, http.StatusAccepted) {\n\t\terr = runtime.NewResponseError(httpResp)\n\t\treturn ServiceClientSubmitBatchResponse{}, err\n\t}`); ``` ``` yaml directive: from: zzcontainerclient.go zzblobclient.go zzappendblobclient.go zzblockblobclient.go zzpageblobclient.go where: $ transform: >- return $. replace (/req\.Raw\(\)\.Header\[\"If-Modified-Since\"\]\s+=\s+\[\]string\{modifiedAccessConditions\.IfModifiedSince\.Format\(time\.RFC1123\)\}/g, `req.Raw().Header["If-Modified-Since"] = []string{(*modifiedAccessConditions.IfModifiedSince).In(gmt).Format(time.RFC1123)}`). replace (/req\.Raw\(\)\.Header\[\"If-Unmodified-Since\"\]\s+=\s+\[\]string\{modifiedAccessConditions\.IfUnmodifiedSince\.Format\(time\.RFC1123\)\}/g, `req.Raw().Header["If-Unmodified-Since"] = []string{(*modifiedAccessConditions.IfUnmodifiedSince).In(gmt).Format(time.RFC1123)}`). replace (/req\.Raw\(\)\.Header\[\"x-ms-source-if-modified-since\"\]\s+=\s+\[\]string\{sourceModifiedAccessConditions\.SourceIfModifiedSince\.Format\(time\.RFC1123\)\}/g, `req.Raw().Header["x-ms-source-if-modified-since"] = []string{(*sourceModifiedAccessConditions.SourceIfModifiedSince).In(gmt).Format(time.RFC1123)}`). replace (/req\.Raw\(\)\.Header\[\"x-ms-source-if-unmodified-since\"\]\s+=\s+\[\]string\{sourceModifiedAccessConditions\.SourceIfUnmodifiedSince\.Format\(time\.RFC1123\)\}/g, `req.Raw().Header["x-ms-source-if-unmodified-since"] = []string{(*sourceModifiedAccessConditions.SourceIfUnmodifiedSince).In(gmt).Format(time.RFC1123)}`). replace (/req\.Raw\(\)\.Header\[\"x-ms-immutability-policy-until-date\"\]\s+=\s+\[\]string\{options\.ImmutabilityPolicyExpiry\.Format\(time\.RFC1123\)\}/g, `req.Raw().Header["x-ms-immutability-policy-until-date"] = []string{(*options.ImmutabilityPolicyExpiry).In(gmt).Format(time.RFC1123)}`);