tables

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: 11 Imported by: 0

README

Table Storage Tables SDK for API version 2019-12-12

This package allows you to interact with the Tables Table Storage API

Supported Authorizers

  • SharedKeyLite (Table)

Example Usage

package main

import (
	"context"
	"fmt"
	"time"
	
	"github.com/Azure/go-autorest/autorest"
	"github.com/tombuildsstuff/giovanni/storage/2019-12-12/table/tables"
)

func Example() error {
	accountName := "storageaccount1"
    storageAccountKey := "ABC123...."
    tableName := "mytable"
    
    storageAuth := autorest.NewSharedKeyLiteTableAuthorizer(accountName, storageAccountKey)
    tablesClient := tables.New()
    tablesClient.Client.Authorizer = storageAuth
    
    ctx := context.TODO()
    if _, err := tablesClient.Insert(ctx, accountName, tableName); err != nil {
        return fmt.Errorf("Error creating Table: %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 AccessPolicy

type AccessPolicy struct {
	Start      string `xml:"Start"`
	Expiry     string `xml:"Expiry"`
	Permission string `xml:"Permission"`
}

type Client

type Client struct {
	autorest.Client
	BaseURI string
}

Client is the base client for Table Storage Shares.

func New

func New() Client

New creates an instance of the Client client.

func NewWithEnvironment

func NewWithEnvironment(environment azure.Environment) Client

NewWithEnvironment creates an instance of the Client client.

func (Client) Create

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

Create creates a new table in the storage account.

func (Client) CreatePreparer

func (client Client) CreatePreparer(ctx context.Context, accountName, tableName string) (*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, tableName string) (result autorest.Response, err error)

Delete deletes the specified table and any data it contains.

func (Client) DeletePreparer

func (client Client) DeletePreparer(ctx context.Context, accountName, tableName 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) Exists

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

Exists checks that the specified table exists

func (Client) ExistsPreparer

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

ExistsPreparer prepares the Exists request.

func (Client) ExistsResponder

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

ExistsResponder handles the response to the Exists request. The method always closes the http.Response Body.

func (Client) ExistsSender

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

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

func (Client) GetACL

func (client Client) GetACL(ctx context.Context, accountName, tableName string) (result GetACLResult, err error)

GetACL returns the Access Control List for the specified Table

func (Client) GetACLPreparer

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

GetACLPreparer prepares the GetACL request.

func (Client) GetACLResponder

func (client Client) GetACLResponder(resp *http.Response) (result GetACLResult, err error)

GetACLResponder handles the response to the GetACL request. The method always closes the http.Response Body.

func (Client) GetACLSender

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

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

func (Client) GetResourceID

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

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

func (Client) Query

func (client Client) Query(ctx context.Context, accountName string, metaDataLevel MetaDataLevel) (result GetResult, err error)

Query returns a list of tables under the specified account.

func (Client) QueryPreparer

func (client Client) QueryPreparer(ctx context.Context, accountName string, metaDataLevel MetaDataLevel) (*http.Request, error)

QueryPreparer prepares the Query request.

func (Client) QueryResponder

func (client Client) QueryResponder(resp *http.Response) (result GetResult, err error)

QueryResponder handles the response to the Query request. The method always closes the http.Response Body.

func (Client) QuerySender

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

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

func (Client) SetACL

func (client Client) SetACL(ctx context.Context, accountName, tableName string, acls []SignedIdentifier) (result autorest.Response, err error)

SetACL sets the specified Access Control List for the specified Table

func (Client) SetACLPreparer

func (client Client) SetACLPreparer(ctx context.Context, accountName, tableName string, acls []SignedIdentifier) (*http.Request, error)

SetACLPreparer prepares the SetACL request.

func (Client) SetACLResponder

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

SetACLResponder handles the response to the SetACL request. The method always closes the http.Response Body.

func (Client) SetACLSender

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

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

type GetACLResult

type GetACLResult struct {
	autorest.Response

	SignedIdentifiers []SignedIdentifier `xml:"SignedIdentifier"`
}

type GetResult

type GetResult struct {
	autorest.Response

	MetaData string          `json:"odata.metadata,omitempty"`
	Tables   []GetResultItem `json:"value"`
}

type GetResultItem

type GetResultItem struct {
	TableName string `json:"TableName"`

	// Optional, depending on the MetaData Level
	ODataType     string `json:"odata.type,omitempty"`
	ODataID       string `json:"odata.id,omitEmpty"`
	ODataEditLink string `json:"odata.editLink,omitEmpty"`
}

type MetaDataLevel

type MetaDataLevel string
var (
	NoMetaData      MetaDataLevel = "nometadata"
	MinimalMetaData MetaDataLevel = "minimalmetadata"
	FullMetaData    MetaDataLevel = "fullmetadata"
)

type ResourceID

type ResourceID struct {
	AccountName string
	TableName   string
}

func ParseResourceID

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

ParseResourceID parses the Resource ID and returns an object which can be used to interact with the Table within the specified Storage Account

type SignedIdentifier

type SignedIdentifier struct {
	Id           string       `xml:"Id"`
	AccessPolicy AccessPolicy `xml:"AccessPolicy"`
}

type StorageTable

type StorageTable interface {
	Delete(ctx context.Context, accountName, tableName string) (result autorest.Response, err error)
	Exists(ctx context.Context, accountName, tableName string) (result autorest.Response, err error)
	GetACL(ctx context.Context, accountName, tableName string) (result GetACLResult, err error)
	Create(ctx context.Context, accountName, tableName string) (result autorest.Response, err error)
	GetResourceID(accountName, tableName string) string
	Query(ctx context.Context, accountName string, metaDataLevel MetaDataLevel) (result GetResult, err error)
	SetACL(ctx context.Context, accountName, tableName string, acls []SignedIdentifier) (result autorest.Response, err error)
}

Jump to

Keyboard shortcuts

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