/
StorageClient.ts
74 lines (67 loc) · 1.89 KB
/
StorageClient.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
import { StorageClientContext } from "./generated/src/storageClientContext";
import { Pipeline } from "./Pipeline";
import { getAccountNameFromUrl, getStorageClientContext } from "./utils/utils.common";
import { SpanOptions } from "@opentelemetry/types";
/**
* An interface for options common to every remote operation.
*/
export interface CommonOptions {
/**
* Options to configure spans created when tracing is enabled.
*/
tracingOptions?: OperationTracingOptions;
}
export interface OperationTracingOptions {
/**
* OpenTelemetry SpanOptions used to create a span when tracing is enabled.
*/
spanOptions?: SpanOptions;
}
/**
* A StorageClient represents a based client class for {@link QueueServiceClient}, {@link QueueClient} and etc.
*
* @export
* @class StorageClient
*/
export abstract class StorageClient {
/**
* URL string value.
*
* @type {string}
* @memberof StorageClient
*/
public readonly url: string;
public readonly accountName: string;
/**
* Request policy pipeline.
*
* @internal
* @ignore
* @type {Pipeline}
* @memberof StorageClient
*/
protected readonly pipeline: Pipeline;
/**
* StorageClientContext is a reference to protocol layer operations entry, which is
* generated by AutoRest generator.
*
* @protected
* @type {StorageClientContext}
* @memberof StorageClient
*/
protected readonly storageClientContext: StorageClientContext;
/**
* Creates an instance of StorageClient.
* @param {string} url
* @param {Pipeline} pipeline
* @memberof StorageClient
*/
protected constructor(url: string, pipeline: Pipeline) {
this.url = url;
this.accountName = getAccountNameFromUrl(url);
this.pipeline = pipeline;
this.storageClientContext = getStorageClientContext(url, pipeline);
}
}