Skip to content

Commit fc6f1de

Browse files
authored
Update file share API according to review comments (Azure#33331)
### Packages impacted by this PR ### Issues associated with this PR ### Describe the problem that is addressed by this PR ### What are the possible designs available to address the problem? If there are more than one possible design, why was the one in this PR chosen? ### Are there test cases added in this PR? _(If not, why?)_ ### Provide a list of related PRs _(if any)_ ### Command used to generate this PR:**_(Applicable only to SDK release request PRs)_ ### Checklists - [ ] Added impacted package name to the issue description - [ ] Does this PR needs any fixes in the SDK Generator?** _(If so, create an Issue in the [Autorest/typescript](https://github.com/Azure/autorest.typescript) repository and link it here)_ - [ ] Added a changelog (if necessary)
1 parent 6374320 commit fc6f1de

File tree

7 files changed

+202
-233
lines changed

7 files changed

+202
-233
lines changed

sdk/storage/storage-file-share/review/storage-file-share.api.md

Lines changed: 9 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -196,14 +196,11 @@ export interface DirectoryCreateHeaders {
196196
fileCreatedOn?: Date;
197197
fileId?: string;
198198
fileLastWriteOn?: Date;
199-
fileMode?: NfsFileMode;
200199
fileParentId?: string;
201200
filePermissionKey?: string;
202-
group?: string;
203201
isServerEncrypted?: boolean;
204202
lastModified?: Date;
205-
nfsFileType?: NfsFileType;
206-
owner?: string;
203+
posixProperties?: FilePosixProperties;
207204
requestId?: string;
208205
version?: string;
209206
}
@@ -283,17 +280,14 @@ export interface DirectoryGetPropertiesHeaders {
283280
fileCreatedOn?: Date;
284281
fileId?: string;
285282
fileLastWriteOn?: Date;
286-
fileMode?: NfsFileMode;
287283
fileParentId?: string;
288284
filePermissionKey?: string;
289-
group?: string;
290285
isServerEncrypted?: boolean;
291286
lastModified?: Date;
292287
metadata?: {
293288
[propertyName: string]: string;
294289
};
295-
nfsFileType?: NfsFileType;
296-
owner?: string;
290+
posixProperties?: FilePosixProperties;
297291
requestId?: string;
298292
version?: string;
299293
}
@@ -439,13 +433,11 @@ export interface DirectorySetPropertiesHeaders {
439433
fileCreatedOn?: Date;
440434
fileId?: string;
441435
fileLastWriteOn?: Date;
442-
fileMode?: NfsFileMode;
443436
fileParentId?: string;
444437
filePermissionKey?: string;
445-
group?: string;
446438
isServerEncrypted?: boolean;
447439
lastModified?: Date;
448-
owner?: string;
440+
posixProperties?: FilePosixProperties;
449441
requestId?: string;
450442
version?: string;
451443
}
@@ -521,13 +513,9 @@ export interface FileCreateHardLinkHeaders {
521513
fileCreationTime?: Date;
522514
fileId?: string;
523515
fileLastWriteTime?: Date;
524-
fileMode?: NfsFileMode;
525516
fileParentId?: string;
526-
group?: string;
527517
lastModified?: Date;
528-
linkCount?: number;
529-
nfsFileType?: NfsFileType;
530-
owner?: string;
518+
posixProperties?: FilePosixProperties;
531519
requestId?: string;
532520
version?: string;
533521
}
@@ -551,14 +539,11 @@ export interface FileCreateHeaders {
551539
fileCreatedOn?: Date;
552540
fileId?: string;
553541
fileLastWriteOn?: Date;
554-
fileMode?: NfsFileMode;
555542
fileParentId?: string;
556543
filePermissionKey?: string;
557-
group?: string;
558544
isServerEncrypted?: boolean;
559545
lastModified?: Date;
560-
nfsFileType?: NfsFileType;
561-
owner?: string;
546+
posixProperties?: FilePosixProperties;
562547
requestId?: string;
563548
version?: string;
564549
}
@@ -623,20 +608,17 @@ export interface FileDownloadHeaders {
623608
fileCreatedOn?: Date;
624609
fileId?: string;
625610
fileLastWriteOn?: Date;
626-
fileMode?: NfsFileMode;
627611
fileParentId?: string;
628612
filePermissionKey?: string;
629-
group?: string;
630613
isServerEncrypted?: boolean;
631614
lastModified?: Date;
632615
leaseDuration?: LeaseDurationType;
633616
leaseState?: LeaseStateType;
634617
leaseStatus?: LeaseStatusType;
635-
linkCount?: number;
636618
metadata?: {
637619
[propertyName: string]: string;
638620
};
639-
owner?: string;
621+
posixProperties?: FilePosixProperties;
640622
requestId?: string;
641623
version?: string;
642624
}
@@ -725,22 +707,18 @@ export interface FileGetPropertiesHeaders {
725707
fileCreatedOn?: Date;
726708
fileId?: string;
727709
fileLastWriteOn?: Date;
728-
fileMode?: NfsFileMode;
729710
fileParentId?: string;
730711
filePermissionKey?: string;
731712
fileType?: string;
732-
group?: string;
733713
isServerEncrypted?: boolean;
734714
lastModified?: Date;
735715
leaseDuration?: LeaseDurationType;
736716
leaseState?: LeaseStateType;
737717
leaseStatus?: LeaseStatusType;
738-
linkCount?: number;
739718
metadata?: {
740719
[propertyName: string]: string;
741720
};
742-
nfsFileType?: NfsFileType;
743-
owner?: string;
721+
posixProperties?: FilePosixProperties;
744722
requestId?: string;
745723
version?: string;
746724
}
@@ -855,6 +833,7 @@ export interface FilePosixProperties {
855833
fileMode?: NfsFileMode;
856834
fileType?: NfsFileType;
857835
group?: string;
836+
linkCount?: number;
858837
owner?: string;
859838
}
860839

@@ -978,14 +957,11 @@ export interface FileSetHTTPHeadersHeaders {
978957
fileCreatedOn?: Date;
979958
fileId?: string;
980959
fileLastWriteOn?: Date;
981-
fileMode?: NfsFileMode;
982960
fileParentId?: string;
983961
filePermissionKey?: string;
984-
group?: string;
985962
isServerEncrypted?: boolean;
986963
lastModified?: Date;
987-
linkCount?: number;
988-
owner?: string;
964+
posixProperties?: FilePosixProperties;
989965
requestId?: string;
990966
version?: string;
991967
}

sdk/storage/storage-file-share/src/Clients.ts

Lines changed: 61 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1826,7 +1826,12 @@ export class ShareDirectoryClient extends StorageClient {
18261826
const wrappedRes = {
18271827
...rawResponse,
18281828
_response: (rawResponse as any)._response, // _response is made non-enumerable,
1829-
fileMode: parseOctalFileMode(rawResponse.fileMode),
1829+
posixProperties: {
1830+
fileMode: parseOctalFileMode(rawResponse.fileMode),
1831+
fileType: rawResponse.nfsFileType,
1832+
owner: rawResponse.owner,
1833+
group: rawResponse.group,
1834+
},
18301835
};
18311836
return assertResponse<DirectoryCreateHeaders, DirectoryCreateHeaders>(wrappedRes);
18321837
},
@@ -1898,7 +1903,11 @@ export class ShareDirectoryClient extends StorageClient {
18981903
return assertResponse<DirectorySetPropertiesHeaders, DirectorySetPropertiesHeaders>({
18991904
...rawResponse,
19001905
_response: (rawResponse as any)._response,
1901-
fileMode: parseOctalFileMode(rawResponse.fileMode),
1906+
posixProperties: {
1907+
fileMode: parseOctalFileMode(rawResponse.fileMode),
1908+
owner: rawResponse.owner,
1909+
group: rawResponse.group,
1910+
},
19021911
} as any);
19031912
},
19041913
);
@@ -2118,7 +2127,12 @@ export class ShareDirectoryClient extends StorageClient {
21182127
return assertResponse<DirectoryGetPropertiesHeaders, DirectoryGetPropertiesHeaders>({
21192128
...rawResponse,
21202129
_response: (rawResponse as any)._response,
2121-
fileMode: parseOctalFileMode(rawResponse.fileMode),
2130+
posixProperties: {
2131+
fileMode: parseOctalFileMode(rawResponse.fileMode),
2132+
owner: rawResponse.owner,
2133+
group: rawResponse.group,
2134+
fileType: rawResponse.nfsFileType,
2135+
},
21222136
} as any);
21232137
},
21242138
);
@@ -3806,7 +3820,12 @@ export class ShareFileClient extends StorageClient {
38063820
const wrappedRes = {
38073821
...rawResponse,
38083822
_response: (rawResponse as any)._response, // _response is made non-enumerable,
3809-
fileMode: parseOctalFileMode(rawResponse.fileMode),
3823+
posixProperties: {
3824+
fileMode: parseOctalFileMode(rawResponse.fileMode),
3825+
fileType: rawResponse.nfsFileType,
3826+
owner: rawResponse.owner,
3827+
group: rawResponse.group,
3828+
},
38103829
};
38113830
return assertResponse<FileCreateHeaders, FileCreateHeaders>(wrappedRes);
38123831
});
@@ -3896,7 +3915,12 @@ export class ShareFileClient extends StorageClient {
38963915
const res = assertResponse<RawFileDownloadResponse, FileDownloadHeaders>({
38973916
...rawResponse,
38983917
_response: (rawResponse as any)._response, // _response is made non-enumerable,
3899-
fileMode: parseOctalFileMode(rawResponse.fileMode),
3918+
posixProperties: {
3919+
fileMode: parseOctalFileMode(rawResponse.fileMode),
3920+
owner: rawResponse.owner,
3921+
group: rawResponse.group,
3922+
linkCount: rawResponse.linkCount,
3923+
},
39003924
} as any);
39013925

39023926
// Return browser response immediately
@@ -4001,7 +4025,13 @@ export class ShareFileClient extends StorageClient {
40014025
return assertResponse<FileGetPropertiesHeaders, FileGetPropertiesHeaders>({
40024026
...rawResponse,
40034027
_response: (rawResponse as any)._response, // _response is made non-enumerable,
4004-
fileMode: parseOctalFileMode(rawResponse.fileMode),
4028+
posixProperties: {
4029+
fileMode: parseOctalFileMode(rawResponse.fileMode),
4030+
fileType: rawResponse.nfsFileType,
4031+
owner: rawResponse.owner,
4032+
group: rawResponse.group,
4033+
linkCount: rawResponse.linkCount,
4034+
},
40054035
} as any);
40064036
},
40074037
);
@@ -4040,7 +4070,12 @@ export class ShareFileClient extends StorageClient {
40404070
return assertResponse<FileSetHTTPHeadersHeaders, FileSetHTTPHeadersHeaders>({
40414071
...rawResponse,
40424072
_response: (rawResponse as any)._response, // _response is made non-enumerable,
4043-
fileMode: parseOctalFileMode(rawResponse.fileMode),
4073+
posixProperties: {
4074+
fileMode: parseOctalFileMode(rawResponse.fileMode),
4075+
owner: rawResponse.owner,
4076+
group: rawResponse.group,
4077+
linkCount: rawResponse.linkCount,
4078+
},
40444079
} as any);
40454080
},
40464081
);
@@ -4156,7 +4191,12 @@ export class ShareFileClient extends StorageClient {
41564191
return assertResponse<FileSetHTTPHeadersHeaders, FileSetHTTPHeadersHeaders>({
41574192
...rawResponse,
41584193
_response: (rawResponse as any)._response, // _response is made non-enumerable,
4159-
fileMode: parseOctalFileMode(rawResponse.fileMode),
4194+
posixProperties: {
4195+
fileMode: parseOctalFileMode(rawResponse.fileMode),
4196+
owner: rawResponse.owner,
4197+
group: rawResponse.group,
4198+
linkCount: rawResponse.linkCount,
4199+
},
41604200
} as any);
41614201
},
41624202
);
@@ -4198,7 +4238,12 @@ export class ShareFileClient extends StorageClient {
41984238
return assertResponse<FileSetHTTPHeadersHeaders, FileSetHTTPHeadersHeaders>({
41994239
...rawResponse,
42004240
_response: (rawResponse as any)._response,
4201-
fileMode: parseOctalFileMode(rawResponse.fileMode),
4241+
posixProperties: {
4242+
fileMode: parseOctalFileMode(rawResponse.fileMode),
4243+
owner: rawResponse.owner,
4244+
group: rawResponse.group,
4245+
linkCount: rawResponse.linkCount,
4246+
},
42024247
} as any);
42034248
});
42044249
}
@@ -5243,7 +5288,13 @@ export class ShareFileClient extends StorageClient {
52435288
return assertResponse<FileCreateHardLinkHeaders, FileCreateHardLinkHeaders>({
52445289
...rawResponse,
52455290
_response: (rawResponse as any)._response, // _response is made non-enumerable,
5246-
fileMode: parseOctalFileMode(rawResponse.fileMode),
5291+
posixProperties: {
5292+
fileMode: parseOctalFileMode(rawResponse.fileMode),
5293+
fileType: rawResponse.nfsFileType,
5294+
owner: rawResponse.owner,
5295+
group: rawResponse.group,
5296+
linkCount: rawResponse.linkCount,
5297+
},
52475298
} as any);
52485299
},
52495300
);

sdk/storage/storage-file-share/src/FileDownloadResponse.ts

Lines changed: 4 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import type {
1010
LeaseStateType,
1111
LeaseStatusType,
1212
} from "./generatedModels";
13-
import type { Metadata, NfsFileMode } from "./models";
13+
import type { FilePosixProperties, Metadata } from "./models";
1414
import type {
1515
ReadableStreamGetter,
1616
RetriableReadableStreamOptions,
@@ -382,31 +382,10 @@ export class FileDownloadResponse implements FileDownloadResponseModel {
382382
}
383383

384384
/**
385-
* NFS only. The mode of the file or directory.
385+
* Properties of NFS files
386386
*/
387-
public get fileMode(): NfsFileMode | undefined {
388-
return this.originalResponse.fileMode;
389-
}
390-
391-
/**
392-
* TNFS only. The owner of the file or directory.
393-
*/
394-
public get owner(): string | undefined {
395-
return this.originalResponse.owner;
396-
}
397-
398-
/**
399-
* NFS only. The owning group of the file or directory.
400-
*/
401-
public get group(): string | undefined {
402-
return this.originalResponse.group;
403-
}
404-
405-
/**
406-
* NFS only. The link count of the file or directory.
407-
*/
408-
public get linkCount(): number | undefined {
409-
return this.originalResponse.linkCount;
387+
public get posixProperties(): FilePosixProperties | undefined {
388+
return this.originalResponse.posixProperties;
410389
}
411390

412391
/**

0 commit comments

Comments
 (0)