Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
yupwei68 committed May 20, 2021
1 parent 9de4e97 commit 03bad5d
Show file tree
Hide file tree
Showing 209 changed files with 18,542 additions and 8 deletions.
8 changes: 0 additions & 8 deletions go.sum
Original file line number Diff line number Diff line change
@@ -1,24 +1,19 @@
github.com/Azure/azure-sdk-for-go v45.0.0+incompatible h1:/bZYPaJLCqXeCqQqEeEIQg/p7RNafOhaVFhC6IWxZ/8=
github.com/Azure/azure-sdk-for-go v45.0.0+incompatible/go.mod h1:9XXNKU+eRnpl9moKnB4QOLf1HestfXbmab5FXxiDBjc=
github.com/Azure/azure-sdk-for-go v47.1.0+incompatible h1:D6MsWmsxF+pEjN/yZDyKXoUrsamdBdTlPedIgBlvVx4=
github.com/Azure/azure-sdk-for-go v47.1.0+incompatible/go.mod h1:9XXNKU+eRnpl9moKnB4QOLf1HestfXbmab5FXxiDBjc=
github.com/Azure/go-autorest v14.2.0+incompatible h1:V5VMDjClD3GiElqLWO7mz2MxNAK/vTfRHdAubSIPRgs=
github.com/Azure/go-autorest v14.2.0+incompatible/go.mod h1:r+4oMnoxhatjLLJ6zxSWATqVooLgysK6ZNox3g/xq24=
github.com/Azure/go-autorest/autorest v0.11.3 h1:fyYnmYujkIXUgv88D9/Wo2ybE4Zwd/TmQd5sSI5u2Ws=
github.com/Azure/go-autorest/autorest v0.11.3/go.mod h1:JFgpikqFJ/MleTTxwepExTKnFUKKszPS8UavbQYUMuw=
github.com/Azure/go-autorest/autorest v0.11.10 h1:j5sGbX7uj1ieYYkQ3Mpvewd4DCsEQ+ZeJpqnSM9pjnM=
github.com/Azure/go-autorest/autorest v0.11.10/go.mod h1:eipySxLmqSyC5s5k1CLupqet0PSENBEDP93LQ9a8QYw=
github.com/Azure/go-autorest/autorest/adal v0.9.0 h1:SigMbuFNuKgc1xcGhaeapbh+8fgsu+GxgDRFyg7f5lM=
github.com/Azure/go-autorest/autorest/adal v0.9.0/go.mod h1:/c022QCutn2P7uY+/oQWWNcK9YU+MH96NgK+jErpbcg=
github.com/Azure/go-autorest/autorest/adal v0.9.5 h1:Y3bBUV4rTuxenJJs41HU3qmqsb+auo+a3Lz+PlJPpL0=
github.com/Azure/go-autorest/autorest/adal v0.9.5/go.mod h1:B7KF7jKIeC9Mct5spmyCB/A8CG/sEz1vwIRGv/bbw7A=
github.com/Azure/go-autorest/autorest/azure/cli v0.4.0 h1:Ml+UCrnlKD+cJmSzrZ/RDcDw86NjkRUpnFh7V5JUhzU=
github.com/Azure/go-autorest/autorest/azure/cli v0.4.0/go.mod h1:JljT387FplPzBA31vUcvsetLKF3pec5bdAxjVU4kI2s=
github.com/Azure/go-autorest/autorest/azure/cli v0.4.2 h1:dMOmEJfkLKW/7JsokJqkyoYSgmR08hi9KrhjZb+JALY=
github.com/Azure/go-autorest/autorest/azure/cli v0.4.2/go.mod h1:7qkJkT+j6b+hIpzMOwPChJhTqS8VbsqqgULzMNRugoM=
github.com/Azure/go-autorest/autorest/date v0.3.0 h1:7gUk1U5M/CQbp9WoqinNzJar+8KY+LPI6wiWrP/myHw=
github.com/Azure/go-autorest/autorest/date v0.3.0/go.mod h1:BI0uouVdmngYNUzGWeSYnokU+TrmwEsOqdt8Y6sso74=
github.com/Azure/go-autorest/autorest/mocks v0.4.0 h1:z20OWOSG5aCye0HEkDp6TPmP17ZcfeMxPi6HnSALa8c=
github.com/Azure/go-autorest/autorest/mocks v0.4.0/go.mod h1:LTp+uSrOhSkaKrUy935gNZuuIPPVsHlr9DSOxSayd+k=
github.com/Azure/go-autorest/autorest/mocks v0.4.1 h1:K0laFcLE6VLTOwNgSxaGbUcLPuGXlNkbVvq4cW4nIHk=
github.com/Azure/go-autorest/autorest/mocks v0.4.1/go.mod h1:LTp+uSrOhSkaKrUy935gNZuuIPPVsHlr9DSOxSayd+k=
Expand All @@ -33,7 +28,6 @@ github.com/Azure/go-autorest/tracing v0.6.0/go.mod h1:+vhtPC754Xsa23ID7GlGsrdKBp
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/dgrijalva/jwt-go v3.2.0+incompatible h1:7qlOGliEKZXTDg6OTjfoBKDXWrumCAMpl/TFQ4/5kLM=
github.com/dgrijalva/jwt-go v3.2.0+incompatible/go.mod h1:E3ru+11k8xSBh+hMPgOLZmtrrCbhqsmaPHjLKYnJCaQ=
github.com/dimchansky/utfbom v1.1.0 h1:FcM3g+nofKgUteL8dm/UpdRXNC9KmADgTpLKsu0TRo4=
github.com/dimchansky/utfbom v1.1.0/go.mod h1:rO41eb7gLfo8SF1jd9F8HplJm1Fewwi4mQvIirEdv+8=
Expand All @@ -54,9 +48,7 @@ github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZN
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/testify v1.3.0 h1:TivCn/peBQ7UY8ooIcPgZFpTNSz0Q2U6UrFlUfqbe0Q=
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2 h1:VklqNMn3ovrHsnt90PveolxSbWFaJdECFbxSq0Mqo2M=
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9 h1:psW17arqaxU48Z5kZ0CQnkZWQJsqcURM6tKiBApRjXI=
golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
golang.org/x/crypto v0.0.0-20201002170205-7f63de1d35b0/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
golang.org/x/crypto v0.0.0-20201016220609-9e8e0b390897 h1:pLI5jrR7OSLijeIDcmRxNmw2api+jEfxLoykJVice/E=
Expand Down
31 changes: 31 additions & 0 deletions storage/2020-08-04/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# Storage API Version 2020-08-04

The following API's are supported by this SDK - more information about each SDK can be found within the README in each package.

## Blob Storage

- [Blobs API](blob/blobs)
- [Containers API](blob/containers)
- [Accounts API](blob/accounts)

## DataLakeStore Gen2

- [FileSystems API](datalakestore/filesystems)
- [Paths API](datalakestore/paths)

## File Storage

- [Directories API](file/directories)
- [Files API](file/files)
- [Shares API](file/shares)

## Queue Storage

- [Queues API](queue/queues)
- [Messages API](queue/messages)

## Table Storage

- [Entities API](table/entities)
- [Tables API](table/tables)

57 changes: 57 additions & 0 deletions storage/2020-08-04/blob/accounts/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
## Blob Storage Account SDK for API version 2020-08-04

This package allows you to interact with the Accounts Blob Storage API

### Supported Authorizers

* Azure Active Directory

### Example Usage

```go
package main

import (
"context"
"fmt"
"time"

"github.com/Azure/go-autorest/autorest"
"github.com/tombuildsstuff/giovanni/storage/2020-08-04/blob/accounts"
)

func Example() error {
accountName := "storageaccount1"

// e.g. https://github.com/tombuildsstuff/giovanni/blob/76f5f686c99ecdcc3fa533a0330d0e1aacb1c327/example/azuread-auth/main.go#L54
client, err := buildClient()
if err != nil {
return fmt.Errorf("error building client: %s", err)
}

ctx := context.TODO()

input := StorageServiceProperties{
StaticWebsite: &StaticWebsite{
Enabled: true,
IndexDocument: index,
ErrorDocument404Path: errorDocument,
},
}

_, err = client.SetServiceProperties(ctx, accountName, input)
if err != nil {
return fmt.Errorf("error setting properties: %s", err)
}

time.Sleep(2 * time.Second)

_, err = accountsClient.GetServiceProperties(ctx, accountName)
if err != nil {
return fmt.Errorf("error getting properties: %s", err)
}

return nil
}

```
25 changes: 25 additions & 0 deletions storage/2020-08-04/blob/accounts/client.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
package accounts

import (
"github.com/Azure/go-autorest/autorest"
"github.com/Azure/go-autorest/autorest/azure"
)

// Client is the base client for Blob Storage Blobs.
type Client struct {
autorest.Client
BaseURI string
}

// New creates an instance of the Client client.
func New() Client {
return NewWithEnvironment(azure.PublicCloud)
}

// NewWithBaseURI creates an instance of the Client client.
func NewWithEnvironment(environment azure.Environment) Client {
return Client{
Client: autorest.NewClientWithUserAgent(UserAgent()),
BaseURI: environment.StorageEndpointSuffix,
}
}
84 changes: 84 additions & 0 deletions storage/2020-08-04/blob/accounts/get_service_properties.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
package accounts

import (
"context"
"net/http"

"github.com/Azure/go-autorest/autorest"
"github.com/Azure/go-autorest/autorest/azure"
"github.com/Azure/go-autorest/autorest/validation"
"github.com/tombuildsstuff/giovanni/storage/internal/endpoints"
)

type GetServicePropertiesResult struct {
autorest.Response

ContentType string
StorageServiceProperties *StorageServiceProperties
}

// GetServicePropertiesPreparer prepares the GetServiceProperties request.
func (client Client) GetServicePropertiesPreparer(ctx context.Context, accountName string) (*http.Request, error) {
queryParameters := map[string]interface{}{
"restype": "service",
"comp": "properties",
}

headers := map[string]interface{}{
"x-ms-version": APIVersion,
}

preparer := autorest.CreatePreparer(
autorest.AsGet(),
autorest.WithBaseURL(endpoints.GetBlobEndpoint(client.BaseURI, accountName)),
autorest.WithHeaders(headers),
autorest.WithQueryParameters(queryParameters))
return preparer.Prepare((&http.Request{}).WithContext(ctx))
}

func (client Client) GetServicePropertiesSender(req *http.Request) (*http.Response, error) {
return autorest.SendWithSender(client, req,
azure.DoRetryWithRegistration(client.Client))
}

func (client Client) GetServicePropertiesResponder(resp *http.Response) (result GetServicePropertiesResult, err error) {
if resp != nil && resp.Header != nil {
result.ContentType = resp.Header.Get("Content-Type")
}

err = autorest.Respond(
resp,
client.ByInspecting(),
azure.WithErrorUnlessStatusCode(http.StatusOK),
autorest.ByUnmarshallingXML(&result.StorageServiceProperties),
autorest.ByClosing())
result.Response = autorest.Response{Response: resp}
return
}

func (client Client) GetServiceProperties(ctx context.Context, accountName string) (result GetServicePropertiesResult, err error) {
if accountName == "" {
return result, validation.NewError("accounts.Client", "GetServiceProperties", "`accountName` cannot be an empty string.")
}

req, err := client.GetServicePropertiesPreparer(ctx, accountName)
if err != nil {
err = autorest.NewErrorWithError(err, "accounts.Client", "GetServiceProperties", nil, "Failure preparing request")
return
}

resp, err := client.GetServicePropertiesSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
err = autorest.NewErrorWithError(err, "accounts.Client", "GetServiceProperties", resp, "Failure sending request")
return
}

result, err = client.GetServicePropertiesResponder(resp)
if err != nil {
err = autorest.NewErrorWithError(err, "accounts.Client", "GetServiceProperties", resp, "Failure responding to request")
return
}

return
}
80 changes: 80 additions & 0 deletions storage/2020-08-04/blob/accounts/models.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
package accounts

import "github.com/Azure/go-autorest/autorest"

type SetServicePropertiesResult struct {
autorest.Response
}

type StorageServiceProperties struct {
// Cors - Specifies CORS rules for the Blob service. You can include up to five CorsRule elements in the request. If no CorsRule elements are included in the request body, all CORS rules will be deleted, and CORS will be disabled for the Blob service.
Cors *CorsRules `xml:"Cors,omitempty"`
// DefaultServiceVersion - DefaultServiceVersion indicates the default version to use for requests to the Blob service if an incoming request’s version is not specified. Possible values include version 2008-10-27 and all more recent versions.
DefaultServiceVersion *string `xml:"DefaultServiceVersion,omitempty"`
// DeleteRetentionPolicy - The blob service properties for soft delete.
DeleteRetentionPolicy *DeleteRetentionPolicy `xml:"DeleteRetentionPolicy,omitempty"`
// Logging - The blob service properties for logging access
Logging *Logging `xml:"Logging,omitempty"`
// HourMetrics - The blob service properties for hour metrics
HourMetrics *MetricsConfig `xml:"HourMetrics,omitempty"`
// HourMetrics - The blob service properties for minute metrics
MinuteMetrics *MetricsConfig `xml:"MinuteMetrics,omitempty"`
// StaticWebsite - Optional
StaticWebsite *StaticWebsite `xml:"StaticWebsite,omitempty"`
}

// StaticWebsite sets the static website support properties on the Blob service.
type StaticWebsite struct {
// Enabled - Required. Indicates whether static website support is enabled for the given account.
Enabled bool `xml:"Enabled"`
// IndexDocument - Optional. The webpage that Azure Storage serves for requests to the root of a website or any subfolder. For example, index.html. The value is case-sensitive.
IndexDocument string `xml:"IndexDocument,omitempty"`
// ErrorDocument404Path - Optional. The absolute path to a webpage that Azure Storage serves for requests that do not correspond to an existing file. For example, error/404.html. Only a single custom 404 page is supported in each static website. The value is case-sensitive.
ErrorDocument404Path string `xml:"ErrorDocument404Path,omitempty"`
}

// CorsRules sets the CORS rules. You can include up to five CorsRule elements in the request.
type CorsRules struct {
// CorsRules - The List of CORS rules. You can include up to five CorsRule elements in the request.
CorsRules []CorsRule `xml:"CorsRules,omitempty"`
}

// DeleteRetentionPolicy the blob service properties for soft delete.
type DeleteRetentionPolicy struct {
// Enabled - Indicates whether DeleteRetentionPolicy is enabled for the Blob service.
Enabled bool `xml:"Enabled,omitempty"`
// Days - Indicates the number of days that the deleted blob should be retained. The minimum specified value can be 1 and the maximum value can be 365.
Days int32 `xml:"Days,omitempty"`
}

// CorsRule specifies a CORS rule for the Blob service.
type CorsRule struct {
// AllowedOrigins - Required if CorsRule element is present. A list of origin domains that will be allowed via CORS, or "" to allow all domains
AllowedOrigins []string `xml:"AllowedOrigins,omitempty"`
// AllowedMethods - Required if CorsRule element is present. A list of HTTP methods that are allowed to be executed by the origin.
AllowedMethods []string `xml:"AllowedMethods,omitempty"`
// MaxAgeInSeconds - Required if CorsRule element is present. The number of seconds that the client/browser should cache a preflight response.
MaxAgeInSeconds int32 `xml:"MaxAgeInSeconds,omitempty"`
// ExposedHeaders - Required if CorsRule element is present. A list of response headers to expose to CORS clients.
ExposedHeaders []string `xml:"ExposedHeaders,omitempty"`
// AllowedHeaders - Required if CorsRule element is present. A list of headers allowed to be part of the cross-origin request.
AllowedHeaders []string `xml:"AllowedHeaders,omitempty"`
}

// Logging specifies the access logging options for the Blob service.
type Logging struct {
Version string `xml:"Version"`
Delete bool `xml:"Delete"`
Read bool `xml:"Read"`
Write bool `xml:"Write"`
RetentionPolicy DeleteRetentionPolicy `xml:"RetentionPolicy"`
}

// MetricsConfig specifies the hour and/or minute metrics options for the Blob service.
// Elements are all expected
type MetricsConfig struct {
Version string `xml:"Version"`
Enabled bool `xml:"Enabled"`
RetentionPolicy DeleteRetentionPolicy `xml:"RetentionPolicy"`
IncludeAPIs bool `xml:"IncludeAPIs"`
}
Loading

0 comments on commit 03bad5d

Please sign in to comment.