Skip to content

Commit 81b0bdb

Browse files
catalinaperaltavincenttran-msftcperaltahjeremymenggracewilcox
authored
[Storage] Blob specification typespec updates (#42344)
* Move to Private Date header for set/get_tags, set_properites, get_account_info (#36677) * [Storage] Make `metadata` a parameter for `set_metadata` API, StorageServiceProperties renamed to BlobServiceProperties `.tsp` (#36791) * [Storage] @Xml.name("ObjectReplicationMetadata") -> Xml.name("OrMetadata") (#36839) * [Storage] `upload_blob_from_url` TypeSpec Changes (#36847) * Attempt to generate sub-client * Revert "Attempt to generate sub-client" This reverts commit 373ce2b. * [Storage] `find_blobs_by_tags` for BlobServiceClient&BlobContainerClient TypeSpec Changes (#37182) * [Storage] `v0.5.0` Rust Blobs SDK Release Prep TypeSpec (#37428) * [Storage] Add `StorageErrorCode` enum to TypeSpec def (#37542) * [Storage] Flattened Storage Clients TypeSpec Definition (#37830) * [Storage] `get/set_access_policy` TypeSpec Changes (#38633) * Privatize the response headers date and legalhold status (#38817) * [Storage] `get/set_access_policy` TypeSpec Changes 2 (#38933) * [Storage] `delete/set_immutability_mode` for BlobClient TypeSpec Changes (#38750) * [Storage] `undelete` for BlobClient TypeSpec Changes (#39068) * [Storage] `content_length` -> `size` for PageBlobClient `create` API (#39097) * [Storage] Snapshot and Versioning Blob Support TypeSpec Changes (#39178) * [Storage] Use Common `Date` Header in Code Generation for Blobs SDK TypeSpec Changes (#39562) * nits * bring back commented out for other packages * [Storage] Housekeeping TypeSpec Changes (#40040) * Apply route fixes from main (fix paths #40011) * [Storage] Thinner handwritten convenience layer changes for `azure_storage_blob` (#40134) * regen the swagger (#40323) Co-authored-by: catalinaperalta <caperal@microsoft.com> * [Storage] Post Storage releases TypeSpec Changes (#40370) * Move client definition to client.tsp (#40409) * fix client def * clean up * suppressions --------- Co-authored-by: catalinaperalta <caperal@microsoft.com> * fix template (#40450) Co-authored-by: catalinaperalta <caperal@microsoft.com> * [Storage] Move to all `client.tsp` transforms post `v0.35` emitter TypeSpec Changes (#40558) * add content-type header (#40497) Co-authored-by: catalinaperalta <caperal@microsoft.com> * fix tags property definition (#40569) Co-authored-by: catalinaperalta <caperal@microsoft.com> * fix xml tag for blob tags property on BlobItem (#40600) Co-authored-by: catalinaperalta <caperal@microsoft.com> * correct xml name for ContainerProperties.eTag to match response payload (#40519) * fix SignedIdentifier and AccessPolicy properties (#40711) Co-authored-by: catalinaperalta <caperal@microsoft.com> * sync main error definition with rust branch (#40830) Co-authored-by: catalinaperalta <caperal@microsoft.com> * etag type update (#40726) Co-authored-by: catalinaperalta <caperal@microsoft.com> * point to optional variant since we want to have ocnsistency with typespec_client_core (#40707) * set_metadata 1 (#40868) * Blob fix container item "deleted" property name (#40991) * fix name * regen the swagger * keep old name for rust * remove name customization * nit --------- Co-authored-by: catalinaperalta <caperal@microsoft.com> * Misc fixes for blobs rust branch (#40520) * fix metadata headers * fix route * override setMetadata * only rust * add blob override for set metadata --------- Co-authored-by: catalinaperalta <caperal@microsoft.com> * add missing error codes (#41055) Co-authored-by: catalinaperalta <caperal@microsoft.com> * Fix parquet config (#41087) * fix xml name * regen the swagger --------- Co-authored-by: catalinaperalta <caperal@microsoft.com> * Rename submitBatch header property multipartContentType to contentType (#40812) * Rename submitBatch response header property multipartContentType to contentType * rename request header property too * Add statusCode of 202 for submitBatch response (#40873) * redo (#40935) * missed (#41077) * Fix container acl body to be optional (#41131) * update container acl * make content-type optional due to no body --------- Co-authored-by: catalinaperalta <caperal@microsoft.com> * [Storage] Move `client.tsp` to `routes.tsp` when possible (#41387) * Move 7 full client renames from client.tsp to just doing it in models, then tsp compile . * not sure where content_crc64 went since it was there previous iterations?, bring back override since routes is now service-aligned fully * literal renames, not clientName * fix overeager blockid versionid and filterexp * revert immutability_policy_expiry rename * one more * remove note from models, move to routes * Split BlobPublicAccess (#41542) * Split ExpiryTimeHeader (#41541) * STG102 Blobs TypeSpec (#40916) * Added STG102 TypeSpec version (#40544) * Added STG102 TypeSpec version * updated generated_blob version * Object-Level Blob Smart Tier (TypeSpec) (#40753) * Smart Tier TypeSpec * tsp compile * tsp format * Added the @added decorator * tsp format * Pinned Rust to STG101 API version * tsp compile --------- Co-authored-by: Sean McCullough <44180881+seanmcc-msft@users.noreply.github.com> * xml.Name CorsRule (#41819) * Misc fixes (#41676) * fix warnings * regen the swagger * suppress warning * regen the swagger * format --------- Co-authored-by: catalinaperalta <caperal@microsoft.com> * Generating more language for Blobs Storage with TypeSpec (#39880) * tspconfig python * [storage] enable typescript codegen * Add JavaScript client names for UserDelegationKey and GeoReplication * more client renames for JavaScript * Update name * Legacy.disablePageable for python * remove disablePageable supported cross land * initial go customization * [JS] rename Logging.delete to Logging.deleteProperty for compat * [JS] use alternative type of string for rfc3339-fixed-width properties * python client.tsp renames + acces type change * more python rename * fix paths * more path fixes * altype for blockId -- generating as serialized bytearray was prev string * add disablePaging for python * disable pageable for js * rename eTag => etag for JS * re-arrange submitBatch parameters to be consistent between Service and Container * clientOption for python * fix metadata headers * js multipart content type fix * metadata alternate result type for js and python * js: include-headers-in-response: true * add js to @@clientoption includeRootSlash false * rename some paging properties for JS * python renames * update client.tsp for one client * JS: use string type for UserDelegationKey signedStart and signedExpiry to maintain compat * JS: renames Metrics.includeApis => includeAPIs for compat LeaseDurationResponseHeader duration to leaseDuration access to blobPublicAccess * move js alternateType to client.tsp * clean up sharedRoute * etag clientname for python * delete->deleted * go specification * userdelegationkey changes python * blockName string in python oldgen * JS: rename MaxResultsParameter.maxresults to maxPageSize * JS: rename some "*Md5" to "*MD5" for compat * JS: rename rangeGetContentMd5 and auto-format done by VS Code * JS: enable errorCode from header * override setImmutabilityPolicy * enable csharp generation (#40485) * more go updates * Split BlobPublicAccess * Split ExpiryTimeHeader * JS: use string type for submitBatch request body * JS: Rename eTag => etag * JS: rename CreationTimeResponseHeader.creationTime to createdOn * JS: update emitter output directory for TypeScript to storage-blob * JS: enable-storage-compat * JS: add headerCollectionPrefix client option for x-ms-meta header * clean up client.tsp * JS: do not rename immutabilityPolicyExpiry * python -> config changes * leaving immutability as required for python to keep x-ms-version * csharp: more customizations (#41129) * python -> not supported includerootslash * update client.tsp due to merge with rust base branch * csharp customizations to reduce custom code (#41532) * add etag types for go * fix BlobPublicAccessResponseHeader name * remove go-generate * emit slash option for csharp (#41620) * remove alttrype accesspolicy python * scope client initialization decorators * clientOption for python emptyUrl * JS: hide allowPermanentDelete in RetentionPolicy * JS: bring back renames * xml.Name CorsRule * go signed identifiers * blobiteminterla python * go clientOption * merge caused expiryTime to be expiresOn * python -> etag * go fixes * clean up client.tsp * add relevant suppressions * spelling * BlobDeleteTypeGo * go lease renames * go customizations * go xml name for BlobPrefix * python -> config * clean up client.tsp * regen the swagger * split batch client for csharp (#42276) * add suppressions * format * update suppressions * add batch suppressions --------- Co-authored-by: Libba Lawrence <llawrence@microsoft.com> Co-authored-by: Jeremy Meng <jeremy.ymeng@gmail.com> Co-authored-by: gracewilcox <graceawilcox@gmail.com> Co-authored-by: catalinaperalta <caperal@microsoft.com> Co-authored-by: Jorge Rangel <102122018+jorgerangel-msft@users.noreply.github.com> * regen the swaggers * update range header and regen swagger (#42487) Co-authored-by: catalinaperalta <caperal@microsoft.com> * blobs: customize enums for c# (#42478) * blobs: customize enums for c# * consolidate * go stg101 * split RehydratePriiority header * csharp: fix RehydratePriorityParameter (#42611) * set go to stg101 * BlobPrefix xml * [Storage] `HttpRange` replacement, `Etag` model replacement (#42619) * range alt type * routes * regen 2 * try again * try again * crate:: instead of fully quali * stop going to String when it should be ETag' * range * compilation? * regen after reinstall repo deps --------- Co-authored-by: vincenttran-msft <101599632+vincenttran-msft@users.noreply.github.com> Co-authored-by: Vincent Tran <vincenttran@microsoft.com> Co-authored-by: catalinaperalta <caperal@microsoft.com> Co-authored-by: Jeremy Meng <jeremy.ymeng@gmail.com> Co-authored-by: Grace Wilcox <43627800+gracewilcox@users.noreply.github.com> Co-authored-by: Nick Liu <nicliu@microsoft.com> Co-authored-by: Sean McCullough <44180881+seanmcc-msft@users.noreply.github.com> Co-authored-by: Laurent Mazuel <laurent.mazuel@gmail.com> Co-authored-by: Libba Lawrence <llawrence@microsoft.com> Co-authored-by: gracewilcox <graceawilcox@gmail.com> Co-authored-by: Jorge Rangel <102122018+jorgerangel-msft@users.noreply.github.com>
1 parent 718732b commit 81b0bdb

16 files changed

Lines changed: 50626 additions & 31658 deletions

File tree

Lines changed: 188 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,188 @@
1+
import "@azure-tools/typespec-client-generator-core";
2+
import "../main.tsp";
3+
import "../client.tsp";
4+
5+
using Azure.ClientGenerator.Core;
6+
using Storage.Blob;
7+
using TypeSpec.Http;
8+
9+
namespace BatchCustomizations;
10+
11+
// Root client
12+
@client(
13+
{
14+
name: "BlobBatchClient",
15+
service: Storage.Blob,
16+
},
17+
"csharp"
18+
)
19+
namespace BlobBatchClient {
20+
#suppress "@azure-tools/typespec-azure-core/use-standard-operations" "Existing API"
21+
@operationGroup("csharp")
22+
interface BatchServiceClient {
23+
submitBatch is Storage.Blob.Service.submitBatch;
24+
}
25+
26+
#suppress "@azure-tools/typespec-azure-core/use-standard-operations" "Existing API"
27+
@operationGroup("csharp")
28+
interface BatchContainerClient {
29+
submitBatch is containerSubmitBatchCsharp;
30+
}
31+
32+
#suppress "@azure-tools/typespec-azure-core/use-standard-operations" "Existing API"
33+
@operationGroup("csharp")
34+
interface BatchBlobClient {
35+
delete is deleteCsharp;
36+
#suppress "@azure-tools/typespec-azure-core/use-standard-names" "Existing API"
37+
setAccessTier is setTierCsharp;
38+
}
39+
}
40+
41+
/** Initialization parameters for the BlobRestClient. */
42+
model BatchBlobClientOptions {
43+
/** The snapshot parameter is an opaque DateTime value that, when present, specifies the blob snapshot to retrieve. */
44+
snapshot?: SnapshotParameter.snapshot;
45+
}
46+
47+
@@clientInitialization(BlobBatchClient.BatchServiceClient,
48+
{
49+
initializedBy: InitializedBy.parent,
50+
},
51+
"csharp"
52+
);
53+
54+
@@clientInitialization(BlobBatchClient.BatchContainerClient,
55+
{
56+
initializedBy: InitializedBy.parent,
57+
},
58+
"csharp"
59+
);
60+
61+
@@clientInitialization(BlobBatchClient.BatchBlobClient,
62+
{
63+
parameters: BatchBlobClientOptions,
64+
initializedBy: InitializedBy.parent,
65+
},
66+
"csharp"
67+
);
68+
69+
/** The Batch operation allows multiple API calls to be embedded into a single HTTP request. */
70+
#suppress "@azure-tools/typespec-azure-core/use-standard-operations" "Existing API"
71+
#suppress "@azure-tools/typespec-azure-core/no-response-body" "Existing API"
72+
@post
73+
@route("/{containerName}?restype=container&comp=batch")
74+
@scope("csharp")
75+
op containerSubmitBatchCsharp(
76+
/** Required. The value of this header must be multipart/mixed with a batch boundary. Example header value: multipart/mixed; boundary=batch_<GUID> */
77+
@header("Content-Type")
78+
@alternateType(string, "csharp")
79+
contentType: "multipart/mixed",
80+
81+
...ApiVersionHeader,
82+
...TimeoutParameter,
83+
...ClientRequestIdHeader,
84+
...ContentLengthParameter,
85+
86+
/** The batch request content */
87+
...MultipartBodyParameter,
88+
89+
/** The container name */
90+
@path containerName: string,
91+
): ({
92+
@statusCode statusCode: 202;
93+
94+
/** The media type of the body of the response. For batch requests, this is multipart/mixed; boundary=batchresponse_GUID */
95+
#suppress "@typespec/http/content-type-ignored" "Template for existing API"
96+
@header("Content-Type")
97+
contentType: "multipart/mixed";
98+
99+
...RequestIdResponseHeader;
100+
...ApiVersionHeader;
101+
} & MultipartBodyParameter) | Error;
102+
103+
/** If the storage account's soft delete feature is disabled then, when a blob is deleted, it is permanently removed from the storage account. If the storage account's soft delete feature is enabled, then, when a blob is deleted, it is marked for deletion and becomes inaccessible immediately. However, the blob service retains the blob or snapshot for the number of days specified by the DeleteRetentionPolicy section of [Storage service properties] (Set-Blob-Service-Properties.md). After the specified number of days has passed, the blob's data is permanently removed from the storage account. Note that you continue to be charged for the soft-deleted blob's storage until it is permanently removed. Use the List Blobs API and specify the \"include=deleted\" query parameter to discover which blobs and snapshots have been soft deleted. You can then use the Undelete Blob API to restore a soft-deleted blob. All other operations on a soft-deleted blob or snapshot causes the service to return an HTTP status code of 404 (ResourceNotFound). */
104+
#suppress "@azure-tools/typespec-azure-core/use-standard-operations" "Existing API"
105+
#suppress "@azure-tools/typespec-azure-core/no-response-body" "Existing API"
106+
@delete
107+
@route("/{containerName}/{blob}")
108+
@scope("csharp")
109+
op deleteCsharp is StorageOperationNoBody<
110+
{
111+
...SnapshotParameter;
112+
...VersionIdParameter;
113+
...TimeoutParameter;
114+
...LeaseIdOptionalParameter;
115+
116+
/** Required if the blob has associated snapshots. Specify one of the following two options: include: Delete the base blob and all of its snapshots. only: Delete only the blob's snapshots and not the blob itself */
117+
@header("x-ms-delete-snapshots")
118+
deleteSnapshots?: DeleteSnapshotsOptionType;
119+
120+
...IfModifiedSinceParameter;
121+
...IfUnmodifiedSinceParameter;
122+
...IfNoneMatchParameter;
123+
...IfMatchParameter;
124+
...IfTagsParameter;
125+
126+
/** Optional. Only possible value is 'permanent', which specifies to permanently delete a blob if blob soft delete is enabled. */
127+
@query
128+
@clientName("blobDeleteType")
129+
deletetype?: BlobDeleteType;
130+
131+
...AccessTierIfModifiedSinceParameter;
132+
...AccessTierIfUnmodifiedSinceParameter;
133+
134+
/** The container name */
135+
@path containerName: string;
136+
137+
/** The blob name */
138+
@path blob: string;
139+
},
140+
{
141+
@statusCode statusCode: 202;
142+
}
143+
>;
144+
145+
/** The Set Tier operation sets the tier on a block blob. The operation is allowed on a page blob or block blob, but not on an append blob. A block blob's tier determines Hot/Cool/Archive storage type. This operation does not update the blob's ETag. */
146+
#suppress "@azure-tools/typespec-azure-core/use-standard-operations" "Existing API"
147+
#suppress "@azure-tools/typespec-azure-core/no-response-body" "Existing API"
148+
#suppress "@azure-tools/typespec-azure-core/use-standard-names" "Existing API"
149+
@put
150+
@sharedRoute
151+
@route("/{containerName}/{blob}?comp=tier")
152+
@scope("csharp")
153+
op setTierCsharp is StorageOperationNoBody<
154+
{
155+
...SnapshotParameter;
156+
...VersionIdParameter;
157+
...TimeoutParameter;
158+
159+
/** Indicates the tier to be set on the blob. */
160+
@header("x-ms-access-tier")
161+
tier: AccessTier;
162+
163+
...RehydratePriorityParameter;
164+
...LeaseIdOptionalParameter;
165+
...IfTagsParameter;
166+
167+
/** The container name */
168+
@path containerName: string;
169+
170+
/** The blob name */
171+
@path blob: string;
172+
},
173+
{
174+
#suppress "@azure-tools/typespec-azure-core/no-closed-literal-union" "Following standard pattern"
175+
@statusCode statusCode: 200 | 202;
176+
}
177+
>;
178+
179+
@@clientName(BlobBatchClient.BatchServiceClient, "ServiceRestClient", "csharp");
180+
@@clientName(BlobBatchClient.BatchContainerClient,
181+
"ContainerRestClient",
182+
"csharp"
183+
);
184+
@@clientName(BlobBatchClient.BatchBlobClient, "BlobRestClient", "csharp");
185+
@@clientName(AccessTier, "BatchAccessTier", "csharp");
186+
@@clientName(RehydratePriority, "BatchRehydratePriority", "csharp");
187+
188+
@@access(DeleteSnapshotsOptionType, Access.internal, "csharp");
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
- tool: TypeSpecValidation
2+
paths:
3+
- tspconfig.yaml
4+
rules:
5+
- SdkTspConfigValidation
6+
sub-rules:
7+
- options.@azure-tools/typespec-go.generate-fakes
8+
- options.@azure-tools/typespec-go.inject-spans
9+
- options.@azure-tools/typespec-go.service-dir
10+
- options.@azure-tools/typespec-go.package-dir
11+
- options.@azure-tools/typespec-java.emitter-output-dir
12+
- options.@azure-tools/typespec-ts.emitter-output-dir
13+
- options.@azure-tools/typespec-ts.package-details.name
14+
- options.@azure-tools/typespec-python.emitter-output-dir
15+
- options.@azure-tools/typespec-csharp.namespace
16+
- options.@azure-tools/typespec-csharp.clear-output-folder
17+
- options.@azure-tools/typespec-csharp.emitter-output-dir
18+
reason: >
19+
Suppress SDK configuration validation since this directory is only for c# batch sdk.
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
parameters:
2+
"service-dir":
3+
default: "sdk/storage"
4+
options:
5+
"@azure-typespec/http-client-csharp":
6+
emitter-output-dir: "{output-dir}/{service-dir}/{namespace}"
7+
namespace: "Azure.Storage.Blobs.Batch"
8+
model-namespace: true
9+
linter:
10+
extends:
11+
- "@azure-tools/typespec-azure-rulesets/data-plane"

0 commit comments

Comments
 (0)