azure

package
v1.3.3 Latest Latest
Warning

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

Go to latest
Published: Jul 5, 2022 License: CC-BY-4.0 Imports: 23 Imported by: 0

Documentation

Overview

Copyright (C) Microsoft Corporation. All rights reserved. Licensed under the MIT License. See LICENSE-CODE in the project root for license information. Package azure implements various azure tools

Copyright (C) Microsoft Corporation. All rights reserved. Licensed under the MIT License. See LICENSE-CODE in the project root for license information.

Copyright (C) Microsoft Corporation. All rights reserved. Licensed under the MIT License. See LICENSE-CODE in the project root for license information.

Copyright (C) Microsoft Corporation. All rights reserved. Licensed under the MIT License. See LICENSE-CODE in the project root for license information. Package azure implements various azure tools

Copyright (C) Microsoft Corporation. All rights reserved. Licensed under the MIT License. See LICENSE-CODE in the project root for license information.

Copyright (C) Microsoft Corporation. All rights reserved. Licensed under the MIT License. See LICENSE-CODE in the project root for license information.

Copyright (C) Microsoft Corporation. All rights reserved. Licensed under the MIT License. See LICENSE-CODE in the project root for license information. Package azure implements various azure tools

Copyright (C) Microsoft Corporation. All rights reserved. Licensed under the MIT License. See LICENSE-CODE in the project root for license information. Package azure implements various azure tools

Copyright (C) Microsoft Corporation. All rights reserved. Licensed under the MIT License. See LICENSE-CODE in the project root for license information. Package azure implements various azure tools

Index

Constants

View Source
const (
	AZURE_TENANT_ID       = "AZURE_TENANT_ID"
	AZURE_CLIENT_ID       = "AZURE_CLIENT_ID"
	AZURE_CLIENT_SECRET   = "AZURE_CLIENT_SECRET"
	AZURE_SUBSCRIPTION_ID = "AZURE_SUBSCRIPTION_ID"

	AZURE_STORAGE_ACCOUNT     = "AZURE_STORAGE_ACCOUNT"
	AZURE_STORAGE_ACCOUNT_KEY = "AZURE_STORAGE_ACCOUNT_KEY"

	AZURE_EVENTHUB_SENDERKEYNAME = "AZURE_EVENTHUB_SENDERKEYNAME"
	AZURE_EVENTHUB_SENDERKEY     = "AZURE_EVENTHUB_SENDERKEY"
	AZURE_EVENTHUB_NAMESPACENAME = "AZURE_EVENTHUB_NAMESPACENAME"

	DEFAULT_OPERATION_POLL_TIME = time.Duration(10) * time.Second
	MAX_OPERATION_POLL_TIME     = time.Duration(60) * time.Second
)
View Source
const AVERE_USAGE_GUID = "7a86fa6c-a5c7-4f21-b9fa-efa3dcbfbb86"
View Source
const (
	PrintStatsCycle = time.Duration(30) * time.Second // 30 seconds
)

Variables

This section is empty.

Functions

func AnthonyBernieDefaultHTTPClientFactory

func AnthonyBernieDefaultHTTPClientFactory() pipeline.Factory

AnthonyBernieDefaultHTTPClientFactory creates a DefaultHTTPClientPolicyFactory object that sends HTTP requests to a Go's default http.Client.

func FatalValidateContainerName

func FatalValidateContainerName(containerName string)

FatalValidateContainerName exits the program if the containername is not valid

func FatalValidateQueueName

func FatalValidateQueueName(queueName string)

FatalValidateQueue exits the program if the queuename is not valid

func GetSubnetId

func GetSubnetId(subscriptionId string, resourceGroupName string, vnetName string, subnetName string) string

func ValidateContainerName

func ValidateContainerName(containerName string) (bool, string)

ValidateContainerName validates container name according to https://docs.microsoft.com/en-us/rest/api/storageservices/create-container

func ValidateQueueName

func ValidateQueueName(queueName string) (bool, string)

ValidateQueue validates queue name according to https://docs.microsoft.com/en-us/rest/api/storageservices/naming-queues-and-metadata

Types

type BlobContainer

type BlobContainer struct {
	ContainerURL azblob.ContainerURL
	Context      context.Context
}

BlobContainer represents a blob container, this can be used to read/write blockblobs, appendblobs, or page blobs The implementation has been influenced by https://github.com/Azure/azure-storage-blob-go/blob/master/azblob/zt_examples_test.go RESTAPI: https://docs.microsoft.com/en-us/rest/api/storageservices/blob-service-rest-api AZBLOB: https://godoc.org/github.com/Azure/azure-storage-blob-go/azblob#pkg-examples

func InitializeBlobContainer

func InitializeBlobContainer(ctx context.Context, storageAccount string, storageAccountKey string, containerName string) (*BlobContainer, error)

InitializeBlob creates a Blob to represent the Azure Storage Queue

func (*BlobContainer) DeleteBlob

func (b *BlobContainer) DeleteBlob(blobname string) error

DeleteBlob deletes the blob

func (*BlobContainer) DownloadBlob

func (b *BlobContainer) DownloadBlob(blobname string) ([]byte, error)

DownloadBlob downloads the bytes of the blob

func (*BlobContainer) UploadBlob

func (b *BlobContainer) UploadBlob(blobname string, data []byte) error

UploadBlob uploads the blob to the container

type EventHubSender

type EventHubSender struct {
	// contains filtered or unexported fields
}

EventHubSender sends messages to Azure Event Hub

func InitializeEventHubSender

func InitializeEventHubSender(
	ctx context.Context,
	senderKeyName string,
	senderKey string,
	eventHubNamespaceName string,
	eventHubName string) (*EventHubSender, error)

InitializeEventHubSender initializes an event hub sender

func (*EventHubSender) IsSenderComplete

func (e *EventHubSender) IsSenderComplete() bool

func (*EventHubSender) RecordTiming

func (e *EventHubSender) RecordTiming(bytes []byte)

RecordTiming implements interface Profiler

type Queue

type Queue struct {
	QueueURL    azqueue.QueueURL
	MessagesURL azqueue.MessagesURL
	Context     context.Context
}

Queue represents a single azure storage queue The implementation has been influenced by https://github.com/Azure/azure-storage-queue-go/blob/master/azqueue/zt_examples_test.go

func InitializeQueue

func InitializeQueue(ctx context.Context, storageAccount string, storageAccountKey string, queueName string) *Queue

InitializeQueue creates a Queue to represent the Azure Storage Queue, panic if error

func InitializeQueueNonFatal

func InitializeQueueNonFatal(ctx context.Context, storageAccount string, storageAccountKey string, queueName string) (*Queue, error)

InitializeQueueNonFatal creates a Queue to represent the Azure Storage Queue

func (*Queue) DeleteMessage

func (q *Queue) DeleteMessage(messageID azqueue.MessageID, popReceipt azqueue.PopReceipt) (*azqueue.MessageIDDeleteResponse, error)

DeleteMessage deletes the message from the queue

func (*Queue) Dequeue

func (q *Queue) Dequeue(maxMessages int32, visibilityTimeout time.Duration) (*azqueue.DequeuedMessagesResponse, error)

Dequeue marks the item in the storage invisible, but the message will re-appear until deleted

func (*Queue) Enqueue

func (q *Queue) Enqueue(message string) error

Enqueue enqueues the message to the queue

func (*Queue) IsQueueEmpty

func (q *Queue) IsQueueEmpty() (bool, error)

func (*Queue) Peek

func (q *Queue) Peek(maxMessages int32) (*azqueue.PeekedMessagesResponse, error)

func (*Queue) UpdateVisibilityTimeout

func (q *Queue) UpdateVisibilityTimeout(messageID azqueue.MessageID, popReceipt azqueue.PopReceipt, visibilityTimeout time.Duration, message string) (*azqueue.UpdatedMessageResponse, error)

type ResourceGroup

type ResourceGroup struct {
	GroupsClient resources.GroupsClient
	Context      context.Context
}

func InitializeResourceGroup

func InitializeResourceGroup(ctx context.Context, authorizer autorest.Authorizer, subscriptionId string) *ResourceGroup

func (*ResourceGroup) GetResourceGroupIntTag

func (rg *ResourceGroup) GetResourceGroupIntTag(resourceGroupName string, tagName string) (int, error)

func (*ResourceGroup) SetTotalNodesIntTag

func (rg *ResourceGroup) SetTotalNodesIntTag(resourceGroupName string, tagName string, val int) (*resources.Group, error)

type Vmss

type Vmss struct {
	VmssClient compute.VirtualMachineScaleSetsClient
	Context    context.Context
}

func InitializeVmss

func InitializeVmss(ctx context.Context, authorizer autorest.Authorizer, subscriptionId string) *Vmss

func (*Vmss) Create

func (*Vmss) ListVMSS

func (v *Vmss) ListVMSS(resourceGroupName string) ([]compute.VirtualMachineScaleSet, error)

func (*Vmss) Update

type VmssOperation

type VmssOperation struct {
	LastQuery    time.Time
	WaitDuration time.Duration
	Attempts     int
	FutureAPI    azure.FutureAPI
}

type VmssOperationManager

type VmssOperationManager struct {
	Context context.Context
	Client  autorest.Client
	// contains filtered or unexported fields
}

func InitializeVmssOperationManager

func InitializeVmssOperationManager(ctx context.Context, client autorest.Client) *VmssOperationManager

func (*VmssOperationManager) AddWatchOperation

func (v *VmssOperationManager) AddWatchOperation(vmssName string, futureAPI azure.FutureAPI)

func (*VmssOperationManager) IsComplete

func (v *VmssOperationManager) IsComplete(vmssName string) bool

func (*VmssOperationManager) Run

func (v *VmssOperationManager) Run(syncWaitGroup *sync.WaitGroup)

Jump to

Keyboard shortcuts

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