in internal/conn/http/http.go [159:205]
func New(endpoint string, cred azcore.TokenCredential, opts *policy.ClientOptions, options ...Option) (*Client, error) {
if opts == nil {
opts = &policy.ClientOptions{}
}
c := &Client{
endpoint: endpoint,
compress: true,
}
for _, option := range options {
if err := option(c); err != nil {
return nil, err
}
}
if c.fakeSender != nil {
return c, nil
}
var scope = scopeDefault
if changeScope[opts.Cloud.ActiveDirectoryAuthorityHost] {
scope = allOthers
}
plOpts := runtime.PipelineOptions{
PerRetry: []policy.Policy{
runtime.NewBearerTokenPolicy(cred, []string{scope}, nil),
},
}
if c.compress {
plOpts.PerRetry = append(plOpts.PerRetry, newFlateTransport())
}
azclient, err := azcore.NewClient("arn.Client", build.Version, plOpts, opts)
if err != nil {
return nil, err
}
if path.Dir(endpoint) != "arnnotify" {
endpoint = runtime.JoinPaths(endpoint, "/arnnotify")
}
return &Client{
endpoint: endpoint,
client: azclient,
}, nil
}