filesystem

package
v0.0.0-...-45adee8 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 1, 2024 License: MIT Imports: 18 Imported by: 0

Documentation

Overview

Example (Fs_ClientCreate)
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/azdatalake/filesystem"
)

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")
	}
	fsName := "testfs"
	fsURL := fmt.Sprintf("https://%s.dfs.core.windows.net/%s", accountName, fsName)

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

	fsClient, err := filesystem.NewClient(fsURL, cred, nil)
	handleError(err)

	fsCreateResponse, err := fsClient.Create(context.TODO(), &filesystem.CreateOptions{
		Metadata: map[string]*string{"Foo": to.Ptr("Bar")},
	})
	handleError(err)
	fmt.Println(fsCreateResponse)
}
Output:

Example (Fs_ClientCreateDirectory)
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/azdatalake/filesystem"
)

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")
	}
	fsName := "testfs"
	fsURL := fmt.Sprintf("https://%s.dfs.core.windows.net/%s", accountName, fsName)
	dirPath := "testDir"

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

	fsClient, err := filesystem.NewClient(fsURL, cred, nil)
	handleError(err)

	fsCreateResponse, err := fsClient.Create(context.TODO(), &filesystem.CreateOptions{
		Metadata: map[string]*string{"Foo": to.Ptr("Bar")},
	})
	handleError(err)
	fmt.Println(fsCreateResponse)

	options := &filesystem.CreateDirectoryOptions{
		Umask:           to.Ptr("0000"),
		ACL:             to.Ptr("user::rwx,group::r-x,other::rwx"),
		LeaseDuration:   to.Ptr(int64(15)),
		ProposedLeaseID: to.Ptr("c820a799-76d7-4ee2-6e15-546f19325c2c"),
	}
	resp, err := fsClient.CreateDirectory(context.Background(), dirPath, options)
	handleError(err)
	fmt.Println(resp)
}
Output:

Example (Fs_ClientCreateFile)
package main

import (
	"context"
	"fmt"
	"github.com/Azure/azure-sdk-for-go/sdk/storage/azdatalake/file"
	"log"
	"net/http"
	"os"
	"time"

	"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/azdatalake/filesystem"
)

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")
	}
	fsName := "testfs"
	fsURL := fmt.Sprintf("https://%s.dfs.core.windows.net/%s", accountName, fsName)
	filePath := "testFile"

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

	fsClient, err := filesystem.NewClient(fsURL, cred, nil)
	handleError(err)

	fsCreateResponse, err := fsClient.Create(context.TODO(), &filesystem.CreateOptions{
		Metadata: map[string]*string{"Foo": to.Ptr("Bar")},
	})
	handleError(err)
	fmt.Println(fsCreateResponse)

	createFileOptions := &filesystem.CreateFileOptions{
		Umask: to.Ptr("0000"),
		ACL:   to.Ptr("user::rwx,group::r-x,other::rwx"),
		Expiry: file.CreateExpiryValues{
			ExpiryType: file.CreateExpiryTypeAbsolute,
			ExpiresOn:  time.Now().Add(20 * time.Second).UTC().Format(http.TimeFormat),
		},
		LeaseDuration:   to.Ptr(int64(15)),
		ProposedLeaseID: to.Ptr("c820a799-76d7-4ee2-6e15-546f19325c2c"),
	}
	resp, err := fsClient.CreateFile(context.Background(), filePath, createFileOptions)
	handleError(err)
	fmt.Println(resp)
}
Output:

Example (Fs_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/azdatalake/filesystem"
)

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")
	}
	fsName := "testfs"
	fsURL := fmt.Sprintf("https://%s.dfs.core.windows.net/%s", accountName, fsName)

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

	fsClient, err := filesystem.NewClient(fsURL, cred, nil)
	handleError(err)

	fsDeleteResponse, err := fsClient.Delete(context.TODO(), nil)
	handleError(err)
	fmt.Println(fsDeleteResponse)
}
Output:

Example (Fs_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/azdatalake/filesystem"
	"github.com/Azure/azure-sdk-for-go/sdk/storage/azdatalake/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")
	}
	fsName := "testfs"
	fsURL := fmt.Sprintf("https://%s.dfs.core.windows.net/%s", accountName, fsName)

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

	fsClient, err := filesystem.NewClient(fsURL, cred, nil)
	handleError(err)

	permission := sas.FileSystemPermissions{Read: true}
	start := time.Now()
	expiry := start.AddDate(1, 0, 0)
	options := filesystem.GetSASURLOptions{StartTime: &start}
	sasURL, err := fsClient.GetSASURL(permission, expiry, &options)
	handleError(err)
	_ = sasURL
}
Output:

Example (Fs_ClientListDeletedPaths)
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/azdatalake/filesystem"
)

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")
	}
	fsName := "testfs"
	fsURL := fmt.Sprintf("https://%s.dfs.core.windows.net/%s", accountName, fsName)

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

	fsClient, err := filesystem.NewClient(fsURL, cred, nil)
	handleError(err)

	pager := fsClient.NewListDeletedPathsPager(nil)

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

Example (Fs_ClientListPaths)
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/azdatalake/filesystem"
)

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")
	}
	fsName := "testfs"
	fsURL := fmt.Sprintf("https://%s.dfs.core.windows.net/%s", accountName, fsName)

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

	fsClient, err := filesystem.NewClient(fsURL, cred, nil)
	handleError(err)

	pager := fsClient.NewListPathsPager(true, nil)

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

Example (Fs_ClientNewFileClient)
package main

import (
	"fmt"
	"log"
	"os"

	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/storage/azdatalake/filesystem"
)

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")
	}
	fsName := "testfs"
	fsURL := fmt.Sprintf("https://%s.dfs.core.windows.net/%s", accountName, fsName)

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

	fsClient, err := filesystem.NewClient(fsURL, cred, nil)
	handleError(err)

	fileClient := fsClient.NewFileClient("test_File")
	handleError(err)
	fmt.Println(fileClient.DFSURL())
}
Output:

Example (Fs_ClientSetAccessPolicy)

This example shows how to manipulate a fs'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/azdatalake/filesystem"
)

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")
	}
	fsName := "testfs"
	fsURL := fmt.Sprintf("https://%s.dfs.core.windows.net/%s", accountName, fsName)

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

	fsClient, err := filesystem.NewClient(fsURL, cred, nil)
	handleError(err)

	// Create the fs
	_, err = fsClient.Create(context.TODO(), nil)
	handleError(err)

	// Upload a simple File.
	fileClient := fsClient.NewFileClient("HelloWorld.txt")
	handleError(err)

	err = fileClient.UploadStream(context.TODO(), streaming.NopCloser(strings.NewReader("Hello World!")), nil)
	handleError(err)

	// Attempt to read the File
	get, err := http.Get(fileClient.DFSURL())
	handleError(err)
	if get.StatusCode == http.StatusNotFound {
		// ChangeLease the File to be public access File
		_, err := fsClient.SetAccessPolicy(
			context.TODO(),
			&filesystem.SetAccessPolicyOptions{
				Access: to.Ptr(filesystem.File),
			},
		)
		if err != nil {
			log.Fatal(err)
		}

		// Now, this works
		get, err = http.Get(fileClient.DFSURL())
		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 File data: ", text.String())
	}
}
Output:

Example (Fs_ClientSetMetadata)
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/azdatalake/filesystem"
)

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")
	}
	fsName := "testfs"
	fsURL := fmt.Sprintf("https://%s.dfs.core.windows.net/%s", accountName, fsName)

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

	fsClient, err := filesystem.NewClient(fsURL, cred, nil)
	handleError(err)

	// Create a fs 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 = fsClient.Create(context.TODO(), &filesystem.CreateOptions{Metadata: map[string]*string{"author": to.Ptr("azFile"), "app": to.Ptr(creatingApp)}})
	handleError(err)

	// Query the fs's metadata
	fsGetPropertiesResponse, err := fsClient.GetProperties(context.TODO(), nil)
	handleError(err)

	if fsGetPropertiesResponse.Metadata == nil {
		log.Fatal("metadata is empty!")
	}

	for k, v := range fsGetPropertiesResponse.Metadata {
		fmt.Printf("%s=%s\n", k, *v)
	}

	// Update the metadata and write it back to the fs
	fsGetPropertiesResponse.Metadata["author"] = to.Ptr("Mohit")
	_, err = fsClient.SetMetadata(context.TODO(), &filesystem.SetMetadataOptions{Metadata: fsGetPropertiesResponse.Metadata})
	handleError(err)
}
Output:

Example (Fs_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/azdatalake/filesystem"
)

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")
	}
	fsName := "testfs"
	fsURL := fmt.Sprintf("https://%s.dfs.core.windows.net/%s", accountName, fsName)

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

	fsClient, err := filesystem.NewClient(fsURL, cred, nil)
	handleError(err)
	fmt.Println(fsClient.DFSURL())
}
Output:

Example (Fs_NewClientFromConnectionString)
package main

import (
	"fmt"
	"log"
	"os"

	"github.com/Azure/azure-sdk-for-go/sdk/storage/azdatalake/filesystem"
)

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")
	}
	fsName := "testfs"
	fsClient, err := filesystem.NewClientFromConnectionString(connectionString, fsName, nil)
	handleError(err)
	fmt.Println(fsClient.DFSURL())
}
Output:

Example (Fs_NewClientWithNoCredential)
package main

import (
	"fmt"
	"log"
	"os"

	"github.com/Azure/azure-sdk-for-go/sdk/storage/azdatalake/filesystem"
)

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")
	}
	fsName := "testfs"
	fsURL := fmt.Sprintf("https://%s.dfs.core.windows.net/%s?%s", accountName, fsName, sharedAccessSignature)

	fsClient, err := filesystem.NewClientWithNoCredential(fsURL, nil)
	handleError(err)
	fmt.Println(fsClient.DFSURL())
}
Output:

Example (Fs_NewClientWithSharedKeyCredential)
package main

import (
	"fmt"
	"log"
	"os"

	"github.com/Azure/azure-sdk-for-go/sdk/storage/azdatalake"
	"github.com/Azure/azure-sdk-for-go/sdk/storage/azdatalake/filesystem"
)

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")
	}
	fsName := "testfs"
	fsURL := fmt.Sprintf("https://%s.dfs.core.windows.net/%s", accountName, fsName)

	cred, err := azdatalake.NewSharedKeyCredential(accountName, accountKey)
	handleError(err)
	fsClient, err := filesystem.NewClientWithSharedKeyCredential(fsURL, cred, nil)
	handleError(err)
	fmt.Println(fsClient.DFSURL())
}
Output:

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AccessConditions

type AccessConditions = exported.AccessConditions

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

type AccessPolicy

type AccessPolicy = container.AccessPolicy

AccessPolicy - An Access policy.

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 CPKScopeInfo

type CPKScopeInfo = container.CPKScopeInfo

CPKScopeInfo contains a group of parameters for the FileSystemClient.Create method.

type Client

Client represents a URL to the Azure Datalake Storage service.

func NewClient

func NewClient(filesystemURL string, cred azcore.TokenCredential, options *ClientOptions) (*Client, error)

NewClient creates an instance of Client with the specified values.

  • filesystemURL - the URL of the blob e.g. https://<account>.dfs.core.windows.net/fs
  • 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, fsName string, options *ClientOptions) (*Client, error)

NewClientFromConnectionString creates an instance of Client with the specified values.

  • connectionString - a connection string for the desired storage account
  • options - client options; pass nil to accept the default values

func NewClientWithNoCredential

func NewClientWithNoCredential(filesystemURL 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.

  • filesystemURL - the URL of the storage account e.g. https://<account>.dfs.core.windows.net/fs?<sas token>
  • options - client options; pass nil to accept the default values

func NewClientWithSharedKeyCredential

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

NewClientWithSharedKeyCredential creates an instance of Client with the specified values.

  • filesystemURL - the URL of the storage account e.g. https://<account>.dfs.core.windows.net/fs
  • cred - a SharedKeyCredential created with the matching storage account and access key
  • options - client options; pass nil to accept the default values

func (*Client) BlobURL

func (fs *Client) BlobURL() string

BlobURL returns the URL endpoint used by the Client object.

func (*Client) Create

func (fs *Client) Create(ctx context.Context, options *CreateOptions) (CreateResponse, error)

Create creates a new filesystem under the specified account.

func (*Client) CreateDirectory

func (fs *Client) CreateDirectory(ctx context.Context, filePath string, options *CreateDirectoryOptions) (CreateDirectoryResponse, error)

CreateDirectory Creates a new directory within a file system. For more information, see the <a href="https://docs.microsoft.com/rest/api/storageservices/datalakestoragegen2/path/create">Azure Docs</a>.

func (*Client) CreateFile

func (fs *Client) CreateFile(ctx context.Context, filePath string, options *CreateFileOptions) (CreateFileResponse, error)

CreateFile Creates a new file within a file system. For more information, see the <a href="https://docs.microsoft.com/rest/api/storageservices/datalakestoragegen2/path/create">Azure Docs</a>.

func (*Client) DFSURL

func (fs *Client) DFSURL() string

DFSURL returns the URL endpoint used by the Client object.

func (*Client) Delete

func (fs *Client) Delete(ctx context.Context, options *DeleteOptions) (DeleteResponse, error)

Delete deletes the specified filesystem and any files or directories it contains.

func (*Client) GetAccessPolicy

func (fs *Client) GetAccessPolicy(ctx context.Context, options *GetAccessPolicyOptions) (GetAccessPolicyResponse, error)

GetAccessPolicy returns the permissions for the specified filesystem or the files and directories under it.

func (*Client) GetProperties

func (fs *Client) GetProperties(ctx context.Context, options *GetPropertiesOptions) (GetPropertiesResponse, error)

GetProperties returns all user-defined metadata, standard HTTP properties, and system properties for the filesystem.

func (*Client) GetSASURL

func (fs *Client) GetSASURL(permissions sas.FileSystemPermissions, expiry time.Time, o *GetSASURLOptions) (string, error)

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

func (*Client) NewDirectoryClient

func (fs *Client) NewDirectoryClient(directoryPath string) *directory.Client

NewDirectoryClient creates a new directory.Client object by concatenating directory path to the end of this Client's URL. The new directory.Client uses the same request policy pipeline as the Client.

func (*Client) NewFileClient

func (fs *Client) NewFileClient(filePath string) *file.Client

NewFileClient creates a new file.Client object by concatenating file path to the end of this Client's URL. The new file.Client uses the same request policy pipeline as the Client.

func (*Client) NewListDeletedPathsPager

func (fs *Client) NewListDeletedPathsPager(options *ListDeletedPathsOptions) *runtime.Pager[ListDeletedPathsSegmentResponse]

NewListDeletedPathsPager operation returns a pager of the shares under the specified account. For more information, see https://learn.microsoft.com/en-us/rest/api/storageservices/list-shares

func (*Client) NewListPathsPager

func (fs *Client) NewListPathsPager(recursive bool, options *ListPathsOptions) *runtime.Pager[ListPathsSegmentResponse]

NewListPathsPager operation returns a pager of the paths under the specified filesystem. For more information, see https://learn.microsoft.com/en-us/rest/api/storageservices/datalakestoragegen2/path/list

func (*Client) SetAccessPolicy

func (fs *Client) SetAccessPolicy(ctx context.Context, options *SetAccessPolicyOptions) (SetAccessPolicyResponse, error)

SetAccessPolicy sets the permissions for the specified filesystem or the files and directories under it.

func (*Client) SetMetadata

func (fs *Client) SetMetadata(ctx context.Context, options *SetMetadataOptions) (SetMetadataResponse, error)

SetMetadata sets one or more user-defined name-value pairs for the specified filesystem.

type ClientOptions

type ClientOptions base.ClientOptions

ClientOptions contains the optional parameters when creating a Client.

type CreateDirectoryOptions

type CreateDirectoryOptions = directory.CreateOptions

CreateDirectoryOptions contains the optional parameters when calling the CreateDirectory operation.

type CreateDirectoryResponse

type CreateDirectoryResponse = generated.PathClientCreateResponse

CreateDirectoryResponse contains the response from method FileSystemClient.CreateDirectory.

type CreateFileOptions

type CreateFileOptions = file.CreateOptions

CreateFileOptions contains the optional parameters when calling the CreateFile operation.

type CreateFileResponse

type CreateFileResponse = generated.PathClientCreateResponse

CreateFileResponse contains the response from method FileSystemClient.CreateFile.

type CreateOptions

type CreateOptions struct {
	// Access specifies whether data in the filesystem may be accessed publicly and the level of access.
	Access *PublicAccessType
	// Metadata specifies a user-defined name-value pair associated with the filesystem.
	Metadata map[string]*string
	// CPKScopeInfo specifies the encryption scope settings to set on the filesystem.
	CPKScopeInfo *CPKScopeInfo
}

CreateOptions contains the optional parameters for the Client.Create method.

type CreateResponse

type CreateResponse = container.CreateResponse

CreateResponse contains the response from method FileSystemClient.Create.

type DeleteOptions

type DeleteOptions struct {
	// AccessConditions identifies filesystem-specific access conditions which you optionally set.
	AccessConditions *AccessConditions
}

DeleteOptions contains the optional parameters for the Client.Delete method.

type DeleteResponse

type DeleteResponse = container.DeleteResponse

DeleteResponse contains the response from method FileSystemClient.Delete.

type DurationType

type DurationType = azdatalake.DurationType

DurationType defines values for DurationType

const (
	DurationTypeInfinite DurationType = azdatalake.DurationTypeInfinite
	DurationTypeFixed    DurationType = azdatalake.DurationTypeFixed
)

func PossibleDurationTypeValues

func PossibleDurationTypeValues() []DurationType

PossibleDurationTypeValues returns the possible values for the DurationType const type.

type GetAccessPolicyOptions

type GetAccessPolicyOptions struct {
	// LeaseAccessConditions contains parameters to access leased filesystem.
	LeaseAccessConditions *LeaseAccessConditions
}

GetAccessPolicyOptions contains the optional parameters for the Client.GetAccessPolicy method.

type GetAccessPolicyResponse

type GetAccessPolicyResponse struct {
	// PublicAccess contains the information returned from the x-ms-blob-public-access header response.
	PublicAccess *PublicAccessType

	// ClientRequestID contains the information returned from the x-ms-client-request-id header response.
	ClientRequestID *string

	// Date contains the information returned from the Date header response.
	Date *time.Time

	// ETag contains the information returned from the ETag header response.
	ETag *azcore.ETag

	// LastModified contains the information returned from the Last-Modified header response.
	LastModified *time.Time

	// RequestID contains the information returned from the x-ms-request-id header response.
	RequestID *string

	// a collection of signed identifiers
	SignedIdentifiers []*SignedIdentifier

	// Version contains the information returned from the x-ms-version header response.
	Version *string
}

GetAccessPolicyResponse contains the response from method FileSystemClient.GetAccessPolicy.

type GetPropertiesOptions

type GetPropertiesOptions struct {
	// LeaseAccessConditions contains parameters to access leased filesystem.
	LeaseAccessConditions *LeaseAccessConditions
}

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

type GetPropertiesResponse

type GetPropertiesResponse struct {
	// BlobPublicAccess contains the information returned from the x-ms-blob-public-access header response.
	PublicAccess *PublicAccessType

	// ClientRequestID contains the information returned from the x-ms-client-request-id header response.
	ClientRequestID *string

	// Date contains the information returned from the Date header response.
	Date *time.Time

	// DefaultEncryptionScope contains the information returned from the x-ms-default-encryption-scope header response.
	DefaultEncryptionScope *string

	// DenyEncryptionScopeOverride contains the information returned from the x-ms-deny-encryption-scope-override header response.
	DenyEncryptionScopeOverride *bool

	// ETag contains the information returned from the ETag header response.
	ETag *azcore.ETag

	// HasImmutabilityPolicy contains the information returned from the x-ms-has-immutability-policy header response.
	HasImmutabilityPolicy *bool

	// HasLegalHold contains the information returned from the x-ms-has-legal-hold header response.
	HasLegalHold *bool

	// IsImmutableStorageWithVersioningEnabled contains the information returned from the x-ms-immutable-storage-with-versioning-enabled
	// header response.
	IsImmutableStorageWithVersioningEnabled *bool

	// LastModified contains the information returned from the Last-Modified header response.
	LastModified *time.Time

	// LeaseDuration contains the information returned from the x-ms-lease-duration header response.
	LeaseDuration *DurationType

	// LeaseState contains the information returned from the x-ms-lease-state header response.
	LeaseState *StateType

	// LeaseStatus contains the information returned from the x-ms-lease-status header response.
	LeaseStatus *StatusType

	// Metadata contains the information returned from the x-ms-meta header response.
	Metadata map[string]*string

	// RequestID contains the information returned from the x-ms-request-id header response.
	RequestID *string

	// Version contains the information returned from the x-ms-version header response.
	Version *string
}

GetPropertiesResponse contains the response from method FileSystemClient.GetProperties.

type GetSASURLOptions

type GetSASURLOptions struct {
	// StartTime is the time after which the SAS will become valid.
	StartTime *time.Time
}

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

type LeaseAccessConditions

type LeaseAccessConditions = exported.LeaseAccessConditions

LeaseAccessConditions contains optional parameters to access leased entity.

type ListDeletedPathsOptions

type ListDeletedPathsOptions struct {
	// Marker contains last continuation token returned from the service for listing.
	Marker *string
	// MaxResults sets the maximum number of paths that will be returned per page.
	MaxResults *int32
	// Prefix filters the results to return only paths whose names begin with the specified prefix path.
	Prefix *string
}

ListDeletedPathsOptions contains the optional parameters for the FileSystem.ListDeletedPaths operation.

type ListDeletedPathsSegmentResponse

type ListDeletedPathsSegmentResponse = generated.FileSystemClientListPathHierarchySegmentResponse

ListDeletedPathsSegmentResponse contains the response from method FileSystemClient.ListPathsSegment.

type ListPathsHierarchySegmentResponse

type ListPathsHierarchySegmentResponse = generated.ListPathsHierarchySegmentResponse

ListPathsHierarchySegmentResponse contains the response from method FileSystemClient.ListPathsHierarchySegment.

type ListPathsOptions

type ListPathsOptions struct {
	// Marker contains last continuation token returned from the service for listing.
	Marker *string
	// MaxResults sets the maximum number of paths that will be returned per page.
	MaxResults *int32
	// Prefix filters the results to return only paths whose names begin with the specified prefix path.
	Prefix *string
	// UPN is the user principal name.
	UPN *bool
}

ListPathsOptions contains the optional parameters for the FileSystem.ListPaths operation.

type ListPathsSegmentResponse

type ListPathsSegmentResponse = generated.FileSystemClientListPathsResponse

ListPathsSegmentResponse contains the response from method FileSystemClient.ListPathsSegment.

type ModifiedAccessConditions

type ModifiedAccessConditions = exported.ModifiedAccessConditions

ModifiedAccessConditions contains a group of parameters for specifying access conditions.

type Path

type Path = generated.Path

Path contains the path properties from the ListPaths operation

type PathHierarchyListSegment

type PathHierarchyListSegment = generated.PathHierarchyListSegment

PathHierarchyListSegment contains the response from method FileSystemClient.ListPathsHierarchySegment.

type PathItem

type PathItem = generated.PathItemInternal

PathItem contains the response from method FileSystemClient.ListPathsHierarchySegment.

type PathList

type PathList = generated.PathList

PathList contains the path list from the ListPaths operation

type PathPrefix

type PathPrefix = generated.PathPrefix

PathPrefix contains the response from method FileSystemClient.ListPathsHierarchySegment.

type PathProperties

type PathProperties = generated.PathPropertiesInternal

PathProperties contains the response from method FileSystemClient.ListPathsHierarchySegment.

type PublicAccessType

type PublicAccessType = azblob.PublicAccessType

PublicAccessType defines values for AccessType - private (default) or file or filesystem.

type SetAccessPolicyOptions

type SetAccessPolicyOptions struct {
	// Access Specifies whether data in the filesystem may be accessed publicly and the level of access.
	// If this header is not included in the request, filesystem data is private to the account owner.
	Access *PublicAccessType
	// AccessConditions identifies filesystem-specific access conditions which you optionally set.
	AccessConditions *AccessConditions
	// FileSystemACL sets the access policy for the filesystem.
	FileSystemACL []*SignedIdentifier
}

SetAccessPolicyOptions provides set of configurations for FileSystem.SetAccessPolicy operation.

type SetAccessPolicyResponse

type SetAccessPolicyResponse = container.SetAccessPolicyResponse

SetAccessPolicyResponse contains the response from method FileSystemClient.SetAccessPolicy.

type SetMetadataOptions

type SetMetadataOptions struct {
	// Metadata sets the metadata key-value pairs to set on the filesystem.
	Metadata map[string]*string
	// AccessConditions identifies filesystem-specific access conditions which you optionally set.
	AccessConditions *AccessConditions
}

SetMetadataOptions contains the optional parameters for the Client.SetMetadata method.

type SetMetadataResponse

type SetMetadataResponse = container.SetMetadataResponse

SetMetadataResponse contains the response from method FileSystemClient.SetMetadata.

type SharedKeyCredential

type SharedKeyCredential = exported.SharedKeyCredential

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

type SignedIdentifier

type SignedIdentifier = container.SignedIdentifier

SignedIdentifier - signed identifier.

type StateType

type StateType = azdatalake.StateType

StateType defines values for StateType

const (
	StateTypeAvailable StateType = azdatalake.StateTypeAvailable
	StateTypeLeased    StateType = azdatalake.StateTypeLeased
	StateTypeExpired   StateType = azdatalake.StateTypeExpired
	StateTypeBreaking  StateType = azdatalake.StateTypeBreaking
	StateTypeBroken    StateType = azdatalake.StateTypeBroken
)

type StatusType

type StatusType = azdatalake.StatusType

StatusType defines values for StatusType

const (
	StatusTypeLocked   StatusType = azdatalake.StatusTypeLocked
	StatusTypeUnlocked StatusType = azdatalake.StatusTypeUnlocked
)

func PossibleStatusTypeValues

func PossibleStatusTypeValues() []StatusType

PossibleStatusTypeValues returns the possible values for the StatusType const type.

type UndeletePathResponse

type UndeletePathResponse = generated.PathClientUndeleteResponse

UndeletePathResponse contains the response from method FileSystemClient.UndeletePath.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL