• Home
  • History
  • Annotate
Name Date Size #Lines LOC

..03-May-2022-

.github/H04-Feb-2021-10176

documentation/H04-Feb-2021-9757

eng/H04-Feb-2021-9,2567,383

profiles/H04-Feb-2021-263,372216,405

sdk/H04-Feb-2021-158,663111,060

services/H04-Feb-2021-8,318,2796,023,224

storage/H04-Feb-2021-43,56639,427

tools/H04-Feb-2021-12,3248,806

version/H04-Feb-2021-222

.gitattributesH A D04-Feb-202185 32

.gitignoreH A D04-Feb-2021441 4132

CHANGELOG.mdH A D04-Feb-2021296.8 KiB3,5582,999

CODEOWNERSH A D04-Feb-2021138 65

CONTRIBUTING.mdH A D04-Feb-20211.3 KiB2215

Gopkg.lockH A D04-Feb-20218 KiB292264

Gopkg.tomlH A D04-Feb-20211.1 KiB5747

LICENSEH A D04-Feb-202111.1 KiB203169

NOTICEH A D04-Feb-2021157 64

README.mdH A D04-Feb-202124.6 KiB588436

SECURITY.mdH A D04-Feb-20212.7 KiB4222

azure-pipelines.ymlH A D04-Feb-20213.2 KiB9387

doc.goH A D04-Feb-2021965 271

findTestedPackages.shH A D04-Feb-202158 11

generate_options.jsonH A D04-Feb-2021193 1111

initScript.shH A D04-Feb-2021312 1818

rungas.shH A D04-Feb-2021588 1513

swagger_to_sdk_config.jsonH A D04-Feb-2021708 2827

README.md

1# Azure SDK for Go
2
3[![godoc](https://godoc.org/github.com/Azure/azure-sdk-for-go?status.svg)](https://godoc.org/github.com/Azure/azure-sdk-for-go)
4[![Build Status](https://dev.azure.com/azure-sdk/public/_apis/build/status/go/Azure.azure-sdk-for-go?branchName=master)](https://dev.azure.com/azure-sdk/public/_build/latest?definitionId=640&branchName=master)
5
6azure-sdk-for-go provides Go packages for managing and using Azure services.
7It officially supports the last two major releases of Go.  Older versions of
8Go will be kept running in CI until they no longer work due to changes in any
9of the SDK's external dependencies.  The CHANGELOG will be updated when a
10version of Go is removed from CI.
11
12To be notified about updates and changes, subscribe to the [Azure update
13feed](https://azure.microsoft.com/updates/).
14
15Users may prefer to jump right in to our samples repo at
16[github.com/Azure-Samples/azure-sdk-for-go-samples][samples_repo].
17
18Questions and feedback? Chat with us in the **[#Azure SDK
19channel](https://gophers.slack.com/messages/CA7HK8EEP)** on the [Gophers
20Slack](https://gophers.slack.com/). Sign up
21[here](https://invite.slack.golangbridge.org) first if necessary.
22
23
24## Package Updates
25
26Most packages in the SDK are generated from [Azure API specs][azure_rest_specs]
27using [Azure/autorest.go][] and [Azure/autorest][]. These generated packages
28depend on the HTTP client implemented at [Azure/go-autorest][].
29
30[azure_rest_specs]: https://github.com/Azure/azure-rest-api-specs
31[azure/autorest]: https://github.com/Azure/autorest
32[azure/autorest.go]: https://github.com/Azure/autorest.go
33[azure/go-autorest]: https://github.com/Azure/go-autorest
34
35The SDK codebase adheres to [semantic versioning](https://semver.org) and thus
36avoids breaking changes other than at major (x.0.0) releases. Because Azure's
37APIs are updated frequently, we release a **new major version at the end of
38each month** with a full changelog. For more details and background see [SDK Update
39Practices](https://github.com/Azure/azure-sdk-for-go/wiki/SDK-Update-Practices).
40
41To more reliably manage dependencies like the Azure SDK in your applications we
42recommend [golang/dep](https://github.com/golang/dep).
43
44Packages that are still in public preview can be found under the ./services/preview
45directory. Please be aware that since these packages are in preview they are subject
46to change, including breaking changes outside of a major semver bump.
47
48## Other Azure Go Packages
49
50Azure provides several other packages for using services from Go, listed below.
51If a package you need isn't available please open an issue and let us know.
52
53| Service              | Import Path/Repo                                                                                   |
54| -------------------- | -------------------------------------------------------------------------------------------------- |
55| Storage - Blobs      | [github.com/Azure/azure-storage-blob-go](https://github.com/Azure/azure-storage-blob-go)           |
56| Storage - Files      | [github.com/Azure/azure-storage-file-go](https://github.com/Azure/azure-storage-file-go)           |
57| Storage - Queues     | [github.com/Azure/azure-storage-queue-go](https://github.com/Azure/azure-storage-queue-go)         |
58| Service Bus          | [github.com/Azure/azure-service-bus-go](https://github.com/Azure/azure-service-bus-go)             |
59| Event Hubs           | [github.com/Azure/azure-event-hubs-go](https://github.com/Azure/azure-event-hubs-go)               |
60| Application Insights | [github.com/Microsoft/ApplicationInsights-go](https://github.com/Microsoft/ApplicationInsights-go) |
61
62# Install and Use:
63
64## Install
65
66```sh
67$ go get -u github.com/Azure/azure-sdk-for-go/...
68```
69
70and you should also make sure to include the minimum version of [`go-autorest`](https://github.com/Azure/go-autorest) that is specified in `Gopkg.toml` file.
71
72Or if you use dep, within your repo run:
73
74```sh
75$ dep ensure -add github.com/Azure/azure-sdk-for-go
76```
77
78If you need to install Go, follow [the official instructions](https://golang.org/dl/).
79
80## Use
81
82For many more scenarios and examples see
83[Azure-Samples/azure-sdk-for-go-samples][samples_repo].
84
85Apply the following general steps to use packages in this repo. For more on
86authentication and the `Authorizer` interface see [the next
87section](#authentication).
88
891. Import a package from the [services][services_dir] directory.
902. Create and authenticate a client with a `New*Client` func, e.g.
91   `c := compute.NewVirtualMachinesClient(...)`.
923. Invoke API methods using the client, e.g.
93   `res, err := c.CreateOrUpdate(...)`.
944. Handle responses and errors.
95
96[services_dir]: https://github.com/Azure/azure-sdk-for-go/tree/master/services
97
98For example, to create a new virtual network (substitute your own values for
99strings in angle brackets):
100
101```go
102package main
103
104import (
105	"context"
106
107	"github.com/Azure/azure-sdk-for-go/services/network/mgmt/2017-09-01/network"
108
109	"github.com/Azure/go-autorest/autorest/azure/auth"
110	"github.com/Azure/go-autorest/autorest/to"
111)
112
113func main() {
114	// create a VirtualNetworks client
115	vnetClient := network.NewVirtualNetworksClient("<subscriptionID>")
116
117	// create an authorizer from env vars or Azure Managed Service Idenity
118	authorizer, err := auth.NewAuthorizerFromEnvironment()
119	if err == nil {
120		vnetClient.Authorizer = authorizer
121	}
122
123	// call the VirtualNetworks CreateOrUpdate API
124	vnetClient.CreateOrUpdate(context.Background(),
125		"<resourceGroupName>",
126		"<vnetName>",
127		network.VirtualNetwork{
128			Location: to.StringPtr("<azureRegion>"),
129			VirtualNetworkPropertiesFormat: &network.VirtualNetworkPropertiesFormat{
130				AddressSpace: &network.AddressSpace{
131					AddressPrefixes: &[]string{"10.0.0.0/8"},
132				},
133				Subnets: &[]network.Subnet{
134					{
135						Name: to.StringPtr("<subnet1Name>"),
136						SubnetPropertiesFormat: &network.SubnetPropertiesFormat{
137							AddressPrefix: to.StringPtr("10.0.0.0/16"),
138						},
139					},
140					{
141						Name: to.StringPtr("<subnet2Name>"),
142						SubnetPropertiesFormat: &network.SubnetPropertiesFormat{
143							AddressPrefix: to.StringPtr("10.1.0.0/16"),
144						},
145					},
146				},
147			},
148		})
149}
150```
151
152## Authentication
153
154Typical SDK operations must be authenticated and authorized. The _Authorizer_
155interface allows use of any auth style in requests, such as inserting an OAuth2
156Authorization header and bearer token received from Azure AD.
157
158The SDK itself provides a simple way to get an authorizer which first checks
159for OAuth client credentials in environment variables and then falls back to
160Azure's [Managed Service Identity](https://github.com/Azure/azure-sdk-for-go/) when available, e.g. when on an Azure
161VM. The following snippet from [the previous section](#use) demonstrates
162this helper.
163
164```go
165import "github.com/Azure/go-autorest/autorest/azure/auth"
166
167// create a VirtualNetworks client
168vnetClient := network.NewVirtualNetworksClient("<subscriptionID>")
169
170// create an authorizer from env vars or Azure Managed Service Idenity
171authorizer, err := auth.NewAuthorizerFromEnvironment()
172if err == nil {
173    vnetClient.Authorizer = authorizer
174}
175
176// call the VirtualNetworks CreateOrUpdate API
177vnetClient.CreateOrUpdate(context.Background(),
178// ...
179```
180
181The following environment variables help determine authentication configuration:
182
183- `AZURE_ENVIRONMENT`: Specifies the Azure Environment to use. If not set, it
184  defaults to `AzurePublicCloud`. Not applicable to authentication with Managed
185  Service Identity (MSI).
186- `AZURE_AD_RESOURCE`: Specifies the AAD resource ID to use. If not set, it
187  defaults to `ResourceManagerEndpoint` for operations with Azure Resource
188  Manager. You can also choose an alternate resource programmatically with
189  `auth.NewAuthorizerFromEnvironmentWithResource(resource string)`.
190
191### More Authentication Details
192
193The previous is the first and most recommended of several authentication
194options offered by the SDK because it allows seamless use of both service
195principals and [Azure Managed Service Identity][]. Other options are listed
196below.
197
198> Note: If you need to create a new service principal, run `az ad sp create-for-rbac -n "<app_name>"` in the
199> [azure-cli](https://github.com/Azure/azure-cli). See [these
200> docs](https://docs.microsoft.com/cli/azure/create-an-azure-service-principal-azure-cli?view=azure-cli-latest)
201> for more info. Copy the new principal's ID, secret, and tenant ID for use in
202> your app, or consider the `--sdk-auth` parameter for serialized output.
203
204[azure managed service identity]: https://docs.microsoft.com/azure/active-directory/msi-overview
205
206- The `auth.NewAuthorizerFromEnvironment()` described above creates an authorizer
207  from the first available of the following configuration:
208
209      1. **Client Credentials**: Azure AD Application ID and Secret.
210
211          - `AZURE_TENANT_ID`: Specifies the Tenant to which to authenticate.
212          - `AZURE_CLIENT_ID`: Specifies the app client ID to use.
213          - `AZURE_CLIENT_SECRET`: Specifies the app secret to use.
214
215      2. **Client Certificate**: Azure AD Application ID and X.509 Certificate.
216
217          - `AZURE_TENANT_ID`: Specifies the Tenant to which to authenticate.
218          - `AZURE_CLIENT_ID`: Specifies the app client ID to use.
219          - `AZURE_CERTIFICATE_PATH`: Specifies the certificate Path to use.
220          - `AZURE_CERTIFICATE_PASSWORD`: Specifies the certificate password to use.
221
222      3. **Resource Owner Password**: Azure AD User and Password. This grant type is *not
223         recommended*, use device login instead if you need interactive login.
224
225          - `AZURE_TENANT_ID`: Specifies the Tenant to which to authenticate.
226          - `AZURE_CLIENT_ID`: Specifies the app client ID to use.
227          - `AZURE_USERNAME`: Specifies the username to use.
228          - `AZURE_PASSWORD`: Specifies the password to use.
229
230      4. **Azure Managed Service Identity**: Delegate credential management to the
231         platform. Requires that code is running in Azure, e.g. on a VM. All
232         configuration is handled by Azure. See [Azure Managed Service
233         Identity](https://docs.microsoft.com/azure/active-directory/msi-overview)
234         for more details.
235
236- The `auth.NewAuthorizerFromFile()` method creates an authorizer using
237  credentials from an auth file created by the [Azure CLI][]. Follow these
238  steps to utilize:
239
240  1. Create a service principal and output an auth file using `az ad sp create-for-rbac --sdk-auth > client_credentials.json`.
241  2. Set environment variable `AZURE_AUTH_LOCATION` to the path of the saved
242     output file.
243  3. Use the authorizer returned by `auth.NewAuthorizerFromFile()` in your
244     client as described above.
245
246- The `auth.NewAuthorizerFromCLI()` method creates an authorizer which
247  uses [Azure CLI][] to obtain its credentials.
248
249  The default audience being requested is `https://management.azure.com` (Azure ARM API).
250  To specify your own audience, export `AZURE_AD_RESOURCE` as an evironment variable.
251  This is read by `auth.NewAuthorizerFromCLI()` and passed to Azure CLI to acquire the access token.
252
253  For example, to request an access token for Azure Key Vault, export
254  ```
255  AZURE_AD_RESOURCE="https://vault.azure.net"
256  ```
257
258- `auth.NewAuthorizerFromCLIWithResource(AUDIENCE_URL_OR_APPLICATION_ID)` - this method is self contained and does
259  not require exporting environment variables. For example, to request an access token for Azure Key Vault:
260  ```
261  auth.NewAuthorizerFromCLIWithResource("https://vault.azure.net")
262  ```
263
264  To use `NewAuthorizerFromCLI()` or `NewAuthorizerFromCLIWithResource()`, follow these steps:
265
266  1. Install [Azure CLI v2.0.12](https://docs.microsoft.com/cli/azure/install-azure-cli) or later. Upgrade earlier versions.
267  2. Use `az login` to sign in to Azure.
268
269  If you receive an error, use `az account get-access-token` to verify access.
270
271  If Azure CLI is not installed to the default directory, you may receive an error
272  reporting that `az` cannot be found.
273  Use the `AzureCLIPath` environment variable to define the Azure CLI installation folder.
274
275  If you are signed in to Azure CLI using multiple accounts or your account has
276  access to multiple subscriptions, you need to specify the specific subscription
277  to be used. To do so, use:
278
279  ```
280  az account set --subscription <subscription-id>
281  ```
282
283  To verify the current account settings, use:
284
285  ```
286  az account list
287  ```
288
289[azure cli]: https://github.com/Azure/azure-cli
290
291- Finally, you can use OAuth's [Device Flow][] by calling
292  `auth.NewDeviceFlowConfig()` and extracting the Authorizer as follows:
293
294  ```go
295  config := auth.NewDeviceFlowConfig(clientID, tenantID)
296  a, err := config.Authorizer()
297  ```
298
299[device flow]: https://oauth.net/2/device-flow/
300
301# Versioning
302
303azure-sdk-for-go provides at least a basic Go binding for every Azure API. To
304provide maximum flexibility to users, the SDK even includes previous versions of
305Azure APIs which are still in use. This enables us to support users of the
306most updated Azure datacenters, regional datacenters with earlier APIs, and
307even on-premises installations of Azure Stack.
308
309**SDK versions** apply globally and are tracked by git
310[tags](https://github.com/Azure/azure-sdk-for-go/tags). These are in x.y.z form
311and generally adhere to [semantic versioning](https://semver.org) specifications.
312
313**Service API versions** are generally represented by a date string and are
314tracked by offering separate packages for each version. For example, to choose the
315latest API versions for Compute and Network, use the following imports:
316
317```go
318import (
319    "github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2017-12-01/compute"
320    "github.com/Azure/azure-sdk-for-go/services/network/mgmt/2017-09-01/network"
321)
322```
323
324Occasionally service-side changes require major changes to existing versions.
325These cases are noted in the changelog, and for this reason `Service API versions`
326cannot be used alone to ensure backwards compatibility.
327
328All available services and versions are listed under the `services/` path in
329this repo and in [GoDoc][services_godoc]. Run `find ./services -type d -mindepth 3` to list all available service packages.
330
331[services_godoc]: https://godoc.org/github.com/Azure/azure-sdk-for-go/services
332
333### Profiles
334
335Azure **API profiles** specify subsets of Azure APIs and versions. Profiles can provide:
336
337- **stability** for your application by locking to specific API versions; and/or
338- **compatibility** for your application with Azure Stack and regional Azure datacenters.
339
340In the Go SDK, profiles are available under the `profiles/` path and their
341component API versions are aliases to the true service package under
342`services/`. You can use them as follows:
343
344```go
345import "github.com/Azure/azure-sdk-for-go/profiles/2017-03-09/compute/mgmt/compute"
346import "github.com/Azure/azure-sdk-for-go/profiles/2017-03-09/network/mgmt/network"
347import "github.com/Azure/azure-sdk-for-go/profiles/2017-03-09/storage/mgmt/storage"
348```
349
350The following profiles are available for hybrid Azure and Azure Stack environments.
351- 2017-03-09
352- 2018-03-01
353
354In addition to versioned profiles, we also provide two special profiles
355`latest` and `preview`. The `latest` profile contains the latest API version
356of each service, excluding any preview versions and/or content.  The `preview`
357profile is similar to the `latest` profile but includes preview API versions.
358
359The `latest` and `preview` profiles can help you stay up to date with API
360updates as you build applications. Since they are by definition not stable,
361however, they **should not** be used in production apps. Instead, choose the
362latest specific API version (or an older one if necessary) from the `services/`
363path.
364
365As an example, to automatically use the most recent Compute APIs, use one of
366the following imports:
367
368```go
369import "github.com/Azure/azure-sdk-for-go/profiles/latest/compute/mgmt/compute"
370import "github.com/Azure/azure-sdk-for-go/profiles/preview/compute/mgmt/compute"
371```
372
373### Avoiding Breaking Changes
374
375To avoid breaking changes, when specifying imports you should specify a `Service API Version` or `Profile`, as well as lock (using [dep](https://github.com/golang/dep) and soon with [Go Modules](https://github.com/golang/go/wiki/Modules)) to a specific SDK version.
376
377For example, in your source code imports, use a `Service API Version` (`2017-12-01`):
378
379```go
380import "github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2017-12-01/compute"
381```
382
383or `Profile` version (`2017-03-09`):
384
385```go
386import "github.com/Azure/azure-sdk-for-go/profiles/2017-03-09/compute/mgmt/compute"
387```
388
389As well as, for dep, a `Gopkg.toml` file with:
390
391```toml
392[[constraint]]
393  name = "github.com/Azure/azure-sdk-for-go"
394  version = "21.0.0"
395```
396
397Combined, these techniques will ensure that breaking changes should not occur. If you are extra sensitive to changes, adding an additional [version pin](https://golang.github.io/dep/docs/Gopkg.toml.html#version-rules) in your SDK Version should satisfy your needs:
398
399```toml
400[[constraint]]
401  name = "github.com/Azure/azure-sdk-for-go"
402  version = "=21.3.0"
403```
404
405## Inspecting and Debugging
406
407### Built-in Basic Request/Response Logging
408
409Starting with `go-autorest v10.15.0` you can enable basic logging of requests and responses through setting environment variables.
410Setting `AZURE_GO_SDK_LOG_LEVEL` to `INFO` will log request/response without their bodies. To include the bodies set the log level to `DEBUG`.
411
412By default the logger writes to stderr, however it can also write to stdout or a file
413if specified in `AZURE_GO_SDK_LOG_FILE`. Note that if the specified file already exists it will be truncated.
414
415**IMPORTANT:** by default the logger will redact the Authorization and Ocp-Apim-Subscription-Key
416headers. Any other secrets will _not_ be redacted.
417
418### Writing Custom Request/Response Inspectors
419
420All clients implement some handy hooks to help inspect the underlying requests being made to Azure.
421
422- `RequestInspector`: View and manipulate the go `http.Request` before it's sent
423- `ResponseInspector`: View the `http.Response` received
424
425Here is an example of how these can be used with `net/http/httputil` to see requests and responses.
426
427```go
428vnetClient := network.NewVirtualNetworksClient("<subscriptionID>")
429vnetClient.RequestInspector = LogRequest()
430vnetClient.ResponseInspector = LogResponse()
431
432// ...
433
434func LogRequest() autorest.PrepareDecorator {
435	return func(p autorest.Preparer) autorest.Preparer {
436		return autorest.PreparerFunc(func(r *http.Request) (*http.Request, error) {
437			r, err := p.Prepare(r)
438			if err != nil {
439				log.Println(err)
440			}
441			dump, _ := httputil.DumpRequestOut(r, true)
442			log.Println(string(dump))
443			return r, err
444		})
445	}
446}
447
448func LogResponse() autorest.RespondDecorator {
449	return func(p autorest.Responder) autorest.Responder {
450		return autorest.ResponderFunc(func(r *http.Response) error {
451			err := p.Respond(r)
452			if err != nil {
453				log.Println(err)
454			}
455			dump, _ := httputil.DumpResponse(r, true)
456			log.Println(string(dump))
457			return err
458		})
459	}
460}
461```
462
463## Tracing and Metrics
464
465All packages and the runtime are instrumented using [OpenCensus](https://opencensus.io/).
466
467### Enable
468
469By default, no tracing provider will be compiled into your program, and the legacy approach of setting `AZURE_SDK_TRACING_ENABLED` environment variable will no longer take effect.
470
471To enable tracing, you must now add the following include to your source file.
472
473``` go
474import _ "github.com/Azure/go-autorest/tracing/opencensus"
475```
476
477To hook up a tracer simply call `tracing.Register()` passing in a type that satisfies the `tracing.Tracer` interface.
478
479**Note**: In future major releases of the SDK, tracing may become enabled by default.
480
481### Usage
482
483Once enabled, all SDK calls will emit traces and metrics and the traces will correlate the SDK calls with the raw http calls made to Azure API's. To consume those traces, if are not doing it yet, you need to register an exporter of your choice such as [Azure App Insights](https://docs.microsoft.com/azure/application-insights/opencensus-local-forwarder) or [Zipkin](https://opencensus.io/quickstart/go/tracing/#exporting-traces).
484
485To correlate the SDK calls between them and with the rest of your code, pass in a context that has a span initiated using the [opencensus-go library](https://github.com/census-instrumentation/opencensus-go) using the `trace.Startspan(ctx context.Context, name string, o ...StartOption)` function. Here is an example:
486
487```go
488func doAzureCalls() {
489	// The resulting context will be initialized with a root span as the context passed to
490	// trace.StartSpan() has no existing span.
491	ctx, span := trace.StartSpan(context.Background(), "doAzureCalls", trace.WithSampler(trace.AlwaysSample()))
492	defer span.End()
493
494	// The traces from the SDK calls will be correlated under the span inside the context that is passed in.
495	zone, _ := zonesClient.CreateOrUpdate(ctx, rg, zoneName, dns.Zone{Location: to.StringPtr("global")}, "", "")
496	zone, _ = zonesClient.Get(ctx, rg, *zone.Name)
497	for i := 0; i < rrCount; i++ {
498		rr, _ := recordsClient.CreateOrUpdate(ctx, rg, zoneName, fmt.Sprintf("rr%d", i), dns.CNAME, rdSet{
499			RecordSetProperties: &dns.RecordSetProperties{
500				TTL: to.Int64Ptr(3600),
501				CnameRecord: &dns.CnameRecord{
502					Cname: to.StringPtr("vladdbCname"),
503				},
504			},
505		},
506			"",
507			"",
508		)
509	}
510}
511```
512
513## Request Retry Policy
514
515The SDK provides a baked in retry policy for failed requests with default values that can be configured.
516Each [client](https://godoc.org/github.com/Azure/go-autorest/autorest#Client) object contains the follow fields.
517- `RetryAttempts` - the number of times to retry a failed request
518- `RetryDuration` - the duration to wait between retries
519
520For async operations the follow values are also used.
521- `PollingDelay` - the duration to wait between polling requests
522- `PollingDuration` - the total time to poll an async request before timing out
523
524Please see the [documentation](https://godoc.org/github.com/Azure/go-autorest/autorest#pkg-constants) for the default values used.
525
526Changing one or more values will affect all subsequet API calls.
527
528The default policy is to call `autorest.DoRetryForStatusCodes()` from an API's `Sender` method.  Example:
529```go
530func (client OperationsClient) ListSender(req *http.Request) (*http.Response, error) {
531	sd := autorest.GetSendDecorators(req.Context(), autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
532	return autorest.SendWithSender(client, req, sd...)
533}
534```
535
536Details on how `autorest.DoRetryforStatusCodes()` works can be found in the [documentation](https://godoc.org/github.com/Azure/go-autorest/autorest#DoRetryForStatusCodes).
537
538The slice of `SendDecorators` used in a `Sender` method can be customized per API call by smuggling them in the context.  Here's an example.
539
540```go
541ctx := context.Background()
542autorest.WithSendDecorators(ctx, []autorest.SendDecorator{
543	autorest.DoRetryForStatusCodesWithCap(client.RetryAttempts,
544		client.RetryDuration, time.Duration(0),
545		autorest.StatusCodesForRetry...)})
546client.List(ctx)
547```
548
549This will replace the default slice of `SendDecorators` with the provided slice.
550
551The `PollingDelay` and `PollingDuration` values are used exclusively by [WaitForCompletionRef()](https://godoc.org/github.com/Azure/go-autorest/autorest/azure#Future.WaitForCompletionRef) when blocking on an async call until it completes.
552
553# Resources
554
555- SDK docs are at [godoc.org](https://godoc.org/github.com/Azure/azure-sdk-for-go/).
556- SDK samples are at [Azure-Samples/azure-sdk-for-go-samples](https://github.com/Azure-Samples/azure-sdk-for-go-samples).
557- SDK notifications are published via the [Azure update feed](https://azure.microsoft.com/updates/).
558- Azure API docs are at [docs.microsoft.com/rest/api](https://docs.microsoft.com/rest/api/).
559- General Azure docs are at [docs.microsoft.com/azure](https://docs.microsoft.com/azure).
560
561## Reporting security issues and security bugs
562
563Security issues and bugs should be reported privately, via email, to the Microsoft Security Response Center (MSRC) <secure@microsoft.com>. You should receive a response within 24 hours. If for some reason you do not, please follow up via email to ensure we received your original message. Further information, including the MSRC PGP key, can be found in the [Security TechCenter](https://www.microsoft.com/msrc/faqs-report-an-issue).
564
565## License
566
567```
568   Copyright 2020 Microsoft Corporation
569
570   Licensed under the Apache License, Version 2.0 (the "License");
571   you may not use this file except in compliance with the License.
572   You may obtain a copy of the License at
573
574       http://www.apache.org/licenses/LICENSE-2.0
575
576   Unless required by applicable law or agreed to in writing, software
577   distributed under the License is distributed on an "AS IS" BASIS,
578   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
579   See the License for the specific language governing permissions and
580   limitations under the License.
581```
582
583## Contribute
584
585See [CONTRIBUTING.md](https://github.com/Azure/azure-sdk-for-go/blob/master/CONTRIBUTING.md).
586
587[samples_repo]: https://github.com/Azure-Samples/azure-sdk-for-go-samples
588