azureclient

package
v0.0.11 Latest Latest
Warning

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

Go to latest
Published: Nov 3, 2025 License: MIT Imports: 17 Imported by: 0

Documentation

Overview

Package azure provides Azure SDK integration for AKS MCP server.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func HandleDetectorAPIResponse added in v0.0.3

func HandleDetectorAPIResponse(resp *http.Response) ([]byte, error)

HandleDetectorAPIResponse reads and handles the response from detector API calls

func ParseAKSResourceID added in v0.0.3

func ParseAKSResourceID(resourceID string) (subscriptionID, resourceGroup, clusterName string, err error)

ParseResourceID extracts subscription, resource group, and cluster name from AKS resource ID

Types

type AzureCache

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

Cache is a simple in-memory cache for Azure resources.

func NewAzureCache

func NewAzureCache(timeout time.Duration) *AzureCache

NewAzureCache creates a new cache with the specified timeout.

func (*AzureCache) Clear

func (c *AzureCache) Clear()

Clear removes all values from the cache.

func (*AzureCache) Delete

func (c *AzureCache) Delete(key string)

Delete removes a value from the cache.

func (*AzureCache) Get

func (c *AzureCache) Get(key string) (interface{}, bool)

Get retrieves a value from the cache. Returns the value and true if the item exists and hasn't expired. Returns nil and false otherwise.

func (*AzureCache) Set

func (c *AzureCache) Set(key string, value interface{})

Set adds or updates a value in the cache with the default expiration time.

func (*AzureCache) SetWithExpiration

func (c *AzureCache) SetWithExpiration(key string, value interface{}, duration time.Duration)

SetWithExpiration adds or updates a value in the cache with a custom expiration time.

type AzureClient

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

AzureClient represents an Azure API client that can handle multiple subscriptions.

func NewAzureClient

func NewAzureClient(cfg *config.ConfigData) (*AzureClient, error)

NewAzureClient creates a new Azure client using default credentials and the provided configuration.

func (*AzureClient) GetAKSCluster

func (c *AzureClient) GetAKSCluster(ctx context.Context, subscriptionID, resourceGroup, clusterName string) (*armcontainerservice.ManagedCluster, error)

GetAKSCluster retrieves information about the specified AKS cluster.

func (*AzureClient) GetCache added in v0.0.3

func (c *AzureClient) GetCache() *AzureCache

GetCache returns the Azure cache instance

func (*AzureClient) GetDiagnosticSettings added in v0.0.3

func (c *AzureClient) GetDiagnosticSettings(ctx context.Context, subscriptionID, resourceURI string) ([]*armmonitor.DiagnosticSettingsResource, error)

GetDiagnosticSettings retrieves diagnostic settings for the specified resource.

func (*AzureClient) GetLoadBalancer

func (c *AzureClient) GetLoadBalancer(ctx context.Context, subscriptionID, resourceGroup, lbName string) (*armnetwork.LoadBalancer, error)

GetLoadBalancer retrieves information about the specified load balancer.

func (*AzureClient) GetNetworkSecurityGroup

func (c *AzureClient) GetNetworkSecurityGroup(ctx context.Context, subscriptionID, resourceGroup, nsgName string) (*armnetwork.SecurityGroup, error)

GetNetworkSecurityGroup retrieves information about the specified network security group.

func (*AzureClient) GetOrCreateClientsForSubscription

func (c *AzureClient) GetOrCreateClientsForSubscription(subscriptionID string) (*SubscriptionClients, error)

GetOrCreateClientsForSubscription gets existing clients for a subscription or creates new ones.

func (*AzureClient) GetPrivateEndpoint added in v0.0.3

func (c *AzureClient) GetPrivateEndpoint(ctx context.Context, subscriptionID, resourceGroup, peName string) (*armnetwork.PrivateEndpoint, error)

GetPrivateEndpoint retrieves information about the specified private endpoint.

func (*AzureClient) GetPrivateEndpointByID added in v0.0.3

func (c *AzureClient) GetPrivateEndpointByID(ctx context.Context, privateEndpointID string) (*armnetwork.PrivateEndpoint, error)

GetPrivateEndpointByID retrieves information about the specified private endpoint using its resource ID.

func (*AzureClient) GetResourceByID

func (c *AzureClient) GetResourceByID(ctx context.Context, resourceID string) (interface{}, error)

GetResourceByID retrieves a resource by its full Azure resource ID. It parses the ID, determines the resource type, and calls the appropriate method.

func (*AzureClient) GetRouteTable

func (c *AzureClient) GetRouteTable(ctx context.Context, subscriptionID, resourceGroup, routeTableName string) (*armnetwork.RouteTable, error)

GetRouteTable retrieves information about the specified route table.

func (*AzureClient) GetSubnet

func (c *AzureClient) GetSubnet(ctx context.Context, subscriptionID, resourceGroup, vnetName, subnetName string) (*armnetwork.Subnet, error)

GetSubnet retrieves information about the specified subnet in a virtual network.

func (*AzureClient) GetVMSS added in v0.0.3

func (c *AzureClient) GetVMSS(ctx context.Context, subscriptionID, resourceGroup, vmssName string) (*armcompute.VirtualMachineScaleSet, error)

GetVMSS retrieves information about the specified VMSS.

func (*AzureClient) GetVirtualNetwork

func (c *AzureClient) GetVirtualNetwork(ctx context.Context, subscriptionID, resourceGroup, vnetName string) (*armnetwork.VirtualNetwork, error)

GetVirtualNetwork retrieves information about the specified virtual network.

func (*AzureClient) MakeDetectorAPICall added in v0.0.3

func (c *AzureClient) MakeDetectorAPICall(ctx context.Context, url string, subscriptionID string) (*http.Response, error)

MakeDetectorAPICall makes an HTTP request to Azure Management API for detector operations

type SubscriptionClients

type SubscriptionClients struct {
	SubscriptionID           string
	ContainerServiceClient   *armcontainerservice.ManagedClustersClient
	VNetClient               *armnetwork.VirtualNetworksClient
	SubnetsClient            *armnetwork.SubnetsClient
	RouteTableClient         *armnetwork.RouteTablesClient
	NSGClient                *armnetwork.SecurityGroupsClient
	LoadBalancerClient       *armnetwork.LoadBalancersClient
	PrivateEndpointsClient   *armnetwork.PrivateEndpointsClient
	VMSSClient               *armcompute.VirtualMachineScaleSetsClient
	VMSSVMsClient            *armcompute.VirtualMachineScaleSetVMsClient
	DiagnosticSettingsClient *armmonitor.DiagnosticSettingsClient
}

SubscriptionClients contains Azure clients for a specific subscription.

Jump to

Keyboard shortcuts

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