@@ -28,36 +28,49 @@ type ClientOptions struct {
2828// Client represents a client to an Azure Storage append blob;
2929type Client base.CompositeClient [generated.BlobClient , generated.AppendBlobClient ]
3030
31- // NewClient creates an AppendBlobClient with the specified URL, Azure AD credential, and options.
32- func NewClient (blobURL string , cred azcore.TokenCredential , o * ClientOptions ) (* Client , error ) {
31+ // NewClient creates an instance of Client with the specified values.
32+ // - blobURL - the URL of the blob e.g. https://<account>.blob.core.windows.net/container/blob.txt
33+ // - cred - an Azure AD credential, typically obtained via the azidentity module
34+ // - options - client options; pass nil to accept the default values
35+ func NewClient (blobURL string , cred azcore.TokenCredential , options * ClientOptions ) (* Client , error ) {
3336 authPolicy := runtime .NewBearerTokenPolicy (cred , []string {shared .TokenScope }, nil )
34- conOptions := shared .GetClientOptions (o )
37+ conOptions := shared .GetClientOptions (options )
3538 conOptions .PerRetryPolicies = append (conOptions .PerRetryPolicies , authPolicy )
3639 pl := runtime .NewPipeline (exported .ModuleName , exported .ModuleVersion , runtime.PipelineOptions {}, & conOptions .ClientOptions )
3740
3841 return (* Client )(base .NewAppendBlobClient (blobURL , pl , nil )), nil
3942}
4043
41- // NewClientWithNoCredential creates an AppendBlobClient with the specified URL and options.
42- func NewClientWithNoCredential (blobURL string , o * ClientOptions ) (* Client , error ) {
43- conOptions := shared .GetClientOptions (o )
44+ // NewClientWithNoCredential creates an instance of Client with the specified values.
45+ // This is used to anonymously access a blob or with a shared access signature (SAS) token.
46+ // - blobURL - the URL of the blob e.g. https://<account>.blob.core.windows.net/container/blob.txt?<sas token>
47+ // - options - client options; pass nil to accept the default values
48+ func NewClientWithNoCredential (blobURL string , options * ClientOptions ) (* Client , error ) {
49+ conOptions := shared .GetClientOptions (options )
4450 pl := runtime .NewPipeline (exported .ModuleName , exported .ModuleVersion , runtime.PipelineOptions {}, & conOptions .ClientOptions )
4551
4652 return (* Client )(base .NewAppendBlobClient (blobURL , pl , nil )), nil
4753}
4854
49- // NewClientWithSharedKeyCredential creates an AppendBlobClient with the specified URL, shared key, and options.
50- func NewClientWithSharedKeyCredential (blobURL string , cred * blob.SharedKeyCredential , o * ClientOptions ) (* Client , error ) {
55+ // NewClientWithSharedKeyCredential creates an instance of Client with the specified values.
56+ // - blobURL - the URL of the blob e.g. https://<account>.blob.core.windows.net/container/blob.txt
57+ // - cred - a SharedKeyCredential created with the matching blob's storage account and access key
58+ // - options - client options; pass nil to accept the default values
59+ func NewClientWithSharedKeyCredential (blobURL string , cred * blob.SharedKeyCredential , options * ClientOptions ) (* Client , error ) {
5160 authPolicy := exported .NewSharedKeyCredPolicy (cred )
52- conOptions := shared .GetClientOptions (o )
61+ conOptions := shared .GetClientOptions (options )
5362 conOptions .PerRetryPolicies = append (conOptions .PerRetryPolicies , authPolicy )
5463 pl := runtime .NewPipeline (exported .ModuleName , exported .ModuleVersion , runtime.PipelineOptions {}, & conOptions .ClientOptions )
5564
5665 return (* Client )(base .NewAppendBlobClient (blobURL , pl , cred )), nil
5766}
5867
59- // NewClientFromConnectionString creates Client from a connection String
60- func NewClientFromConnectionString (connectionString , containerName , blobName string , o * ClientOptions ) (* Client , error ) {
68+ // NewClientFromConnectionString creates an instance of Client with the specified values.
69+ // - connectionString - a connection string for the desired storage account
70+ // - containerName - the name of the container within the storage account
71+ // - blobName - the name of the blob within the container
72+ // - options - client options; pass nil to accept the default values
73+ func NewClientFromConnectionString (connectionString , containerName , blobName string , options * ClientOptions ) (* Client , error ) {
6174 parsed , err := shared .ParseConnectionString (connectionString )
6275 if err != nil {
6376 return nil , err
@@ -69,10 +82,10 @@ func NewClientFromConnectionString(connectionString, containerName, blobName str
6982 if err != nil {
7083 return nil , err
7184 }
72- return NewClientWithSharedKeyCredential (parsed .ServiceURL , credential , o )
85+ return NewClientWithSharedKeyCredential (parsed .ServiceURL , credential , options )
7386 }
7487
75- return NewClientWithNoCredential (parsed .ServiceURL , o )
88+ return NewClientWithNoCredential (parsed .ServiceURL , options )
7689}
7790
7891// BlobClient returns the embedded blob client for this AppendBlob client.
0 commit comments