cache

package
v0.0.0-...-16b5795 Latest Latest
Warning

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

Go to latest
Published: Oct 10, 2026 License: OSL-3.0 Imports: 20 Imported by: 0

Documentation

Overview

Package cache provides Azure Cache for Redis Reserved Capacity client

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AzureRetailPrice

type AzureRetailPrice = pricing.Page[pricing.RetailPriceItem]

AzureRetailPrice is the response envelope for the Azure Retail Prices API.

type Client

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

Client handles Azure Cache for Redis Reserved Capacity.

func NewClient

func NewClient(cred azcore.TokenCredential, subscriptionID, region string) *Client

NewClient creates a new Azure Cache client.

func NewClientWithHTTP

func NewClientWithHTTP(cred azcore.TokenCredential, subscriptionID, region string, httpClient HTTPClient) *Client

NewClientWithHTTP creates a new Azure Cache client with a custom HTTP client (for testing).

func (*Client) GetExistingCommitments

func (c *Client) GetExistingCommitments(ctx context.Context) ([]common.Commitment, error)

GetExistingCommitments retrieves existing Redis Cache reserved capacity.

func (*Client) GetOfferingDetails

func (c *Client) GetOfferingDetails(ctx context.Context, rec common.Recommendation) (*common.OfferingDetails, error)

GetOfferingDetails retrieves Redis Cache reservation offering details from Azure Retail Prices API.

func (*Client) GetRecommendations

func (c *Client) GetRecommendations(ctx context.Context, _ *common.RecommendationParams) ([]common.Recommendation, error)

GetRecommendations gets Redis Cache reservation recommendations from Azure Consumption API.

func (*Client) GetRegion

func (c *Client) GetRegion() string

GetRegion returns the region.

func (*Client) GetServiceType

func (c *Client) GetServiceType() common.ServiceType

GetServiceType returns the service type.

func (*Client) GetValidResourceTypes

func (c *Client) GetValidResourceTypes(ctx context.Context) ([]string, error)

GetValidResourceTypes returns valid Redis Cache SKUs from Azure API.

func (*Client) PurchaseCommitment

func (c *Client) PurchaseCommitment(ctx context.Context, rec common.Recommendation, opts common.PurchaseOptions) (common.PurchaseResult, error)

PurchaseCommitment purchases Redis Cache reserved capacity using the two-step calculatePrice->purchase flow required by Azure's Reservations API (issue #677).

func (*Client) SetRecommendationsPager

func (c *Client) SetRecommendationsPager(pager RecommendationsPager)

SetRecommendationsPager sets the recommendations pager (for testing).

func (*Client) SetRedisCachesPager

func (c *Client) SetRedisCachesPager(pager RedisCachesPager)

SetRedisCachesPager sets the Redis caches pager (for testing).

func (*Client) SetReservationsPager

func (c *Client) SetReservationsPager(pager ReservationsDetailsPager)

SetReservationsPager sets the reservations pager (for testing).

func (*Client) ValidateOffering

func (c *Client) ValidateOffering(ctx context.Context, rec common.Recommendation) error

ValidateOffering validates that a Redis Cache SKU exists.

type HTTPClient

type HTTPClient interface {
	Do(req *http.Request) (*http.Response, error)
}

HTTPClient interface for HTTP operations (enables mocking).

type RecommendationsPager

type RecommendationsPager interface {
	More() bool
	NextPage(ctx context.Context) (armconsumption.ReservationRecommendationsClientListResponse, error)
}

RecommendationsPager interface for recommendations pager (enables mocking).

type RedisCachesPager

type RedisCachesPager interface {
	More() bool
	NextPage(ctx context.Context) (armredis.ClientListBySubscriptionResponse, error)
}

RedisCachesPager interface for Redis caches pager (enables mocking).

type RedisPricing

type RedisPricing struct {
	HourlyRate        float64
	ReservationPrice  float64
	OnDemandPrice     float64
	Currency          string
	SavingsPercentage float64
}

RedisPricing contains pricing information for Redis Cache.

type ReservationsDetailsPager

type ReservationsDetailsPager interface {
	More() bool
	NextPage(ctx context.Context) (armconsumption.ReservationsDetailsClientListResponse, error)
}

ReservationsDetailsPager interface for reservations details pager (enables mocking).

Jump to

Keyboard shortcuts

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