filesystems

package
v0.19.0 Latest Latest
Warning

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

Go to latest
Published: Apr 19, 2022 License: Apache-2.0 Imports: 10 Imported by: 0

README

Data Lake Storage Gen2 File Systems SDK for API version 2019-12-12

This package allows you to interact with the Data Lake Storage Gen2 File Systems API

Supported Authorizers

  • Azure Active Directory (for the Resource Endpoint https://storage.azure.com)

Example Usage

package main

import (
	"context"
	"fmt"
	"os"
    "time"
	
	"github.com/Azure/go-autorest/autorest"
	"github.com/Azure/go-autorest/autorest/adal"
    "github.com/Azure/go-autorest/autorest/azure"
    "github.com/hashicorp/go-azure-helpers/authentication"
    "github.com/hashicorp/go-azure-helpers/sender"
    "github.com/tombuildsstuff/giovanni/storage/2019-12-12/datalakestore/filesystems"
)

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

    builder := &authentication.Builder{
        SubscriptionID: os.Getenv("ARM_SUBSCRIPTION_ID"),
        ClientID:       os.Getenv("ARM_CLIENT_ID"),
        ClientSecret:   os.Getenv("ARM_CLIENT_SECRET"),
        TenantID:       os.Getenv("ARM_TENANT_ID"),
        Environment:    os.Getenv("ARM_ENVIRONMENT"),

        // Feature Toggles
        SupportsClientSecretAuth: true,
    }

    c, err := builder.Build()
    if err != nil {
        return fmt.Errorf("Error building AzureRM Client: %s", err)
    }

    env, err := authentication.DetermineEnvironment(c.Environment)
    if err != nil {
        return err
    }

    oauthConfig, err := adal.NewOAuthConfig(env.ActiveDirectoryEndpoint, c.TenantID)
	if err != nil {
		return err
	}

	// OAuthConfigForTenant returns a pointer, which can be nil.
	if oauthConfig == nil {
		return fmt.Errorf("Unable to configure OAuthConfig for tenant %s", c.TenantID)
	}

    sender := sender.BuildSender("AzureRM")
    ctx := context.Background()

    storageAuth, err := config.GetAuthorizationToken(sender, oauthConfig, "https://storage.azure.com/")
	if err != nil {
		return fmt.Errorf("Error retrieving Authorization Token")
	}

   
    fileSystemsClient := filesystems.NewWithEnvironment(env)
	fileSystemsClient.Client.Authorizer = storageAuth

	input := filesystems.CreateInput{
		Properties: map[string]string{},
	}
	if _, err = fileSystemsClient.Create(ctx, accountName, fileSystemName, input); err != nil {
		return fmt.Errorf("Error creating: %s", err)
	}
	
    return nil 
}

Documentation

Index

Constants

View Source
const APIVersion = "2019-12-12"

APIVersion is the version of the API used for all Storage API Operations

Variables

This section is empty.

Functions

func UserAgent

func UserAgent() string

Types

type Client

type Client struct {
	autorest.Client
	BaseURI string
}

Client is the base client for Data Lake Storage FileSystem

func New

func New() Client

New creates an instance of the Data Lake Storage FileSystem client.

func NewWithEnvironment

func NewWithEnvironment(environment azure.Environment) Client

NewWithEnvironment creates an instance of the Data Lake Storage FileSystem client.

func (Client) Create

func (client Client) Create(ctx context.Context, accountName string, fileSystemName string, input CreateInput) (result autorest.Response, err error)

Create creates a Data Lake Store Gen2 FileSystem within a Storage Account

func (Client) CreatePreparer

func (client Client) CreatePreparer(ctx context.Context, accountName string, fileSystemName string, input CreateInput) (*http.Request, error)

CreatePreparer prepares the Create request.

func (Client) CreateResponder

func (client Client) CreateResponder(resp *http.Response) (result autorest.Response, err error)

CreateResponder handles the response to the Create request. The method always closes the http.Response Body.

func (Client) CreateSender

func (client Client) CreateSender(req *http.Request) (*http.Response, error)

CreateSender sends the Create request. The method will close the http.Response Body if it receives an error.

func (Client) Delete

func (client Client) Delete(ctx context.Context, accountName string, fileSystemName string) (result autorest.Response, err error)

Delete deletes a Data Lake Store Gen2 FileSystem within a Storage Account

func (Client) DeletePreparer

func (client Client) DeletePreparer(ctx context.Context, accountName string, fileSystemName string) (*http.Request, error)

DeletePreparer prepares the Delete request.

func (Client) DeleteResponder

func (client Client) DeleteResponder(resp *http.Response) (result autorest.Response, err error)

DeleteResponder handles the response to the Delete request. The method always closes the http.Response Body.

func (Client) DeleteSender

func (client Client) DeleteSender(req *http.Request) (*http.Response, error)

DeleteSender sends the Delete request. The method will close the http.Response Body if it receives an error.

func (Client) GetProperties

func (client Client) GetProperties(ctx context.Context, accountName string, fileSystemName string) (result GetPropertiesResponse, err error)

GetProperties gets the properties for a Data Lake Store Gen2 FileSystem within a Storage Account

func (Client) GetPropertiesPreparer

func (client Client) GetPropertiesPreparer(ctx context.Context, accountName string, fileSystemName string) (*http.Request, error)

GetPropertiesPreparer prepares the GetProperties request.

func (Client) GetPropertiesResponder

func (client Client) GetPropertiesResponder(resp *http.Response) (result GetPropertiesResponse, err error)

GetPropertiesResponder handles the response to the GetProperties request. The method always closes the http.Response Body.

func (Client) GetPropertiesSender

func (client Client) GetPropertiesSender(req *http.Request) (*http.Response, error)

GetPropertiesSender sends the GetProperties request. The method will close the http.Response Body if it receives an error.

func (Client) GetResourceID

func (client Client) GetResourceID(accountName, shareName string) string

GetResourceID returns the Resource ID for the given Data Lake Storage FileSystem This can be useful when, for example, you're using this as a unique identifier

func (Client) SetProperties

func (client Client) SetProperties(ctx context.Context, accountName string, fileSystemName string, input SetPropertiesInput) (result autorest.Response, err error)

SetProperties sets the Properties for a Data Lake Store Gen2 FileSystem within a Storage Account

func (Client) SetPropertiesPreparer

func (client Client) SetPropertiesPreparer(ctx context.Context, accountName string, fileSystemName string, input SetPropertiesInput) (*http.Request, error)

SetPropertiesPreparer prepares the SetProperties request.

func (Client) SetPropertiesResponder

func (client Client) SetPropertiesResponder(resp *http.Response) (result autorest.Response, err error)

SetPropertiesResponder handles the response to the SetProperties request. The method always closes the http.Response Body.

func (Client) SetPropertiesSender

func (client Client) SetPropertiesSender(req *http.Request) (*http.Response, error)

SetPropertiesSender sends the SetProperties request. The method will close the http.Response Body if it receives an error.

type CreateInput

type CreateInput struct {
	// A map of base64-encoded strings to store as user-defined properties with the File System
	// Note that items may only contain ASCII characters in the ISO-8859-1 character set.
	// This automatically gets converted to a comma-separated list of name and
	// value pairs before sending to the API
	Properties map[string]string
}

type GetPropertiesResponse

type GetPropertiesResponse struct {
	autorest.Response

	// A map of base64-encoded strings to store as user-defined properties with the File System
	// Note that items may only contain ASCII characters in the ISO-8859-1 character set.
	// This automatically gets converted to a comma-separated list of name and
	// value pairs before sending to the API
	Properties map[string]string

	// Is Hierarchical Namespace Enabled?
	NamespaceEnabled bool
}

type ResourceID

type ResourceID struct {
	AccountName   string
	DirectoryName string
}

func ParseResourceID

func ParseResourceID(id string) (*ResourceID, error)

ParseResourceID parses the specified Resource ID and returns an object which can be used to interact with the Data Lake Storage FileSystem API's

type SetPropertiesInput

type SetPropertiesInput struct {
	// A map of base64-encoded strings to store as user-defined properties with the File System
	// Note that items may only contain ASCII characters in the ISO-8859-1 character set.
	// This automatically gets converted to a comma-separated list of name and
	// value pairs before sending to the API
	Properties map[string]string

	// Optional - A date and time value.
	// Specify this header to perform the operation only if the resource has been modified since the specified date and time.
	IfModifiedSince *string

	// Optional - A date and time value.
	// Specify this header to perform the operation only if the resource has not been modified since the specified date and time.
	IfUnmodifiedSince *string
}

Jump to

Keyboard shortcuts

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