service package - github.com/Azure/azure-sdk-for-go/sdk/storage/azblob/service - Go Packages (original) (raw)

ExampleServiceBatchDelete shows blob batch operations for delete and set tier.

package main

import ( "context" "fmt" "log" "os"

"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
"github.com/Azure/azure-sdk-for-go/sdk/storage/azblob"
"github.com/Azure/azure-sdk-for-go/sdk/storage/azblob/blob"
"github.com/Azure/azure-sdk-for-go/sdk/storage/azblob/service"

)

func handleError(err error) { if err != nil { log.Fatal(err.Error()) } }

func main() { accountName, ok := os.LookupEnv("AZURE_STORAGE_ACCOUNT_NAME") if !ok { panic("AZURE_STORAGE_ACCOUNT_NAME could not be found") } accountKey, ok := os.LookupEnv("AZURE_STORAGE_ACCOUNT_KEY") if !ok { panic("AZURE_STORAGE_ACCOUNT_NAME could not be found") }

// create shared key credential
cred, err := azblob.NewSharedKeyCredential(accountName, accountKey)
handleError(err)

// create service batch client
serviceURL := fmt.Sprintf("https://%s.blob.core.windows.net/", accountName)
svcBatchClient, err := service.NewClientWithSharedKeyCredential(serviceURL, cred, nil)
handleError(err)

// create new batch builder
bb, err := svcBatchClient.NewBatchBuilder()
handleError(err)

// add operations to the batch builder
err = bb.Delete("cnt1", "testBlob0", nil)
handleError(err)

err = bb.Delete("cnt1", "testBlob1", &service.BatchDeleteOptions{
    VersionID: to.Ptr("2023-01-03T11:57:25.4067017Z"), // version id for deletion
})
handleError(err)

err = bb.Delete("cnt2", "testBlob2", &service.BatchDeleteOptions{
    Snapshot: to.Ptr("2023-01-03T11:57:25.6515618Z"), // snapshot for deletion
})
handleError(err)

err = bb.Delete("cnt2", "testBlob3", &service.BatchDeleteOptions{
    DeleteOptions: blob.DeleteOptions{
        DeleteSnapshots: to.Ptr(blob.DeleteSnapshotsOptionTypeOnly),
        BlobDeleteType:  to.Ptr(blob.DeleteTypeNone),
    },
})
handleError(err)

resp, err := svcBatchClient.SubmitBatch(context.TODO(), bb, nil)
handleError(err)

// get response for individual sub-requests
for _, resp := range resp.Responses {
    if resp.ContainerName != nil && resp.BlobName != nil {
        fmt.Println("Container: " + *resp.ContainerName)
        fmt.Println("Blob: " + *resp.BlobName)
    }
    if resp.Error == nil {
        fmt.Println("Successful sub-request")
    } else {
        fmt.Println("Error: " + resp.Error.Error())
    }
}

}

ExampleServiceBatchSetTier shows blob batch operations for delete and set tier.

package main

import ( "context" "fmt" "log" "os"

"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/storage/azblob/blob"
"github.com/Azure/azure-sdk-for-go/sdk/storage/azblob/service"

)

func handleError(err error) { if err != nil { log.Fatal(err.Error()) } }

func main() { accountName, ok := os.LookupEnv("AZURE_STORAGE_ACCOUNT_NAME") if !ok { panic("AZURE_STORAGE_ACCOUNT_NAME could not be found") } tenantID, ok := os.LookupEnv("AZURE_STORAGE_TENANT_ID") if !ok { panic("AZURE_STORAGE_TENANT_ID could not be found") } clientID, ok := os.LookupEnv("AZURE_STORAGE_CLIENT_ID") if !ok { panic("AZURE_STORAGE_CLIENT_ID could not be found") } clientSecret, ok := os.LookupEnv("AZURE_STORAGE_CLIENT_SECRET") if !ok { panic("AZURE_STORAGE_CLIENT_SECRET could not be found") }

// create client secret credential
cred, err := azidentity.NewClientSecretCredential(tenantID, clientID, clientSecret, nil)
handleError(err)

// create service batch client
serviceURL := fmt.Sprintf("https://%s.blob.core.windows.net/", accountName)
svcBatchClient, err := service.NewClient(serviceURL, cred, nil)
handleError(err)

// create new batch builder
bb, err := svcBatchClient.NewBatchBuilder()
handleError(err)

// add operations to the batch builder
err = bb.SetTier("cnt1", "testBlob4", blob.AccessTierHot, nil)
handleError(err)

err = bb.SetTier("cnt1", "testBlob5", blob.AccessTierCool, &service.BatchSetTierOptions{
    VersionID: to.Ptr("2023-01-03T11:57:25.4067017Z"),
})
handleError(err)

err = bb.SetTier("cnt2", "testBlob5", blob.AccessTierCool, &service.BatchSetTierOptions{
    Snapshot: to.Ptr("2023-01-03T11:57:25.6515618Z"),
})
handleError(err)

err = bb.SetTier("cnt2", "testBlob4", blob.AccessTierCool, &service.BatchSetTierOptions{
    SetTierOptions: blob.SetTierOptions{
        RehydratePriority: to.Ptr(blob.RehydratePriorityStandard),
    },
})
handleError(err)

resp, err := svcBatchClient.SubmitBatch(context.TODO(), bb, nil)
handleError(err)

// get response for individual sub-requests
for _, resp := range resp.Responses {
    if resp.ContainerName != nil && resp.BlobName != nil {
        fmt.Println("Container: " + *resp.ContainerName)
        fmt.Println("Blob: " + *resp.BlobName)
    }
    if resp.Error == nil {
        fmt.Println("Successful sub-request")
    } else {
        fmt.Println("Error: " + resp.Error.Error())
    }
}

}

package main

import ( "context" "fmt" "log" "os"

"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/storage/azblob/container"
"github.com/Azure/azure-sdk-for-go/sdk/storage/azblob/service"

)

func handleError(err error) { if err != nil { log.Fatal(err.Error()) } }

func main() { accountName, ok := os.LookupEnv("AZURE_STORAGE_ACCOUNT_NAME") if !ok { panic("AZURE_STORAGE_ACCOUNT_NAME could not be found") } serviceURL := fmt.Sprintf("https://%s.blob.core.windows.net/", accountName)

cred, err := azidentity.NewDefaultAzureCredential(nil)
handleError(err)

serviceClient, err := service.NewClient(serviceURL, cred, nil)
handleError(err)

_, err = serviceClient.CreateContainer(context.TODO(), "testcontainer", nil)
handleError(err)

// ======== 2. Delete a container ========
defer func(serviceClient1 *service.Client, ctx context.Context, containerName string, options *container.DeleteOptions) {
    _, err = serviceClient1.DeleteContainer(ctx, containerName, options)
    if err != nil {
        log.Fatal(err)
    }
}(serviceClient, context.TODO(), "testcontainer", nil)

}

package main

import ( "context" "fmt" "log" "os"

"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/storage/azblob/service"

)

func handleError(err error) { if err != nil { log.Fatal(err.Error()) } }

func main() { accountName, ok := os.LookupEnv("AZURE_STORAGE_ACCOUNT_NAME") if !ok { panic("AZURE_STORAGE_ACCOUNT_NAME could not be found") } serviceURL := fmt.Sprintf("https://%s.blob.core.windows.net/", accountName)

cred, err := azidentity.NewDefaultAzureCredential(nil)
handleError(err)
serviceClient, err := service.NewClient(serviceURL, cred, nil)
handleError(err)

_, err = serviceClient.DeleteContainer(context.TODO(), "testcontainer", nil)
handleError(err)

}

package main

import ( "context" "fmt" "log" "os"

"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/storage/azblob/service"

)

func handleError(err error) { if err != nil { log.Fatal(err.Error()) } }

func main() { accountName, ok := os.LookupEnv("AZURE_STORAGE_ACCOUNT_NAME") if !ok { panic("AZURE_STORAGE_ACCOUNT_NAME could not be found") } serviceURL := fmt.Sprintf("https://%s.blob.core.windows.net/", accountName)

cred, err := azidentity.NewDefaultAzureCredential(nil)
handleError(err)

serviceClient, err := service.NewClient(serviceURL, cred, nil)
handleError(err)

serviceGetPropertiesResponse, err := serviceClient.GetProperties(context.TODO(), nil)
handleError(err)

fmt.Println(serviceGetPropertiesResponse)

}

package main

import ( "fmt" "log" "time"

"github.com/Azure/azure-sdk-for-go/sdk/storage/azblob"
"github.com/Azure/azure-sdk-for-go/sdk/storage/azblob/sas"
"github.com/Azure/azure-sdk-for-go/sdk/storage/azblob/service"

)

func handleError(err error) { if err != nil { log.Fatal(err.Error()) } }

func main() { cred, err := azblob.NewSharedKeyCredential("myAccountName", "myAccountKey") handleError(err) serviceClient, err := service.NewClientWithSharedKeyCredential("https://.blob.core.windows.net", cred, nil) handleError(err)

resources := sas.AccountResourceTypes{Service: true}
permission := sas.AccountPermissions{Read: true}
start := time.Now()
expiry := start.AddDate(1, 0, 0)
options := service.GetSASURLOptions{StartTime: &start}
sasURL, err := serviceClient.GetSASURL(resources, permission, expiry, &options)
handleError(err)

serviceURL := fmt.Sprintf("https://<myAccountName>.blob.core.windows.net/?%s", sasURL)
serviceClientWithSAS, err := service.NewClientWithNoCredential(serviceURL, nil)
handleError(err)
_ = serviceClientWithSAS

}

package main

import ( "context" "fmt" "log" "os"

"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/storage/azblob/service"

)

func handleError(err error) { if err != nil { log.Fatal(err.Error()) } }

func main() { accountName, ok := os.LookupEnv("AZURE_STORAGE_ACCOUNT_NAME") if !ok { panic("AZURE_STORAGE_ACCOUNT_NAME could not be found") } serviceURL := fmt.Sprintf("https://%s.blob.core.windows.net/", accountName)

cred, err := azidentity.NewDefaultAzureCredential(nil)
handleError(err)
serviceClient, err := service.NewClient(serviceURL, cred, nil)
handleError(err)

listContainersOptions := service.ListContainersOptions{
    Include: service.ListContainersInclude{
        Metadata: true, // Include Metadata
        Deleted:  true, // Include deleted containers in the result as well
    },
}
pager := serviceClient.NewListContainersPager(&listContainersOptions)

for pager.More() {
    resp, err := pager.NextPage(context.TODO())
    if err != nil {
        log.Fatal(err)
    }
    for _, container := range resp.ContainerItems {
        fmt.Println(*container.Name)
    }
}

}

package main

import ( "fmt" "log" "os"

"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/storage/azblob/service"

)

func handleError(err error) { if err != nil { log.Fatal(err.Error()) } }

func main() { accountName, ok := os.LookupEnv("AZURE_STORAGE_ACCOUNT_NAME") if !ok { panic("AZURE_STORAGE_ACCOUNT_NAME could not be found") } serviceURL := fmt.Sprintf("https://%s.blob.core.windows.net/", accountName)

cred, err := azidentity.NewDefaultAzureCredential(nil)
handleError(err)
serviceClient, err := service.NewClient(serviceURL, cred, nil)
handleError(err)
fmt.Println(serviceClient.URL())

}

package main

import ( "fmt" "log" "os"

"github.com/Azure/azure-sdk-for-go/sdk/storage/azblob/service"

)

func handleError(err error) { if err != nil { log.Fatal(err.Error()) } }

func main() { // Your connection string can be obtained from the Azure Portal. connectionString, ok := os.LookupEnv("AZURE_STORAGE_CONNECTION_STRING") if !ok { log.Fatal("the environment variable 'AZURE_STORAGE_CONNECTION_STRING' could not be found") }

serviceClient, err := service.NewClientFromConnectionString(connectionString, nil)
handleError(err)
fmt.Println(serviceClient.URL())

}

package main

import ( "fmt" "log" "os"

"github.com/Azure/azure-sdk-for-go/sdk/storage/azblob/service"

)

func handleError(err error) { if err != nil { log.Fatal(err.Error()) } }

func main() { accountName, ok := os.LookupEnv("AZURE_STORAGE_ACCOUNT_NAME") if !ok { panic("AZURE_STORAGE_ACCOUNT_NAME could not be found") } sharedAccessSignature, ok := os.LookupEnv("AZURE_STORAGE_SHARED_ACCESS_SIGNATURE") if !ok { panic("AZURE_STORAGE_SHARED_ACCESS_SIGNATURE could not be found") } serviceURL := fmt.Sprintf("https://%s.blob.core.windows.net/?%s", accountName, sharedAccessSignature)

serviceClient, err := service.NewClientWithNoCredential(serviceURL, nil)
handleError(err)
fmt.Println(serviceClient.URL())

}

package main

import ( "fmt" "log" "os"

"github.com/Azure/azure-sdk-for-go/sdk/storage/azblob/service"

)

func handleError(err error) { if err != nil { log.Fatal(err.Error()) } }

func main() { accountName, ok := os.LookupEnv("AZURE_STORAGE_ACCOUNT_NAME") if !ok { panic("AZURE_STORAGE_ACCOUNT_NAME could not be found") } accountKey, ok := os.LookupEnv("AZURE_STORAGE_ACCOUNT_KEY") if !ok { panic("AZURE_STORAGE_ACCOUNT_KEY could not be found") } serviceURL := fmt.Sprintf("https://%s.blob.core.windows.net/", accountName)

cred, err := service.NewSharedKeyCredential(accountName, accountKey)
handleError(err)
serviceClient, err := service.NewClientWithSharedKeyCredential(serviceURL, cred, nil)
handleError(err)
fmt.Println(serviceClient.URL())

}

package main

import ( "context" "fmt" "log" "os" "time"

"github.com/Azure/azure-sdk-for-go/sdk/azcore"
"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/storage/azblob/blob"
"github.com/Azure/azure-sdk-for-go/sdk/storage/azblob/sas"
"github.com/Azure/azure-sdk-for-go/sdk/storage/azblob/service"

)

func handleError(err error) { if err != nil { log.Fatal(err.Error()) } }

func main() { accountName, ok := os.LookupEnv("AZURE_STORAGE_ACCOUNT_NAME") if !ok { panic("AZURE_STORAGE_ACCOUNT_NAME could not be found") } const containerName = "testContainer"

// Create Managed Identity (OAuth) Credentials using Client ID
clientOptions := azcore.ClientOptions{} // Fill clientOptions as needed
optsClientID := azidentity.ManagedIdentityCredentialOptions{ClientOptions: clientOptions, ID: azidentity.ClientID("7cf7db0d-...")}
cred, err := azidentity.NewManagedIdentityCredential(&optsClientID)
handleError(err)
clientOptionsService := service.ClientOptions{} // Same as azcore.ClientOptions using service instead

svcClient, err := service.NewClient(fmt.Sprintf("https://%s.blob.core.windows.net/", accountName), cred, &clientOptionsService)
handleError(err)

// Set current and past time and create key
currentTime := time.Now().UTC().Add(-10 * time.Second)
pastTime := currentTime.Add(48 * time.Hour)
info := service.KeyInfo{
    Start:  to.Ptr(currentTime.UTC().Format(sas.TimeFormat)),
    Expiry: to.Ptr(pastTime.UTC().Format(sas.TimeFormat)),
}

udc, err := svcClient.GetUserDelegationCredential(context.Background(), info, nil)
handleError(err)

fmt.Println("User Delegation Key has been created for ", accountName)

// Create Blob Signature Values with desired permissions and sign with user delegation credential
sasQueryParams, err := sas.BlobSignatureValues{
    Protocol:      sas.ProtocolHTTPS,
    StartTime:     time.Now().UTC().Add(time.Second * -10),
    ExpiryTime:    time.Now().UTC().Add(15 * time.Minute),
    Permissions:   to.Ptr(sas.ContainerPermissions{Read: true, List: true}).String(),
    ContainerName: containerName,
}.SignWithUserDelegation(udc)
handleError(err)

sasURL := fmt.Sprintf("https://%s.blob.core.windows.net/?%s", accountName, sasQueryParams.Encode())

// This URL can be used to authenticate requests now
serviceClient, err := service.NewClientWithNoCredential(sasURL, nil)
handleError(err)

// You can also break a blob URL up into it's constituent parts
blobURLParts, _ := blob.ParseURL(serviceClient.URL())
fmt.Printf("SAS expiry time = %s\n", blobURLParts.SAS.ExpiryTime())

// Create Managed Identity (OAuth) Credentials using Resource ID
optsResourceID := azidentity.ManagedIdentityCredentialOptions{ClientOptions: clientOptions, ID: azidentity.ResourceID("/subscriptions/...")}
cred, err = azidentity.NewManagedIdentityCredential(&optsResourceID)
handleError(err)

svcClient, err = service.NewClient(fmt.Sprintf("https://%s.blob.core.windows.net/", accountName), cred, &clientOptionsService)
handleError(err)

udc, err = svcClient.GetUserDelegationCredential(context.Background(), info, nil)
handleError(err)
fmt.Println("User Delegation Key has been created for ", accountName)

// Create Blob Signature Values with desired permissions and sign with user delegation credential
sasQueryParams, err = sas.BlobSignatureValues{
    Protocol:      sas.ProtocolHTTPS,
    StartTime:     time.Now().UTC().Add(time.Second * -10),
    ExpiryTime:    time.Now().UTC().Add(15 * time.Minute),
    Permissions:   to.Ptr(sas.ContainerPermissions{Read: true, List: true}).String(),
    ContainerName: containerName,
}.SignWithUserDelegation(udc)
handleError(err)

sasURL = fmt.Sprintf("https://%s.blob.core.windows.net/?%s", accountName, sasQueryParams.Encode())

// This URL can be used to authenticate requests now
serviceClient, err = service.NewClientWithNoCredential(sasURL, nil)
handleError(err)

// You can also break a blob URL up into it's constituent parts
blobURLParts, _ = blob.ParseURL(serviceClient.URL())
fmt.Printf("SAS expiry time = %s\n", blobURLParts.SAS.ExpiryTime())

}

package main

import ( "context" "fmt" "log" "os"

"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/storage/azblob/service"

)

func handleError(err error) { if err != nil { log.Fatal(err.Error()) } }

func main() { accountName, ok := os.LookupEnv("AZURE_STORAGE_ACCOUNT_NAME") if !ok { panic("AZURE_STORAGE_ACCOUNT_NAME could not be found") } serviceURL := fmt.Sprintf("https://%s.blob.core.windows.net/", accountName)

cred, err := azidentity.NewDefaultAzureCredential(nil)
handleError(err)
serviceClient, err := service.NewClient(serviceURL, cred, nil)
handleError(err)

listOptions := service.ListContainersOptions{
    Include: service.ListContainersInclude{
        Metadata: true, // Include Metadata
        Deleted:  true, // Include deleted containers in the result as well
    },
}
pager := serviceClient.NewListContainersPager(&listOptions)

for pager.More() {
    resp, err := pager.NextPage(context.TODO())
    if err != nil {
        log.Fatal(err)
    }
    for _, cont := range resp.ContainerItems {
        if *cont.Deleted {
            _, err = serviceClient.RestoreContainer(context.TODO(), *cont.Name, *cont.Version, nil)
            handleError(err)
        }
    }
}

}

package main

import ( "context" "fmt" "log" "os"

"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/storage/azblob/service"

)

func handleError(err error) { if err != nil { log.Fatal(err.Error()) } }

func main() { accountName, ok := os.LookupEnv("AZURE_STORAGE_ACCOUNT_NAME") if !ok { panic("AZURE_STORAGE_ACCOUNT_NAME could not be found") } serviceURL := fmt.Sprintf("https://%s.blob.core.windows.net/", accountName)

cred, err := azidentity.NewDefaultAzureCredential(nil)
handleError(err)
serviceClient, err := service.NewClient(serviceURL, cred, nil)
handleError(err)

enabled := true  // enabling retention period
days := int32(5) // setting retention period to 5 days
serviceSetPropertiesResponse, err := serviceClient.SetProperties(context.TODO(), &service.SetPropertiesOptions{
    DeleteRetentionPolicy: &service.RetentionPolicy{Enabled: &enabled, Days: &days},
})

handleError(err)
fmt.Println(serviceSetPropertiesResponse)

}

This example shows how to create and use an Azure Storage account Shared Access Signature (SAS).

package main

import ( "fmt" "log" "os" "time"

"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
"github.com/Azure/azure-sdk-for-go/sdk/storage/azblob"
"github.com/Azure/azure-sdk-for-go/sdk/storage/azblob/blob"
"github.com/Azure/azure-sdk-for-go/sdk/storage/azblob/sas"
"github.com/Azure/azure-sdk-for-go/sdk/storage/azblob/service"

)

func handleError(err error) { if err != nil { log.Fatal(err.Error()) } }

func main() { accountName, accountKey := os.Getenv("AZURE_STORAGE_ACCOUNT_NAME"), os.Getenv("AZURE_STORAGE_ACCOUNT_KEY")

credential, err := azblob.NewSharedKeyCredential(accountName, accountKey)
handleError(err)

sasQueryParams, err := sas.AccountSignatureValues{
    Protocol:      sas.ProtocolHTTPS,
    ExpiryTime:    time.Now().UTC().Add(48 * time.Hour),
    Permissions:   to.Ptr(sas.AccountPermissions{Read: true, List: true}).String(),
    ResourceTypes: to.Ptr(sas.AccountResourceTypes{Container: true, Object: true}).String(),
}.SignWithSharedKey(credential)
handleError(err)

sasURL := fmt.Sprintf("https://%s.blob.core.windows.net/?%s", accountName, sasQueryParams.Encode())

// This URL can be used to authenticate requests now
serviceClient, err := service.NewClientWithNoCredential(sasURL, nil)
handleError(err)

// You can also break a blob URL up into it's constituent parts
blobURLParts, _ := blob.ParseURL(serviceClient.URL())
fmt.Printf("SAS expiry time = %s\n", blobURLParts.SAS.ExpiryTime())

}

View Source

const (

ContainerNameRoot = "$root"


ContainerNameLogs = "$logs"

)

This section is empty.

This section is empty.

AccessConditions identifies container-specific access conditions which you optionally set.

AccountKind defines values for AccountKind

func PossibleAccountKindValues() []AccountKind

PossibleAccountKindValues returns the possible values for the AccountKind const type.

type BatchBuilder struct {

}

BatchBuilder is used for creating the batch operations list. It contains the list of either delete or set tier sub-requests. NOTE: All sub-requests in the batch must be of the same type, either delete or set tier.

Delete operation is used to add delete sub-request to the batch builder.

SetTier operation is used to add set tier sub-request to the batch builder.

BatchDeleteOptions contains the optional parameters for the BatchBuilder.Delete method.

BatchResponseItem contains the response for the individual sub-requests.

BatchSetTierOptions contains the optional parameters for the BatchBuilder.SetTier method.

BlobGeoReplicationStatus - The status of the secondary location

func PossibleBlobGeoReplicationStatusValues() []BlobGeoReplicationStatus

PossibleBlobGeoReplicationStatusValues returns the possible values for the BlobGeoReplicationStatus const type.

BlobTag - a key/value pair on a blob

CORSRule - CORS is an HTTP feature that enables a web application running under one domain to access resources in another domain. Web browsers implement a security restriction known as same-origin policy that prevents a web page from calling APIs in a different domain; CORS provides a secure way to allow one domain (the origin domain) to call APIs in another domain.

CPKInfo contains a group of parameters for the BlobClient.Download method.

CPKScopeInfo contains a group of parameters for the BlobClient.SetMetadata method.

Client represents a URL to the Azure Blob Storage service allowing you to manipulate blob containers.

NewClient creates an instance of Client with the specified values.

func NewClientFromConnectionString(connectionString string, options ClientOptions) (Client, error)

NewClientFromConnectionString creates an instance of Client with the specified values.

func NewClientWithNoCredential(serviceURL string, options ClientOptions) (Client, error)

NewClientWithNoCredential creates an instance of Client with the specified values. This is used to anonymously access a storage account or with a shared access signature (SAS) token.

func NewClientWithSharedKeyCredential(serviceURL string, cred *SharedKeyCredential, options ClientOptions) (Client, error)

NewClientWithSharedKeyCredential creates an instance of Client with the specified values.

CreateContainer is a lifecycle method to creates a new container under the specified account. If the container with the same name already exists, a ResourceExistsError will be raised. This method returns a client with which to interact with the newly created container.

DeleteContainer is a lifecycle method that marks the specified container for deletion. The container and any blobs contained within it are later deleted during garbage collection. If the container is not found, a ResourceNotFoundError will be raised.

FilterBlobs operation finds all blobs in the storage account whose tags match a given search expression. Filter blobs searches across all containers within a storage account but can be scoped within the expression to a single container.https://docs.microsoft.com/en-us/rest/api/storageservices/find-blobs-by-tagseg. "dog='germanshepherd' and penguin='emperorpenguin'" To specify a container, eg. "@container=’containerName’ and Name = ‘C’"

GetProperties - gets the properties of a storage account's Blob service, including properties for Storage Analytics and CORS (Cross-Origin Resource Sharing) rules.

GetSASURL is a convenience method for generating a SAS token for the currently pointed at account. It can only be used if the credential supplied during creation was a SharedKeyCredential.

GetStatistics Retrieves statistics related to replication for the Blob service. It is only available when read-access geo-redundant replication is enabled for the storage account. With geo-redundant replication, Azure Storage maintains your data durable in two locations. In both locations, Azure Storage constantly maintains multiple healthy replicas of your data. The location where you read, create, update, or delete data is the primary storage account location. The primary location exists in the region you choose at the time you create an account via the Azure Management Azure classic portal, for example, North Central US. The location to which your data is replicated is the secondary location. The secondary location is automatically determined based on the location of the primary; it is in a second data center that resides in the same region as the primary location. Read-only access is available from the secondary location, if read-access geo-redundant replication is enabled for your storage account.

GetUserDelegationCredential obtains a UserDelegationKey object using the base ServiceURL object. OAuth is required for this call, as well as any role that can delegate access to the storage account.

func (s Client) NewBatchBuilder() (BatchBuilder, error)

NewBatchBuilder creates an instance of BatchBuilder using the same auth policy as the client. BatchBuilder is used to build the batch consisting of either delete or set tier sub-requests. All sub-requests in the batch must be of the same type, either delete or set tier. NOTE: Service level Blob Batch operation is supported only when the Client was created using SharedKeyCredential and Account SAS.

NewContainerClient creates a new container.Client object by concatenating containerName to the end of this Client's URL. The new container.Client uses the same request policy pipeline as the Client.

RestoreContainer restores soft-deleted container Operation will only be successful if used within the specified number of days set in the delete retention policy

SetProperties Sets the properties of a storage account's Blob service, including Azure Storage Analytics. If an element (e.g. analytics_logging) is left as None, the existing settings on the service for that functionality are preserved.

SubmitBatch operation allows multiple API calls to be embedded into a single HTTP request. It builds the request body using the BatchBuilder object passed. BatchBuilder contains the list of operations to be submitted. It supports up to 256 sub-requests in a single batch. For more information, see https://docs.microsoft.com/rest/api/storageservices/blob-batch.

URL returns the URL endpoint used by the Client object.

ClientOptions contains the optional parameters when creating a Client.

ContainerItem - An Azure Storage container returned from method Client.ListContainersSegment.

ContainerProperties - Properties of a container

CreateContainerOptions contains the optional parameters for the container.Client.Create method.

CreateContainerResponse contains the response from method container.Client.Create.

DeleteContainerOptions contains the optional parameters for the container.Client.Delete method.

DeleteContainerResponse contains the response from method container.Client.Delete

FilterBlobItem - Blob info returned from method Client.FilterBlobs.

FilterBlobSegment - The result of a Filter Blobs API call.

type FilterBlobsOptions struct {

Marker *[string](/builtin#string)


MaxResults *[int32](/builtin#int32)

}

FilterBlobsOptions provides set of options for Client.FindBlobsByTags.

FilterBlobsResponse contains the response from method Client.FilterBlobs.

GeoReplication - Geo-Replication information for the Secondary Storage Service.

type GetAccountInfoOptions struct { }

GetAccountInfoOptions provides set of options for Client.GetAccountInfo

GetAccountInfoResponse contains the response from method Client.GetAccountInfo.

type GetPropertiesOptions struct { }

GetPropertiesOptions contains the optional parameters for the Client.GetProperties method.

GetPropertiesResponse contains the response from method Client.GetProperties.

type GetSASURLOptions struct { StartTime *time.Time }

GetSASURLOptions contains the optional parameters for the Client.GetSASURL method.

type GetStatisticsOptions struct { }

GetStatisticsOptions provides set of options for Client.GetStatistics

GetStatisticsResponse contains the response from method Client.GetStatistics.

type GetUserDelegationCredentialOptions struct { }

GetUserDelegationCredentialOptions contains optional parameters for Service.GetUserDelegationKey method.

GetUserDelegationKeyResponse contains the response from method ServiceClient.GetUserDelegationKey.

KeyInfo contains KeyInfo struct.

type ListContainersInclude struct {

Metadata [bool](/builtin#bool)


Deleted [bool](/builtin#bool)


System [bool](/builtin#bool)

}

ListContainersInclude indicates what additional information the service should return with each container.

ListContainersIncludeType defines values for ListContainersIncludeType

func PossibleListContainersIncludeTypeValues() []ListContainersIncludeType

PossibleListContainersIncludeTypeValues returns the possible values for the ListContainersIncludeType const type.

ListContainersOptions provides set of configurations for ListContainers operation.

ListContainersResponse contains the response from method Client.ListContainersSegment.

ListContainersSegmentResponse - An enumeration of containers

Logging - Azure Analytics Logging settings.

Metrics - a summary of request statistics grouped by API in hour or minute aggregates for blobs.

PublicAccessType defines values for AccessType - private (default) or blob or container

func PossiblePublicAccessTypeValues() []PublicAccessType

PossiblePublicAccessTypeValues returns the possible values for the PublicAccessType const type.

RestoreContainerOptions contains the optional parameters for the container.Client.Restore method.

RestoreContainerResponse contains the response from method container.Client.Restore

RetentionPolicy - the retention policy which determines how long the associated data should persist.

SKUName defines values for SkuName - LRS, GRS, RAGRS, ZRS, Premium LRS

func PossibleSKUNameValues() []SKUName

PossibleSKUNameValues returns the possible values for the SKUName const type.

type SetPropertiesOptions struct {

CORS []*[CORSRule](#CORSRule)


DefaultServiceVersion *[string](/builtin#string)


DeleteRetentionPolicy *[RetentionPolicy](#RetentionPolicy)


HourMetrics *[Metrics](#Metrics)


Logging *[Logging](#Logging)


MinuteMetrics *[Metrics](#Metrics)


StaticWebsite *[StaticWebsite](#StaticWebsite)

}

SetPropertiesOptions provides set of options for Client.SetProperties

SetPropertiesResponse contains the response from method Client.SetProperties.

SharedKeyCredential contains an account's name and its primary or secondary key.

func NewSharedKeyCredential(accountName, accountKey string) (*SharedKeyCredential, error)

NewSharedKeyCredential creates an immutable SharedKeyCredential containing the storage account's name and either its primary or secondary key.

StaticWebsite - The properties that enable an account to host a static website.

StorageServiceProperties - Storage Service Properties.

StorageServiceStats - Stats for the storage service.

type SubmitBatchOptions struct { }

SubmitBatchOptions contains the optional parameters for the Client.SubmitBatch method.

type SubmitBatchResponse struct {

Responses []*[BatchResponseItem](#BatchResponseItem)


ContentType *[string](/builtin#string)


RequestID *[string](/builtin#string)


Version *[string](/builtin#string)

}

SubmitBatchResponse contains the response from method Client.SubmitBatch.

UserDelegationCredential contains an account's name and its user delegation key.

UserDelegationKey contains UserDelegationKey.