azure

package
v0.0.0-...-17967aa Latest Latest
Warning

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

Go to latest
Published: Apr 1, 2024 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ApplicationGatewayID

func ApplicationGatewayID(subscriptionID SubscriptionID, resourceGroup ResourceGroup, applicationGatewayName ResourceName) string

ApplicationGatewayID generates a application gateway resource id

func ConvertToClusterResourceGroup

func ConvertToClusterResourceGroup(subscriptionID SubscriptionID, resourceGroup ResourceGroup, err error) (string, error)

ConvertToClusterResourceGroup converts infra resource group to aks cluster ID

func GetAuthorizerWithRetry

func GetAuthorizerWithRetry(authLocation string, useManagedidentity bool, cpConfig *CloudProviderConfig, maxAuthRetryCount int, retryPause time.Duration) (authorizer autorest.Authorizer, err error)

GetAuthorizerWithRetry return azure.Authorizer

func GetOperationIDFromPollingURL

func GetOperationIDFromPollingURL(pollingURL string) string

GetOperationIDFromPollingURL extracts operationID from pollingURL

func ParseResourceID

func ParseResourceID(ID string) (SubscriptionID, ResourceGroup, ResourceName)

ParseResourceID gets subscriptionId, resource group, resource name from resourceID

func ParseSubResourceID

func ParseSubResourceID(ID string) (SubscriptionID, ResourceGroup, ResourceName, ResourceName)

ParseSubResourceID gets subscriptionId, resource group, resource name, sub resource name from resourceID

func ResourceGroupID

func ResourceGroupID(subscriptionID SubscriptionID, resourceGroup ResourceGroup) string

ResourceGroupID generates a resource group resource id

func ResourceID

func ResourceID(subscriptionID SubscriptionID, resourceGroup ResourceGroup, provider string, resourceKind string, resourcePath string) string

ResourceID generates a resource id

func RouteTableID

func RouteTableID(subscriptionID SubscriptionID, resourceGroup ResourceGroup, routeTableName ResourceName) string

RouteTableID generates a route table resource id

Types

type ApplyRouteTableFunc

type ApplyRouteTableFunc func(string, string) error

ApplyRouteTableFunc is a function type

type AzClient

type AzClient interface {
	SetAuthorizer(authorizer autorest.Authorizer)
	SetSender(sender autorest.Sender)
	SetDuration(retryDuration time.Duration)

	ApplyRouteTable(string, string) error
	WaitForGetAccessOnGateway(maxRetryCount int) error
	GetGateway() (n.ApplicationGateway, error)
	UpdateGateway(*n.ApplicationGateway) error
	DeployGatewayWithVnet(ResourceGroup, ResourceName, ResourceName, string, string) error
	DeployGatewayWithSubnet(string, string) error

	GetPublicIP(string) (n.PublicIPAddress, error)
}

AzClient is an interface for client to Azure

func NewAzClient

func NewAzClient(subscriptionID SubscriptionID, resourceGroupName ResourceGroup, appGwName ResourceName, uniqueUserAgentSuffix, clientID string) AzClient

NewAzClient returns an Azure Client

type CloudProviderConfig

type CloudProviderConfig struct {
	Cloud                   string `json:"cloud"`
	TenantID                string `json:"tenantId"`
	SubscriptionID          string `json:"subscriptionId"`
	ClientID                string `json:"aadClientId"`
	ClientSecret            string `json:"aadClientSecret"`
	ResourceGroup           string `json:"resourceGroup"`
	Region                  string `json:"location"`
	VNetName                string `json:"vnetName"`
	VNetResourceGroup       string `json:"vnetResourceGroup"`
	RouteTableName          string `json:"routeTableName"`
	RouteTableResourceGroup string `json:"routeTableResourceGroup"`
	UserAssignedIdentityID  string `json:"userAssignedIdentityID"`
}

CloudProviderConfig represent the CloudProvider Context file such as Azure

func NewCloudProviderConfig

func NewCloudProviderConfig(path string) (*CloudProviderConfig, error)

NewCloudProviderConfig returns an CloudProviderConfig struct from file path

type DeployGatewayFunc

type DeployGatewayFunc func(string) error

DeployGatewayFunc is a function type

type FakeAzClient

FakeAzClient is a fake struct for AzClient

func NewFakeAzClient

func NewFakeAzClient() *FakeAzClient

NewFakeAzClient returns a fake Azure Client

func (*FakeAzClient) ApplyRouteTable

func (az *FakeAzClient) ApplyRouteTable(subnetID string, routeTableID string) error

ApplyRouteTable runs ApplyRouteTableFunc

func (*FakeAzClient) DeployGatewayWithSubnet

func (az *FakeAzClient) DeployGatewayWithSubnet(subnetID, skuName string) (err error)

DeployGatewayWithSubnet runs DeployGatewayFunc

func (*FakeAzClient) DeployGatewayWithVnet

func (az *FakeAzClient) DeployGatewayWithVnet(resourceGroupName ResourceGroup, vnetName ResourceName, subnetName ResourceName, subnetPrefix, skuName string) (err error)

DeployGatewayWithVnet runs DeployGatewayFunc

func (*FakeAzClient) GetGateway

func (az *FakeAzClient) GetGateway() (n.ApplicationGateway, error)

GetGateway runs GetGatewayFunc and return a gateway

func (*FakeAzClient) GetPublicIP

func (az *FakeAzClient) GetPublicIP(resourceID string) (n.PublicIPAddress, error)

GetPublicIP runs GetPublicIPFunc

func (*FakeAzClient) SetAuthorizer

func (az *FakeAzClient) SetAuthorizer(authorizer autorest.Authorizer)

SetAuthorizer is an empty function

func (*FakeAzClient) SetDuration

func (az *FakeAzClient) SetDuration(retryDuration time.Duration)

SetDuration is an empty function

func (*FakeAzClient) SetSender

func (az *FakeAzClient) SetSender(sender autorest.Sender)

SetSender is an empty function

func (*FakeAzClient) UpdateGateway

func (az *FakeAzClient) UpdateGateway(appGwObj *n.ApplicationGateway) (err error)

UpdateGateway runs UpdateGatewayFunc and return a gateway

func (*FakeAzClient) WaitForGetAccessOnGateway

func (az *FakeAzClient) WaitForGetAccessOnGateway(maxRetryCount int) error

WaitForGetAccessOnGateway runs GetGatewayFunc until it returns a gateway

type GetGatewayFunc

type GetGatewayFunc func() (n.ApplicationGateway, error)

GetGatewayFunc is a function type

type GetPublicIPFunc

type GetPublicIPFunc func(string) (n.PublicIPAddress, error)

GetPublicIPFunc is a function type

type ResourceGroup

type ResourceGroup string

ResourceGroup is the resource group in which resource is deployed in the resourceID

type ResourceName

type ResourceName string

ResourceName is the resource name in the resourceID

type SubscriptionID

type SubscriptionID string

SubscriptionID is the subscription of the resource in the resourceID

type UpdateGatewayFunc

type UpdateGatewayFunc func(*n.ApplicationGateway) error

UpdateGatewayFunc is a function type

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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