Skip to content

Commit c3875db

Browse files
authored
Merge branch 'main' into vikeshi26/arm-lease-files
2 parents 5f2b960 + 81b0bdb commit c3875db

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)