azure

package
v0.0.0-...-074d584 Latest Latest
Warning

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

Go to latest
Published: Dec 23, 2024 License: Apache-2.0 Imports: 4 Imported by: 8

Documentation

Index

Constants

View Source
const (
	// DatabaseEndpointSuffix is the Azure database endpoint suffix. Used for
	// MySQL, PostgreSQL, etc.
	DatabaseEndpointSuffix = ".database.azure.com"

	// RedisEndpointSuffix is the endpoint suffix for Redis.
	RedisEndpointSuffix = ".redis.cache.windows.net"

	// RedisEnterpriseEndpointSuffix is the endpoint suffix for Redis Enterprise.
	RedisEnterpriseEndpointSuffix = ".redisenterprise.cache.azure.net"

	// MSSQLEndpointSuffix is the Azure SQL Server endpoint suffix.
	MSSQLEndpointSuffix = ".database.windows.net"
)

Variables

This section is empty.

Functions

func GetHostFromRedisURI

func GetHostFromRedisURI(uri string) (string, error)

GetHostFromRedisURI extracts host name from a Redis URI. The URI may start with "redis://", "rediss://", or without. The URI may also have parameters like "?mode=cluster".

func IsAzureEndpoint

func IsAzureEndpoint(hostname string) bool

IsAzureEndpoint returns true if the input URI is an Azure endpoint.

The code implements approximate solution based on: - https://management.azure.com/metadata/endpoints?api-version=2019-05-01 - https://github.com/Azure/azure-cli/blob/dev/src/azure-cli-core/azure/cli/core/cloud.py

func IsCacheForRedisEndpoint

func IsCacheForRedisEndpoint(endpoint string) bool

IsCacheForRedisEndpoint returns true if provided endpoint is a valid Azure Cache for Redis endpoint.

func IsDatabaseEndpoint

func IsDatabaseEndpoint(endpoint string) bool

IsDatabaseEndpoint returns true if provided endpoint is a valid database endpoint.

func IsMSSQLServerEndpoint

func IsMSSQLServerEndpoint(endpoint string) bool

IsMSSQLServerEndpoint returns true if provided endpoint is a valid SQL server database endpoint.

func IsRedisEndpoint

func IsRedisEndpoint(endpoint string) bool

IsRedisEndpoint returns true if provided endpoint is a valid Redis (non-Enterprise tier) endpoint.

func IsRedisEnterpriseEndpoint

func IsRedisEnterpriseEndpoint(endpoint string) bool

IsRedisEnterpriseEndpoint returns true if provided endpoint is a valid Redis Enterprise endpoint.

func NormalizeLocation

func NormalizeLocation(input string) string

NormalizeLocation converts a Azure location in various formats to the same simple format.

This function assumes the input location is in one of the following formats: - Name (the "simple" format): "northcentralusstage" - Display name: "North Central US (Stage)" - Regional display name: "(US) North Central US (Stage)"

Note that the location list can be generated from `az account list-locations -o table`. However, this CLI command only lists the locations for the current active subscription so it may not show locations in other parititions like Government or China.

func ParseCacheForRedisEndpoint

func ParseCacheForRedisEndpoint(endpoint string) (name string, err error)

ParseCacheForRedisEndpoint extracts database server name from Azure Cache for Redis endpoint.

func ParseDatabaseEndpoint

func ParseDatabaseEndpoint(endpoint string) (name string, err error)

ParseDatabaseEndpoint extracts database server name from Azure endpoint.

func ParseMSSQLEndpoint

func ParseMSSQLEndpoint(endpoint string) (name string, err error)

ParseMSSQLEndpoint extracts database server name from Azure endpoint.

Types

This section is empty.

Jump to

Keyboard shortcuts

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