Skip to content

Commit

Permalink
[Storage] Support blob tags (recording will be added later) (#9440)
Browse files Browse the repository at this point in the history
* [Storage] Support blob tags (recording will be added later)

* [Storage] Unify blob tags type Tags everywhere in options and responses

* [Storage] Blob tags - resolve comments
  • Loading branch information
XiaoningLiu authored Jun 12, 2020
1 parent e563ca4 commit fdff395
Show file tree
Hide file tree
Showing 19 changed files with 1,371 additions and 156 deletions.
1 change: 1 addition & 0 deletions sdk/storage/storage-blob/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
- Supported quick query. Added a new API `BlockBlobClient.query()`.
- Increased the maximum block size for Block Blob from 100MiB to 4000MiB(~4GB). And thereby supporting ~200TB maximum size for Block Blob.
- Added support for blob versioning.
- Supported blob tags.

## 12.1.2 (2020.05)

Expand Down
181 changes: 173 additions & 8 deletions sdk/storage/storage-blob/review/storage-blob.api.md
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,7 @@ export interface AppendBlobCreateOptions extends CommonOptions {
customerProvidedKey?: CpkInfo;
encryptionScope?: string;
metadata?: Metadata;
tags?: Tags;
}

// @public
Expand Down Expand Up @@ -373,10 +374,12 @@ export class BlobClient extends StorageClient {
getBlockBlobClient(): BlockBlobClient;
getPageBlobClient(): PageBlobClient;
getProperties(options?: BlobGetPropertiesOptions): Promise<BlobGetPropertiesResponse>;
getTags(options?: BlobGetTagsOptions): Promise<BlobGetTagsResponse>;
get name(): string;
setAccessTier(tier: BlockBlobTier | PremiumPageBlobTier | string, options?: BlobSetTierOptions): Promise<BlobSetTierResponse>;
setHTTPHeaders(blobHTTPHeaders?: BlobHTTPHeaders, options?: BlobSetHTTPHeadersOptions): Promise<BlobSetHTTPHeadersResponse>;
setMetadata(metadata?: Metadata, options?: BlobSetMetadataOptions): Promise<BlobSetMetadataResponse>;
setTags(tags: Tags, options?: BlobSetTagsOptions): Promise<BlobSetTagsResponse>;
syncCopyFromURL(copySource: string, options?: BlobSyncCopyFromURLOptions): Promise<BlobCopyFromURLResponse>;
undelete(options?: BlobUndeleteOptions): Promise<BlobUndeleteResponse>;
withSnapshot(snapshot: string): BlobClient;
Expand Down Expand Up @@ -642,6 +645,32 @@ export type BlobGetPropertiesResponse = BlobGetPropertiesHeaders & {
};
};

// @public
export interface BlobGetTagsHeaders {
clientRequestId?: string;
date?: Date;
// (undocumented)
errorCode?: string;
requestId?: string;
version?: string;
}

// @public
export interface BlobGetTagsOptions extends CommonOptions {
abortSignal?: AbortSignalLike;
}

// @public
export type BlobGetTagsResponse = {
tags: Tags;
} & BlobGetTagsHeaders & {
_response: HttpResponse & {
parsedHeaders: BlobGetTagsHeaders;
bodyAsText: string;
parsedBody: BlobTags;
};
};

// @public
export interface BlobHierarchyListSegment {
// (undocumented)
Expand All @@ -662,10 +691,6 @@ export interface BlobHTTPHeaders {

// @public
export interface BlobItem {
// Warning: (ae-forgotten-export) The symbol "BlobTags" needs to be exported by the entry point index.d.ts
//
// (undocumented)
blobTags?: BlobTags;
// (undocumented)
deleted: boolean;
// (undocumented)
Expand All @@ -685,6 +710,8 @@ export interface BlobItem {
// (undocumented)
snapshot: string;
// (undocumented)
tags?: Tags;
// (undocumented)
versionId?: string;
}

Expand Down Expand Up @@ -833,6 +860,7 @@ export class BlobSASPermissions {
deleteVersion: boolean;
static parse(permissions: string): BlobSASPermissions;
read: boolean;
tag: boolean;
toString(): string;
write: boolean;
}
Expand Down Expand Up @@ -866,6 +894,7 @@ export class BlobServiceClient extends StorageClient {
containerCreateResponse: ContainerCreateResponse;
}>;
deleteContainer(containerName: string, options?: ContainerDeleteMethodOptions): Promise<ContainerDeleteResponse>;
findBlobsByTags(tagFilterSqlExpression: string, options?: ServiceFindBlobByTagsOptions): PagedAsyncIterableIterator<FilterBlobItem, ServiceFindBlobsByTagsSegmentResponse>;
static fromConnectionString(connectionString: string, options?: StoragePipelineOptions): BlobServiceClient;
getAccountInfo(options?: ServiceGetAccountInfoOptions): Promise<ServiceGetAccountInfoResponse>;
getBlobBatchClient(): BlobBatchClient;
Expand Down Expand Up @@ -957,6 +986,28 @@ export type BlobSetMetadataResponse = BlobSetMetadataHeaders & {
};
};

// @public
export interface BlobSetTagsHeaders {
clientRequestId?: string;
date?: Date;
// (undocumented)
errorCode?: string;
requestId?: string;
version?: string;
}

// @public
export interface BlobSetTagsOptions extends CommonOptions {
abortSignal?: AbortSignalLike;
}

// @public
export type BlobSetTagsResponse = BlobSetTagsHeaders & {
_response: coreHttp.HttpResponse & {
parsedHeaders: BlobSetTagsHeaders;
};
};

// @public
export interface BlobSetTierHeaders {
clientRequestId?: string;
Expand Down Expand Up @@ -1002,6 +1053,7 @@ export interface BlobStartCopyFromURLOptions extends CommonOptions {
metadata?: Metadata;
rehydratePriority?: RehydratePriority;
sourceConditions?: ModifiedAccessConditions;
tags?: Tags;
tier?: BlockBlobTier | PremiumPageBlobTier | string;
}

Expand All @@ -1019,6 +1071,21 @@ export interface BlobSyncCopyFromURLOptions extends CommonOptions {
metadata?: Metadata;
sourceConditions?: ModifiedAccessConditions;
sourceContentMD5?: Uint8Array;
tags?: Tags;
}

// @public
export interface BlobTag {
// (undocumented)
key: string;
// (undocumented)
value: string;
}

// @public
export interface BlobTags {
// (undocumented)
blobTagSet: BlobTag[];
}

// @public
Expand Down Expand Up @@ -1101,6 +1168,7 @@ export interface BlockBlobCommitBlockListOptions extends CommonOptions {
customerProvidedKey?: CpkInfo;
encryptionScope?: string;
metadata?: Metadata;
tags?: Tags;
tier?: BlockBlobTier | string;
}

Expand Down Expand Up @@ -1153,6 +1221,7 @@ export interface BlockBlobParallelUploadOptions extends CommonOptions {
[propertyName: string]: string;
};
onProgress?: (progress: TransferProgressEvent) => void;
tags?: Tags;
}

// @public
Expand Down Expand Up @@ -1265,6 +1334,7 @@ export interface BlockBlobUploadOptions extends CommonOptions {
encryptionScope?: string;
metadata?: Metadata;
onProgress?: (progress: TransferProgressEvent) => void;
tags?: Tags;
tier?: BlockBlobTier | string;
}

Expand All @@ -1285,6 +1355,7 @@ export interface BlockBlobUploadStreamOptions extends CommonOptions {
[propertyName: string]: string;
};
onProgress?: (progress: TransferProgressEvent) => void;
tags?: Tags;
}

// @public
Expand Down Expand Up @@ -1522,10 +1593,10 @@ export interface ContainerListBlobFlatSegmentHeaders {

// @public
export type ContainerListBlobFlatSegmentResponse = ListBlobsFlatSegmentResponse & ContainerListBlobFlatSegmentHeaders & {
_response: coreHttp.HttpResponse & {
_response: HttpResponse & {
parsedHeaders: ContainerListBlobFlatSegmentHeaders;
bodyAsText: string;
parsedBody: ListBlobsFlatSegmentResponse;
parsedBody: ListBlobsFlatSegmentResponseModel;
};
};

Expand All @@ -1542,10 +1613,10 @@ export interface ContainerListBlobHierarchySegmentHeaders {

// @public
export type ContainerListBlobHierarchySegmentResponse = ListBlobsHierarchySegmentResponse & ContainerListBlobHierarchySegmentHeaders & {
_response: coreHttp.HttpResponse & {
_response: HttpResponse & {
parsedHeaders: ContainerListBlobHierarchySegmentHeaders;
bodyAsText: string;
parsedBody: ListBlobsHierarchySegmentResponse;
parsedBody: ListBlobsHierarchySegmentResponseModel;
};
};

Expand All @@ -1556,6 +1627,7 @@ export interface ContainerListBlobsOptions extends CommonOptions {
includeDeleted?: boolean;
includeMetadata?: boolean;
includeSnapshots?: boolean;
includeTags?: boolean;
includeUncommitedBlobs?: boolean;
includeVersions?: boolean;
prefix?: string;
Expand Down Expand Up @@ -1605,6 +1677,7 @@ export class ContainerSASPermissions {
list: boolean;
static parse(permissions: string): ContainerSASPermissions;
read: boolean;
tag: boolean;
toString(): string;
write: boolean;
}
Expand Down Expand Up @@ -1705,6 +1778,28 @@ export { deserializationPolicy }
// @public
export type EncryptionAlgorithmType = 'AES256';

// @public
export interface FilterBlobItem {
// (undocumented)
containerName: string;
// (undocumented)
name: string;
// (undocumented)
tagValue: string;
}

// @public
export interface FilterBlobSegment {
// (undocumented)
blobs: FilterBlobItem[];
// (undocumented)
continuationToken?: string;
// (undocumented)
serviceEndpoint: string;
// (undocumented)
where: string;
}

// @public
export function generateAccountSASQueryParameters(accountSASSignatureValues: AccountSASSignatureValues, sharedKeyCredential: StorageSharedKeyCredential): SASQueryParameters;

Expand Down Expand Up @@ -1788,6 +1883,26 @@ export interface ListBlobsFlatSegmentResponse {
serviceEndpoint: string;
}

// @public
export interface ListBlobsFlatSegmentResponseModel {
// (undocumented)
containerName: string;
// (undocumented)
continuationToken?: string;
// (undocumented)
marker?: string;
// (undocumented)
maxPageSize?: number;
// (undocumented)
prefix?: string;
// Warning: (ae-forgotten-export) The symbol "BlobFlatListSegment" needs to be exported by the entry point index.d.ts
//
// (undocumented)
segment: BlobFlatListSegment_2;
// (undocumented)
serviceEndpoint: string;
}

// @public
export interface ListBlobsHierarchySegmentResponse {
// (undocumented)
Expand All @@ -1808,6 +1923,28 @@ export interface ListBlobsHierarchySegmentResponse {
serviceEndpoint: string;
}

// @public
export interface ListBlobsHierarchySegmentResponseModel {
// (undocumented)
containerName: string;
// (undocumented)
continuationToken?: string;
// (undocumented)
delimiter?: string;
// (undocumented)
marker?: string;
// (undocumented)
maxPageSize?: number;
// (undocumented)
prefix?: string;
// Warning: (ae-forgotten-export) The symbol "BlobHierarchyListSegment" needs to be exported by the entry point index.d.ts
//
// (undocumented)
segment: BlobHierarchyListSegment_2;
// (undocumented)
serviceEndpoint: string;
}

// @public
export type ListBlobsIncludeItem = 'copy' | 'deleted' | 'metadata' | 'snapshots' | 'uncommittedblobs' | 'versions' | 'tags';

Expand Down Expand Up @@ -1964,6 +2101,7 @@ export interface PageBlobCreateOptions extends CommonOptions {
customerProvidedKey?: CpkInfo;
encryptionScope?: string;
metadata?: Metadata;
tags?: Tags;
tier?: PremiumPageBlobTier | string;
}

Expand Down Expand Up @@ -2280,6 +2418,30 @@ export interface SequenceNumberAccessConditions {
// @public
export type SequenceNumberActionType = 'max' | 'update' | 'increment';

// @public
export interface ServiceFilterBlobsHeaders {
clientRequestId?: string;
date?: Date;
// (undocumented)
errorCode?: string;
requestId?: string;
version?: string;
}

// @public
export interface ServiceFindBlobByTagsOptions extends CommonOptions {
abortSignal?: AbortSignalLike;
}

// @public
export type ServiceFindBlobsByTagsSegmentResponse = FilterBlobSegment & ServiceFilterBlobsHeaders & {
_response: coreHttp.HttpResponse & {
parsedHeaders: ServiceFilterBlobsHeaders;
bodyAsText: string;
parsedBody: FilterBlobSegment;
};
};

// @public
export interface ServiceGetAccountInfoHeaders {
accountKind?: AccountKind;
Expand Down Expand Up @@ -2543,6 +2705,9 @@ export class StorageSharedKeyCredentialPolicy extends CredentialPolicy {
// @public
export type SyncCopyStatusType = 'success';

// @public
export type Tags = Record<string, string>;

// @public
export interface UserDelegationKey {
signedExpiresOn: Date;
Expand Down
11 changes: 11 additions & 0 deletions sdk/storage/storage-blob/src/BlobDownloadResponse.ts
Original file line number Diff line number Diff line change
Expand Up @@ -322,6 +322,17 @@ export class BlobDownloadResponse implements BlobDownloadResponseModel {
return this.originalResponse.etag;
}

/**
* The number of tags associated with the blob
*
* @readonly
* @type {(number | undefined)}
* @memberof BlobDownloadResponse
*/
public get tagCount(): number | undefined {
return this.originalResponse.tagCount;
}

/**
* The error code.
*
Expand Down
Loading

0 comments on commit fdff395

Please sign in to comment.