queues

package
v0.27.0 Latest Latest
Warning

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

Go to latest
Published: Apr 22, 2024 License: Apache-2.0 Imports: 15 Imported by: 4

README

Queue Storage Queues SDK for API version 2020-08-04

This package allows you to interact with the Queues Queue Storage API

Supported Authorizers

  • Azure Active Directory (for the Resource Endpoint https://storage.azure.com)
  • SharedKeyLite (Blob, File & Queue)

Example Usage

package main

import (
	"context"
	"fmt"

	"github.com/hashicorp/go-azure-sdk/sdk/auth"
	"github.com/tombuildsstuff/giovanni/storage/2020-08-04/queue/queues"
)

func Example() error {
	accountName := "storageaccount1"
    storageAccountKey := "ABC123...."
    queueName := "myqueue"
	domainSuffix := "core.windows.net"

	auth, err := auth.NewSharedKeyAuthorizer(accountName, storageAccountKey, auth.SharedKey)
	if err != nil {
		return fmt.Errorf("building SharedKey authorizer: %+v", err)
	}
	
    queuesClient, err := queues.NewWithBaseUri(fmt.Sprintf("https://%s.queue.%s", accountName, domainSuffix))
	if err != nil {
		return fmt.Errorf("building client for environment: %+v", err)
	}
    queuesClient.Client.SetAuthorizer(auth)
    
    ctx := context.TODO()
    metadata := map[string]string{
    	"hello": "world",
    }
	input := queues.CreateInput{
		Metadata: metadata,
    }
    if _, err := queuesClient.Create(ctx, queueName, input); err != nil {
        return fmt.Errorf("Error creating Queue: %s", err)
    }
    
    return nil 
}

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	Client *storage.Client
}

Client is the base client for Messages.

func NewWithBaseUri added in v0.21.0

func NewWithBaseUri(baseUri string) (*Client, error)

func (Client) Create

func (c Client) Create(ctx context.Context, queueName string, input CreateInput) (resp CreateResponse, err error)

Create creates the specified Queue within the specified Storage Account

func (Client) Delete

func (c Client) Delete(ctx context.Context, queueName string) (resp DeleteResponse, err error)

Delete deletes the specified Queue within the specified Storage Account

func (Client) GetMetaData

func (c Client) GetMetaData(ctx context.Context, queueName string) (resp GetMetaDataResponse, err error)

GetMetaData returns the metadata for this Queue

func (Client) GetResourceManagerResourceID added in v0.21.0

func (c Client) GetResourceManagerResourceID(subscriptionID, resourceGroup, accountName, queueName string) string

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

func (Client) GetServiceProperties

func (c Client) GetServiceProperties(ctx context.Context) (resp GetStorageServicePropertiesResponse, err error)

GetServiceProperties gets the properties for this queue

func (Client) SetMetaData

func (c Client) SetMetaData(ctx context.Context, queueName string, input SetMetaDataInput) (resp SetMetaDataResponse, err error)

SetMetaData returns the metadata for this Queue

func (Client) SetServiceProperties

SetServiceProperties sets the properties for this queue

type Cors

type Cors struct {
	CorsRule []CorsRule `xml:"CorsRule"`
}

type CorsRule

type CorsRule struct {
	AllowedOrigins  string `xml:"AllowedOrigins"`
	AllowedMethods  string `xml:"AllowedMethods"`
	AllowedHeaders  string `xml:"AllowedHeaders"`
	ExposedHeaders  string `xml:"ExposedHeaders"`
	MaxAgeInSeconds int    `xml:"MaxAgeInSeconds"`
}

type CreateInput added in v0.21.0

type CreateInput struct {
	MetaData map[string]string
}

type CreateResponse added in v0.21.0

type CreateResponse struct {
	HttpResponse *client.Response
}

type DeleteResponse added in v0.21.0

type DeleteResponse struct {
	HttpResponse *client.Response
}

type GetMetaDataResponse added in v0.21.0

type GetMetaDataResponse struct {
	HttpResponse *client.Response

	MetaData map[string]string
}

type GetStorageServicePropertiesResponse added in v0.21.0

type GetStorageServicePropertiesResponse struct {
	StorageServiceProperties
	HttpResponse *client.Response
}

type LoggingConfig

type LoggingConfig struct {
	Version         string          `xml:"Version"`
	Delete          bool            `xml:"Delete"`
	Read            bool            `xml:"Read"`
	Write           bool            `xml:"Write"`
	RetentionPolicy RetentionPolicy `xml:"RetentionPolicy"`
}

type MetricsConfig

type MetricsConfig struct {
	Version         string          `xml:"Version"`
	Enabled         bool            `xml:"Enabled"`
	RetentionPolicy RetentionPolicy `xml:"RetentionPolicy"`

	// Element IncludeAPIs is only expected when Metrics is enabled
	IncludeAPIs *bool `xml:"IncludeAPIs,omitempty"`
}

type QueueId added in v0.22.0

type QueueId struct {
	// AccountId specifies the ID of the Storage Account where this Queue exists.
	AccountId accounts.AccountId

	// QueueName specifies the name of this Queue.
	QueueName string
}

func NewQueueID added in v0.22.0

func NewQueueID(accountId accounts.AccountId, queueName string) QueueId

func ParseQueueID added in v0.22.0

func ParseQueueID(input, domainSuffix string) (*QueueId, error)

ParseQueueID parses `input` into a Queue ID using a known `domainSuffix`

func (QueueId) ID added in v0.22.0

func (b QueueId) ID() string

func (QueueId) String added in v0.22.0

func (b QueueId) String() string

type RetentionPolicy

type RetentionPolicy struct {
	Enabled bool `xml:"Enabled"`
	Days    int  `xml:"Days,omitempty"`
}

type SetMetaDataInput added in v0.21.0

type SetMetaDataInput struct {
	MetaData map[string]string
}

type SetMetaDataResponse added in v0.21.0

type SetMetaDataResponse struct {
	HttpResponse *client.Response
}

type SetStorageServicePropertiesInput added in v0.21.0

type SetStorageServicePropertiesInput struct {
	Properties StorageServiceProperties
}

type SetStorageServicePropertiesResponse added in v0.21.0

type SetStorageServicePropertiesResponse struct {
	HttpResponse *client.Response
}

type StorageQueue

type StorageQueue interface {
	Delete(ctx context.Context, queueName string) (DeleteResponse, error)
	GetMetaData(ctx context.Context, queueName string) (GetMetaDataResponse, error)
	SetMetaData(ctx context.Context, queueName string, input SetMetaDataInput) (SetMetaDataResponse, error)
	Create(ctx context.Context, queueName string, input CreateInput) (CreateResponse, error)
	GetResourceManagerResourceID(subscriptionID, resourceGroup, accountName, queueName string) string
	SetServiceProperties(ctx context.Context, input SetStorageServicePropertiesInput) (SetStorageServicePropertiesResponse, error)
	GetServiceProperties(ctx context.Context) (GetStorageServicePropertiesResponse, error)
}

type StorageServiceProperties

type StorageServiceProperties struct {
	Logging       *LoggingConfig `xml:"Logging,omitempty"`
	HourMetrics   *MetricsConfig `xml:"HourMetrics,omitempty"`
	MinuteMetrics *MetricsConfig `xml:"MinuteMetrics,omitempty"`
	Cors          *Cors          `xml:"Cors,omitempty"`
}

Jump to

Keyboard shortcuts

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