| 1 | package containers |
| 2 | |
| 3 | import ( |
| 4 | "github.com/Azure/go-autorest/autorest" |
| 5 | "github.com/Azure/go-autorest/autorest/azure" |
| 6 | ) |
| 7 | |
| 8 | // Client is the base client for Blob Storage Containers. |
| 9 | type Client struct { |
| 10 | autorest.Client |
| 11 | BaseURI string |
| 12 | } |
| 13 | |
| 14 | // New creates an instance of the Client client. |
| 15 | func New() Client { |
| 16 | return NewWithEnvironment(azure.PublicCloud) |
| 17 | } |
| 18 | |
| 19 | // NewWithBaseURI creates an instance of the Client client. |
| 20 | func NewWithEnvironment(environment azure.Environment) Client { |
| 21 | return Client{ |
| 22 | Client: autorest.NewClientWithUserAgent(UserAgent()), |
| 23 | BaseURI: environment.StorageEndpointSuffix, |
| 24 | } |
| 25 | } |
| 26 | |
| 27 | func (client Client) setAccessLevelIntoHeaders(headers map[string]interface{}, level AccessLevel) map[string]interface{} { |
| 28 | // If this header is not included in the request, container data is private to the account owner. |
| 29 | if level != Private { |
| 30 | headers["x-ms-blob-public-access"] = string(level) |
| 31 | } |
| 32 | |
| 33 | return headers |
| 34 | } |