Documentation
¶
Overview ¶
Example (Container_ClientCreate) ¶
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" ) 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") } containerName := "testcontainer" containerURL := fmt.Sprintf("https://%s.blob.core.windows.net/%s", accountName, containerName) cred, err := azidentity.NewDefaultAzureCredential(nil) handleError(err) containerClient, err := container.NewClient(containerURL, cred, nil) handleError(err) containerCreateResponse, err := containerClient.Create(context.TODO(), &container.CreateOptions{ Metadata: map[string]string{"Foo": "Bar"}, }) handleError(err) fmt.Println(containerCreateResponse) }
Output:
Example (Container_ClientDelete) ¶
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" ) 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") } containerName := "testcontainer" containerURL := fmt.Sprintf("https://%s.blob.core.windows.net/%s", accountName, containerName) cred, err := azidentity.NewDefaultAzureCredential(nil) handleError(err) containerClient, err := container.NewClient(containerURL, cred, nil) handleError(err) containerDeleteResponse, err := containerClient.Delete(context.TODO(), nil) handleError(err) fmt.Println(containerDeleteResponse) }
Output:
Example (Container_ClientGetSASURL) ¶
package main import ( "fmt" "log" "os" "time" "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/sas" ) 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") } containerName := "testcontainer" containerURL := fmt.Sprintf("https://%s.blob.core.windows.net/%s", accountName, containerName) cred, err := azidentity.NewDefaultAzureCredential(nil) handleError(err) containerClient, err := container.NewClient(containerURL, cred, nil) handleError(err) permission := sas.ContainerPermissions{Read: true} start := time.Now() expiry := start.AddDate(1, 0, 0) sasURL, err := containerClient.GetSASURL(permission, start, expiry) handleError(err) _ = sasURL }
Output:
Example (Container_ClientListBlobsFlat) ¶
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" ) 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") } containerName := "testcontainer" containerURL := fmt.Sprintf("https://%s.blob.core.windows.net/%s", accountName, containerName) cred, err := azidentity.NewDefaultAzureCredential(nil) handleError(err) containerClient, err := container.NewClient(containerURL, cred, nil) handleError(err) pager := containerClient.NewListBlobsFlatPager(&container.ListBlobsFlatOptions{ Include: container.ListBlobsInclude{Snapshots: true, Versions: true}, }) for pager.More() { resp, err := pager.NextPage(context.TODO()) if err != nil { log.Fatal(err) } for _, blob := range resp.Segment.BlobItems { fmt.Println(*blob.Name) } } }
Output:
Example (Container_ClientListBlobsHierarchy) ¶
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" ) 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") } containerName := "testcontainer" containerURL := fmt.Sprintf("https://%s.blob.core.windows.net/%s", accountName, containerName) cred, err := azidentity.NewDefaultAzureCredential(nil) handleError(err) containerClient, err := container.NewClient(containerURL, cred, nil) handleError(err) maxResults := int32(5) pager := containerClient.NewListBlobsHierarchyPager("/", &container.ListBlobsHierarchyOptions{ Include: container.ListBlobsInclude{Metadata: true, Tags: true}, MaxResults: &maxResults, }) for pager.More() { resp, err := pager.NextPage(context.TODO()) if err != nil { log.Fatal(err) } for _, blob := range resp.ListBlobsHierarchySegmentResponse.Segment.BlobItems { fmt.Println(*blob.Name) } } }
Output:
Example (Container_ClientNewAppendBlobClient) ¶
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/container" ) 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") } containerName := "testcontainer" containerURL := fmt.Sprintf("https://%s.blob.core.windows.net/%s", accountName, containerName) cred, err := azidentity.NewDefaultAzureCredential(nil) handleError(err) containerClient, err := container.NewClient(containerURL, cred, nil) handleError(err) appendBlobClient := containerClient.NewAppendBlobClient("test_append_blob") handleError(err) fmt.Println(appendBlobClient.URL()) }
Output:
Example (Container_ClientNewBlobClient) ¶
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/container" ) 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") } containerName := "testcontainer" containerURL := fmt.Sprintf("https://%s.blob.core.windows.net/%s", accountName, containerName) cred, err := azidentity.NewDefaultAzureCredential(nil) handleError(err) containerClient, err := container.NewClient(containerURL, cred, nil) handleError(err) blobClient := containerClient.NewBlobClient("test_blob") handleError(err) fmt.Println(blobClient.URL()) }
Output:
Example (Container_ClientNewBlockBlobClient) ¶
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/container" ) 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") } containerName := "testcontainer" containerURL := fmt.Sprintf("https://%s.blob.core.windows.net/%s", accountName, containerName) cred, err := azidentity.NewDefaultAzureCredential(nil) handleError(err) containerClient, err := container.NewClient(containerURL, cred, nil) handleError(err) blockBlobClient := containerClient.NewBlockBlobClient("test_block_blob") handleError(err) fmt.Println(blockBlobClient.URL()) }
Output:
Example (Container_ClientNewPageBlobClient) ¶
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/container" ) 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") } containerName := "testcontainer" containerURL := fmt.Sprintf("https://%s.blob.core.windows.net/%s", accountName, containerName) cred, err := azidentity.NewDefaultAzureCredential(nil) handleError(err) containerClient, err := container.NewClient(containerURL, cred, nil) handleError(err) pageBlobClient := containerClient.NewPageBlobClient("test_page_blob") handleError(err) fmt.Println(pageBlobClient.URL()) }
Output:
Example (Container_ClientSetAccessPolicy) ¶
This example shows how to manipulate a container's permissions.
package main import ( "bytes" "context" "fmt" "io" "log" "net/http" "os" "strings" "github.com/Azure/azure-sdk-for-go/sdk/azcore/streaming" "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/container" ) 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") } containerName := "testcontainer" containerURL := fmt.Sprintf("https://%s.blob.core.windows.net/%s", accountName, containerName) cred, err := azidentity.NewDefaultAzureCredential(nil) handleError(err) containerClient, err := container.NewClient(containerURL, cred, nil) handleError(err) // Create the container _, err = containerClient.Create(context.TODO(), nil) handleError(err) // Upload a simple blob. blockBlobClient := containerClient.NewBlockBlobClient("HelloWorld.txt") handleError(err) _, err = blockBlobClient.Upload(context.TODO(), streaming.NopCloser(strings.NewReader("Hello World!")), nil) handleError(err) // Attempt to read the blob get, err := http.Get(blockBlobClient.URL()) handleError(err) if get.StatusCode == http.StatusNotFound { // ChangeLease the blob to be public access blob _, err := containerClient.SetAccessPolicy( context.TODO(), nil, &container.SetAccessPolicyOptions{ Access: to.Ptr(container.PublicAccessTypeBlob), }, ) if err != nil { log.Fatal(err) } // Now, this works get, err = http.Get(blockBlobClient.URL()) if err != nil { log.Fatal(err) } var text bytes.Buffer _, err = text.ReadFrom(get.Body) if err != nil { return } defer func(Body io.ReadCloser) { _ = Body.Close() }(get.Body) fmt.Println("Public access blob data: ", text.String()) } }
Output:
Example (Container_ClientSetMetadata) ¶
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" ) 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") } containerName := "testcontainer" containerURL := fmt.Sprintf("https://%s.blob.core.windows.net/%s", accountName, containerName) cred, err := azidentity.NewDefaultAzureCredential(nil) handleError(err) containerClient, err := container.NewClient(containerURL, cred, nil) handleError(err) // Create a container with some metadata, key names are converted to lowercase before being sent to the service. // You should always use lowercase letters, especially when querying a map for a metadata key. creatingApp, err := os.Executable() handleError(err) _, err = containerClient.Create(context.TODO(), &container.CreateOptions{Metadata: map[string]string{"author": "azblob", "app": creatingApp}}) handleError(err) // Query the container's metadata containerGetPropertiesResponse, err := containerClient.GetProperties(context.TODO(), nil) handleError(err) if containerGetPropertiesResponse.Metadata == nil { log.Fatal("metadata is empty!") } for k, v := range containerGetPropertiesResponse.Metadata { fmt.Printf("%s=%s\n", k, v) } // Update the metadata and write it back to the container containerGetPropertiesResponse.Metadata["author"] = "Mohit" _, err = containerClient.SetMetadata(context.TODO(), &container.SetMetadataOptions{Metadata: containerGetPropertiesResponse.Metadata}) handleError(err) // NOTE: SetMetadata & SetProperties methods update the container's ETag & LastModified properties }
Output:
Example (Container_NewClient) ¶
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/container" ) 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") } containerName := "testcontainer" containerURL := fmt.Sprintf("https://%s.blob.core.windows.net/%s", accountName, containerName) cred, err := azidentity.NewDefaultAzureCredential(nil) handleError(err) containerClient, err := container.NewClient(containerURL, cred, nil) handleError(err) fmt.Println(containerClient.URL()) }
Output:
Example (Container_NewClientFromConnectionString) ¶
package main import ( "fmt" "log" "os" "github.com/Azure/azure-sdk-for-go/sdk/storage/azblob/container" ) 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") } containerName := "testcontainer" containerClient, err := container.NewClientFromConnectionString(connectionString, containerName, nil) handleError(err) fmt.Println(containerClient.URL()) }
Output:
Example (Container_NewClientWithNoCredential) ¶
package main import ( "fmt" "log" "os" "github.com/Azure/azure-sdk-for-go/sdk/storage/azblob/container" ) 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") } containerName := "testcontainer" containerURL := fmt.Sprintf("https://%s.blob.core.windows.net/%s?%s", accountName, containerName, sharedAccessSignature) containerClient, err := container.NewClientWithNoCredential(containerURL, nil) handleError(err) fmt.Println(containerClient.URL()) }
Output:
Index ¶
- type AccessConditions
- type AccessPolicy
- type AccessPolicyPermission
- type AccountKind
- type ArchiveStatus
- type BlobItem
- type BlobProperties
- type BlobType
- type Client
- func NewClient(containerURL string, cred azcore.TokenCredential, options *ClientOptions) (*Client, error)
- func NewClientFromConnectionString(connectionString string, containerName string, options *ClientOptions) (*Client, error)
- func NewClientWithNoCredential(containerURL string, options *ClientOptions) (*Client, error)
- func NewClientWithSharedKeyCredential(containerURL string, cred *SharedKeyCredential, options *ClientOptions) (*Client, error)
- func (c *Client) Create(ctx context.Context, options *CreateOptions) (CreateResponse, error)
- func (c *Client) Delete(ctx context.Context, options *DeleteOptions) (DeleteResponse, error)
- func (c *Client) GetAccessPolicy(ctx context.Context, o *GetAccessPolicyOptions) (GetAccessPolicyResponse, error)
- func (c *Client) GetProperties(ctx context.Context, o *GetPropertiesOptions) (GetPropertiesResponse, error)
- func (c *Client) GetSASURL(permissions sas.ContainerPermissions, start time.Time, expiry time.Time) (string, error)
- func (c *Client) NewAppendBlobClient(blobName string) *appendblob.Client
- func (c *Client) NewBlobClient(blobName string) *blob.Client
- func (c *Client) NewBlockBlobClient(blobName string) *blockblob.Client
- func (c *Client) NewListBlobsFlatPager(o *ListBlobsFlatOptions) *runtime.Pager[ListBlobsFlatResponse]
- func (c *Client) NewListBlobsHierarchyPager(delimiter string, o *ListBlobsHierarchyOptions) *runtime.Pager[ListBlobsHierarchyResponse]
- func (c *Client) NewPageBlobClient(blobName string) *pageblob.Client
- func (c *Client) Restore(ctx context.Context, deletedContainerVersion string, options *RestoreOptions) (RestoreResponse, error)
- func (c *Client) SetAccessPolicy(ctx context.Context, containerACL []*SignedIdentifier, ...) (SetAccessPolicyResponse, error)
- func (c *Client) SetMetadata(ctx context.Context, o *SetMetadataOptions) (SetMetadataResponse, error)
- func (c *Client) URL() string
- type ClientOptions
- type CopyStatusType
- type CpkScopeInfo
- type CreateOptions
- type CreateResponse
- type DeleteOptions
- type DeleteResponse
- type GetAccessPolicyOptions
- type GetAccessPolicyResponse
- type GetPropertiesOptions
- type GetPropertiesResponse
- type ImmutabilityPolicyMode
- type LeaseAccessConditions
- type LeaseDurationType
- type LeaseStateType
- type LeaseStatusType
- type ListBlobsFlatOptions
- type ListBlobsFlatResponse
- type ListBlobsHierarchyOptions
- type ListBlobsHierarchyResponse
- type ListBlobsInclude
- type ModifiedAccessConditions
- type PublicAccessType
- type RehydratePriority
- type RestoreOptions
- type RestoreResponse
- type SKUName
- type SetAccessPolicyOptions
- type SetAccessPolicyResponse
- type SetMetadataOptions
- type SetMetadataResponse
- type SharedKeyCredential
- type SignedIdentifier
Examples ¶
- Package (Container_ClientCreate)
- Package (Container_ClientDelete)
- Package (Container_ClientGetSASURL)
- Package (Container_ClientListBlobsFlat)
- Package (Container_ClientListBlobsHierarchy)
- Package (Container_ClientNewAppendBlobClient)
- Package (Container_ClientNewBlobClient)
- Package (Container_ClientNewBlockBlobClient)
- Package (Container_ClientNewPageBlobClient)
- Package (Container_ClientSetAccessPolicy)
- Package (Container_ClientSetMetadata)
- Package (Container_NewClient)
- Package (Container_NewClientFromConnectionString)
- Package (Container_NewClientWithNoCredential)
- Package (Container_NewClientWithSharedKeyCredential)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AccessConditions ¶
type AccessConditions = exported.ContainerAccessConditions
AccessConditions identifies container-specific access conditions which you optionally set.
type AccessPolicyPermission ¶
type AccessPolicyPermission = exported.AccessPolicyPermission
AccessPolicyPermission type simplifies creating the permissions string for a container's access policy. Initialize an instance of this type and then call its String method to set AccessPolicy's Permission field.
type AccountKind ¶
type AccountKind = generated.AccountKind
AccountKind defines values for AccountKind
const ( AccountKindStorage AccountKind = generated.AccountKindStorage AccountKindBlobStorage AccountKind = generated.AccountKindBlobStorage AccountKindStorageV2 AccountKind = generated.AccountKindStorageV2 AccountKindFileStorage AccountKind = generated.AccountKindFileStorage AccountKindBlockBlobStorage AccountKind = generated.AccountKindBlockBlobStorage )
func PossibleAccountKindValues ¶
func PossibleAccountKindValues() []AccountKind
PossibleAccountKindValues returns the possible values for the AccountKind const type.
type ArchiveStatus ¶
type ArchiveStatus = generated.ArchiveStatus
ArchiveStatus defines values for ArchiveStatus
const ( ArchiveStatusRehydratePendingToCool ArchiveStatus = generated.ArchiveStatusRehydratePendingToCool ArchiveStatusRehydratePendingToHot ArchiveStatus = generated.ArchiveStatusRehydratePendingToHot )
func PossibleArchiveStatusValues ¶
func PossibleArchiveStatusValues() []ArchiveStatus
PossibleArchiveStatusValues returns the possible values for the ArchiveStatus const type.
type BlobProperties ¶
type BlobProperties = generated.BlobPropertiesInternal
BlobProperties - Properties of a blob
type BlobType ¶
BlobType defines values for BlobType
const ( BlobTypeBlockBlob BlobType = generated.BlobTypeBlockBlob BlobTypePageBlob BlobType = generated.BlobTypePageBlob BlobTypeAppendBlob BlobType = generated.BlobTypeAppendBlob )
func PossibleBlobTypeValues ¶
func PossibleBlobTypeValues() []BlobType
PossibleBlobTypeValues returns the possible values for the BlobType const type.
type Client ¶
type Client base.Client[generated.ContainerClient]
Client represents a URL to the Azure Storage container allowing you to manipulate its blobs.
func NewClient ¶
func NewClient(containerURL string, cred azcore.TokenCredential, options *ClientOptions) (*Client, error)
NewClient creates an instance of Client with the specified values.
- containerURL - the URL of the container e.g. https://<account>.blob.core.windows.net/container
- cred - an Azure AD credential, typically obtained via the azidentity module
- options - client options; pass nil to accept the default values
func NewClientFromConnectionString ¶
func NewClientFromConnectionString(connectionString string, containerName string, options *ClientOptions) (*Client, error)
NewClientFromConnectionString creates an instance of Client with the specified values.
- connectionString - a connection string for the desired storage account
- containerName - the name of the container within the storage account
- options - client options; pass nil to accept the default values
func NewClientWithNoCredential ¶
func NewClientWithNoCredential(containerURL string, options *ClientOptions) (*Client, error)
NewClientWithNoCredential creates an instance of Client with the specified values. This is used to anonymously access a container or with a shared access signature (SAS) token.
- containerURL - the URL of the container e.g. https://<account>.blob.core.windows.net/container?<sas token>
- options - client options; pass nil to accept the default values
func NewClientWithSharedKeyCredential ¶
func NewClientWithSharedKeyCredential(containerURL string, cred *SharedKeyCredential, options *ClientOptions) (*Client, error)
NewClientWithSharedKeyCredential creates an instance of Client with the specified values.
- containerURL - the URL of the container e.g. https://<account>.blob.core.windows.net/container
- cred - a SharedKeyCredential created with the matching container's storage account and access key
- options - client options; pass nil to accept the default values
func (*Client) Create ¶
func (c *Client) Create(ctx context.Context, options *CreateOptions) (CreateResponse, error)
Create creates a new container within a storage account. If a container with the same name already exists, the operation fails. For more information, see https://docs.microsoft.com/rest/api/storageservices/create-container.
func (*Client) Delete ¶
func (c *Client) Delete(ctx context.Context, options *DeleteOptions) (DeleteResponse, error)
Delete marks the specified container for deletion. The container and any blobs contained within it are later deleted during garbage collection. For more information, see https://docs.microsoft.com/rest/api/storageservices/delete-container.
func (*Client) GetAccessPolicy ¶
func (c *Client) GetAccessPolicy(ctx context.Context, o *GetAccessPolicyOptions) (GetAccessPolicyResponse, error)
GetAccessPolicy returns the container's access policy. The access policy indicates whether container's blobs may be accessed publicly. For more information, see https://docs.microsoft.com/rest/api/storageservices/get-container-acl.
func (*Client) GetProperties ¶
func (c *Client) GetProperties(ctx context.Context, o *GetPropertiesOptions) (GetPropertiesResponse, error)
GetProperties returns the container's properties. For more information, see https://docs.microsoft.com/rest/api/storageservices/get-container-metadata.
func (*Client) GetSASURL ¶
func (c *Client) GetSASURL(permissions sas.ContainerPermissions, start time.Time, expiry time.Time) (string, error)
GetSASURL is a convenience method for generating a SAS token for the currently pointed at container. It can only be used if the credential supplied during creation was a SharedKeyCredential.
func (*Client) NewAppendBlobClient ¶
func (c *Client) NewAppendBlobClient(blobName string) *appendblob.Client
NewAppendBlobClient creates a new AppendBlobURL object by concatenating blobName to the end of Client's URL. The new AppendBlobURL uses the same request policy pipeline as the Client. To change the pipeline, create the AppendBlobURL and then call its WithPipeline method passing in the desired pipeline object. Or, call this package's NewAppendBlobClient instead of calling this object's NewAppendBlobClient method.
func (*Client) NewBlobClient ¶
NewBlobClient creates a new BlobClient object by concatenating blobName to the end of Client's URL. The new BlobClient uses the same request policy pipeline as the Client. To change the pipeline, create the BlobClient and then call its WithPipeline method passing in the desired pipeline object. Or, call this package's NewBlobClient instead of calling this object's NewBlobClient method.
func (*Client) NewBlockBlobClient ¶
NewBlockBlobClient creates a new BlockBlobClient object by concatenating blobName to the end of Client's URL. The new BlockBlobClient uses the same request policy pipeline as the Client. To change the pipeline, create the BlockBlobClient and then call its WithPipeline method passing in the desired pipeline object. Or, call this package's NewBlockBlobClient instead of calling this object's NewBlockBlobClient method.
func (*Client) NewListBlobsFlatPager ¶
func (c *Client) NewListBlobsFlatPager(o *ListBlobsFlatOptions) *runtime.Pager[ListBlobsFlatResponse]
NewListBlobsFlatPager returns a pager for blobs starting from the specified Marker. Use an empty Marker to start enumeration from the beginning. Blob names are returned in lexicographic order. For more information, see https://docs.microsoft.com/rest/api/storageservices/list-blobs.
func (*Client) NewListBlobsHierarchyPager ¶
func (c *Client) NewListBlobsHierarchyPager(delimiter string, o *ListBlobsHierarchyOptions) *runtime.Pager[ListBlobsHierarchyResponse]
NewListBlobsHierarchyPager returns a channel of blobs starting from the specified Marker. Use an empty Marker to start enumeration from the beginning. Blob names are returned in lexicographic order. After getting a segment, process it, and then call ListBlobsHierarchicalSegment again (passing the the previously-returned Marker) to get the next segment. For more information, see https://docs.microsoft.com/rest/api/storageservices/list-blobs. AutoPagerTimeout specifies the amount of time with no read operations before the channel times out and closes. Specify no time and it will be ignored. AutoPagerBufferSize specifies the channel's buffer size. Both the blob item channel and error channel should be watched. Only one error will be released via this channel (or a nil error, to register a clean exit.)
func (*Client) NewPageBlobClient ¶
NewPageBlobClient creates a new PageBlobURL object by concatenating blobName to the end of Client's URL. The new PageBlobURL uses the same request policy pipeline as the Client. To change the pipeline, create the PageBlobURL and then call its WithPipeline method passing in the desired pipeline object. Or, call this package's NewPageBlobClient instead of calling this object's NewPageBlobClient method.
func (*Client) Restore ¶
func (c *Client) Restore(ctx context.Context, deletedContainerVersion string, options *RestoreOptions) (RestoreResponse, error)
Restore operation restore the contents and properties of a soft deleted container to a specified container. For more information, see https://docs.microsoft.com/en-us/rest/api/storageservices/restore-container.
func (*Client) SetAccessPolicy ¶
func (c *Client) SetAccessPolicy(ctx context.Context, containerACL []*SignedIdentifier, o *SetAccessPolicyOptions) (SetAccessPolicyResponse, error)
SetAccessPolicy sets the container's permissions. The access policy indicates whether blobs in a container may be accessed publicly. For more information, see https://docs.microsoft.com/rest/api/storageservices/set-container-acl.
func (*Client) SetMetadata ¶
func (c *Client) SetMetadata(ctx context.Context, o *SetMetadataOptions) (SetMetadataResponse, error)
SetMetadata sets the container's metadata. For more information, see https://docs.microsoft.com/rest/api/storageservices/set-container-metadata.
type ClientOptions ¶
type ClientOptions struct {
azcore.ClientOptions
}
ClientOptions contains the optional parameters when creating a Client.
type CopyStatusType ¶
type CopyStatusType = generated.CopyStatusType
CopyStatusType defines values for CopyStatusType
const ( CopyStatusTypePending CopyStatusType = generated.CopyStatusTypePending CopyStatusTypeSuccess CopyStatusType = generated.CopyStatusTypeSuccess CopyStatusTypeAborted CopyStatusType = generated.CopyStatusTypeAborted CopyStatusTypeFailed CopyStatusType = generated.CopyStatusTypeFailed )
func PossibleCopyStatusTypeValues ¶
func PossibleCopyStatusTypeValues() []CopyStatusType
PossibleCopyStatusTypeValues returns the possible values for the CopyStatusType const type.
type CpkScopeInfo ¶
type CpkScopeInfo = generated.ContainerCpkScopeInfo
CpkScopeInfo contains a group of parameters for the ContainerClient.Create method.
type CreateOptions ¶
type CreateOptions struct { // Specifies whether data in the container may be accessed publicly and the level of access Access *PublicAccessType // Optional. Specifies a user-defined name-value pair associated with the blob. Metadata map[string]string // Optional. Specifies the encryption scope settings to set on the container. CpkScopeInfo *CpkScopeInfo }
CreateOptions contains the optional parameters for the Client.Create method.
type CreateResponse ¶
type CreateResponse = generated.ContainerClientCreateResponse
CreateResponse contains the response from method Client.Create.
type DeleteOptions ¶
type DeleteOptions struct {
AccessConditions *AccessConditions
}
DeleteOptions contains the optional parameters for the Client.Delete method.
type DeleteResponse ¶
type DeleteResponse = generated.ContainerClientDeleteResponse
DeleteResponse contains the response from method Client.Delete.
type GetAccessPolicyOptions ¶
type GetAccessPolicyOptions struct {
LeaseAccessConditions *LeaseAccessConditions
}
GetAccessPolicyOptions contains the optional parameters for the Client.GetAccessPolicy method.
type GetAccessPolicyResponse ¶
type GetAccessPolicyResponse = generated.ContainerClientGetAccessPolicyResponse
GetAccessPolicyResponse contains the response from method Client.GetAccessPolicy.
type GetPropertiesOptions ¶
type GetPropertiesOptions struct {
LeaseAccessConditions *LeaseAccessConditions
}
GetPropertiesOptions contains the optional parameters for the ContainerClient.GetProperties method.
type GetPropertiesResponse ¶
type GetPropertiesResponse = generated.ContainerClientGetPropertiesResponse
GetPropertiesResponse contains the response from method Client.GetProperties.
type ImmutabilityPolicyMode ¶
type ImmutabilityPolicyMode = generated.ImmutabilityPolicyMode
ImmutabilityPolicyMode defines values for ImmutabilityPolicyMode
const ( ImmutabilityPolicyModeMutable ImmutabilityPolicyMode = generated.ImmutabilityPolicyModeMutable ImmutabilityPolicyModeUnlocked ImmutabilityPolicyMode = generated.ImmutabilityPolicyModeUnlocked ImmutabilityPolicyModeLocked ImmutabilityPolicyMode = generated.ImmutabilityPolicyModeLocked )
func PossibleImmutabilityPolicyModeValues ¶
func PossibleImmutabilityPolicyModeValues() []ImmutabilityPolicyMode
PossibleImmutabilityPolicyModeValues returns the possible values for the ImmutabilityPolicyMode const type.
type LeaseAccessConditions ¶
type LeaseAccessConditions = exported.LeaseAccessConditions
LeaseAccessConditions contains optional parameters to access leased entity.
type LeaseDurationType ¶
type LeaseDurationType = generated.LeaseDurationType
LeaseDurationType defines values for LeaseDurationType
const ( LeaseDurationTypeInfinite LeaseDurationType = generated.LeaseDurationTypeInfinite LeaseDurationTypeFixed LeaseDurationType = generated.LeaseDurationTypeFixed )
func PossibleLeaseDurationTypeValues ¶
func PossibleLeaseDurationTypeValues() []LeaseDurationType
PossibleLeaseDurationTypeValues returns the possible values for the LeaseDurationType const type.
type LeaseStateType ¶
type LeaseStateType = generated.LeaseStateType
LeaseStateType defines values for LeaseStateType
const ( LeaseStateTypeAvailable LeaseStateType = generated.LeaseStateTypeAvailable LeaseStateTypeLeased LeaseStateType = generated.LeaseStateTypeLeased LeaseStateTypeExpired LeaseStateType = generated.LeaseStateTypeExpired LeaseStateTypeBreaking LeaseStateType = generated.LeaseStateTypeBreaking LeaseStateTypeBroken LeaseStateType = generated.LeaseStateTypeBroken )
func PossibleLeaseStateTypeValues ¶
func PossibleLeaseStateTypeValues() []LeaseStateType
PossibleLeaseStateTypeValues returns the possible values for the LeaseStateType const type.
type LeaseStatusType ¶
type LeaseStatusType = generated.LeaseStatusType
LeaseStatusType defines values for LeaseStatusType
const ( LeaseStatusTypeLocked LeaseStatusType = generated.LeaseStatusTypeLocked LeaseStatusTypeUnlocked LeaseStatusType = generated.LeaseStatusTypeUnlocked )
func PossibleLeaseStatusTypeValues ¶
func PossibleLeaseStatusTypeValues() []LeaseStatusType
PossibleLeaseStatusTypeValues returns the possible values for the LeaseStatusType const type.
type ListBlobsFlatOptions ¶
type ListBlobsFlatOptions struct { // Include this parameter to specify one or more datasets to include in the response. Include ListBlobsInclude // A string value that identifies the portion of the list of containers to be returned with the next listing operation. The // operation returns the NextMarker value within the response body if the listing // operation did not return all containers remaining to be listed with the current page. The NextMarker value can be used // as the value for the marker parameter in a subsequent call to request the next // page of list items. The marker value is opaque to the client. Marker *string // Specifies the maximum number of containers to return. If the request does not specify maxresults, or specifies a value // greater than 5000, the server will return up to 5000 items. Note that if the // listing operation crosses a partition boundary, then the service will return a continuation token for retrieving the remainder // of the results. For this reason, it is possible that the service will // return fewer results than specified by maxresults, or than the default of 5000. MaxResults *int32 // Filters the results to return only containers whose name begins with the specified prefix. Prefix *string }
ListBlobsFlatOptions contains the optional parameters for the ContainerClient.ListBlobFlatSegment method.
type ListBlobsFlatResponse ¶
type ListBlobsFlatResponse = generated.ContainerClientListBlobFlatSegmentResponse
ListBlobsFlatResponse contains the response from method Client.ListBlobFlatSegment.
type ListBlobsHierarchyOptions ¶
type ListBlobsHierarchyOptions struct { // Include this parameter to specify one or more datasets to include in the response. Include ListBlobsInclude // A string value that identifies the portion of the list of containers to be returned with the next listing operation. The // operation returns the NextMarker value within the response body if the listing // operation did not return all containers remaining to be listed with the current page. The NextMarker value can be used // as the value for the marker parameter in a subsequent call to request the next // page of list items. The marker value is opaque to the client. Marker *string // Specifies the maximum number of containers to return. If the request does not specify maxresults, or specifies a value // greater than 5000, the server will return up to 5000 items. Note that if the // listing operation crosses a partition boundary, then the service will return a continuation token for retrieving the remainder // of the results. For this reason, it is possible that the service will // return fewer results than specified by maxresults, or than the default of 5000. MaxResults *int32 // Filters the results to return only containers whose name begins with the specified prefix. Prefix *string }
ListBlobsHierarchyOptions provides set of configurations for Client.NewListBlobsHierarchyPager
type ListBlobsHierarchyResponse ¶
type ListBlobsHierarchyResponse = generated.ContainerClientListBlobHierarchySegmentResponse
ListBlobsHierarchyResponse contains the response from method Client.ListBlobHierarchySegment.
type ListBlobsInclude ¶
type ListBlobsInclude struct {
Copy, Metadata, Snapshots, UncommittedBlobs, Deleted, Tags, Versions, LegalHold, ImmutabilityPolicy, DeletedWithVersions bool
}
ListBlobsInclude indicates what additional information the service should return with each blob.
type ModifiedAccessConditions ¶
type ModifiedAccessConditions = exported.ModifiedAccessConditions
ModifiedAccessConditions contains a group of parameters for specifying access conditions.
type PublicAccessType ¶
type PublicAccessType = generated.PublicAccessType
PublicAccessType defines values for AccessType - private (default) or blob or container
const ( PublicAccessTypeBlob PublicAccessType = generated.PublicAccessTypeBlob PublicAccessTypeContainer PublicAccessType = generated.PublicAccessTypeContainer )
func PossiblePublicAccessTypeValues ¶
func PossiblePublicAccessTypeValues() []PublicAccessType
PossiblePublicAccessTypeValues returns the possible values for the PublicAccessType const type.
type RehydratePriority ¶
type RehydratePriority = generated.RehydratePriority
RehydratePriority - If an object is in rehydrate pending state then this header is returned with priority of rehydrate. Valid values are High and Standard.
const ( RehydratePriorityHigh RehydratePriority = generated.RehydratePriorityHigh RehydratePriorityStandard RehydratePriority = generated.RehydratePriorityStandard )
func PossibleRehydratePriorityValues ¶
func PossibleRehydratePriorityValues() []RehydratePriority
PossibleRehydratePriorityValues returns the possible values for the RehydratePriority const type.
type RestoreOptions ¶
type RestoreOptions struct { }
RestoreOptions contains the optional parameters for the Client.Restore method.
type RestoreResponse ¶
type RestoreResponse = generated.ContainerClientRestoreResponse
RestoreResponse contains the response from method Client.Restore.
type SKUName ¶
SKUName defines values for SkuName - LRS, GRS, RAGRS, ZRS, Premium LRS
const ( SKUNameStandardLRS SKUName = generated.SKUNameStandardLRS SKUNameStandardGRS SKUName = generated.SKUNameStandardGRS SKUNameStandardRAGRS SKUName = generated.SKUNameStandardRAGRS SKUNameStandardZRS SKUName = generated.SKUNameStandardZRS SKUNamePremiumLRS SKUName = generated.SKUNamePremiumLRS )
func PossibleSKUNameValues ¶
func PossibleSKUNameValues() []SKUName
PossibleSKUNameValues returns the possible values for the SKUName const type.
type SetAccessPolicyOptions ¶
type SetAccessPolicyOptions struct { // Specifies whether data in the container may be accessed publicly and the level of access Access *PublicAccessType // Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the analytics logs when storage // analytics logging is enabled. AccessConditions *AccessConditions }
SetAccessPolicyOptions provides set of configurations for ContainerClient.SetAccessPolicy operation
type SetAccessPolicyResponse ¶
type SetAccessPolicyResponse = generated.ContainerClientSetAccessPolicyResponse
SetAccessPolicyResponse contains the response from method Client.SetAccessPolicy.
type SetMetadataOptions ¶
type SetMetadataOptions struct { Metadata map[string]string LeaseAccessConditions *LeaseAccessConditions ModifiedAccessConditions *ModifiedAccessConditions }
SetMetadataOptions contains the optional parameters for the Client.SetMetadata method.
type SetMetadataResponse ¶
type SetMetadataResponse = generated.ContainerClientSetMetadataResponse
SetMetadataResponse contains the response from method Client.SetMetadata.
type SharedKeyCredential ¶
type SharedKeyCredential = exported.SharedKeyCredential
SharedKeyCredential contains an account's name and its primary or secondary key.
func NewSharedKeyCredential ¶
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.
type SignedIdentifier ¶
type SignedIdentifier = generated.SignedIdentifier
SignedIdentifier - signed identifier