Documentation
¶
Overview ¶
Package database provides Azure SQL Database Reserved Capacity client
Index ¶
- type AzureRetailPrice
- type CapabilitiesClient
- type Client
- func (c *Client) GetExistingCommitments(ctx context.Context) ([]common.Commitment, error)
- func (c *Client) GetOfferingDetails(ctx context.Context, rec common.Recommendation) (*common.OfferingDetails, error)
- func (c *Client) GetRecommendations(ctx context.Context, _ *common.RecommendationParams) ([]common.Recommendation, error)
- func (c *Client) GetRegion() string
- func (c *Client) GetServiceType() common.ServiceType
- func (c *Client) GetValidResourceTypes(ctx context.Context) ([]string, error)
- func (c *Client) PurchaseCommitment(ctx context.Context, rec common.Recommendation, opts common.PurchaseOptions) (common.PurchaseResult, error)
- func (c *Client) SetCapabilitiesClient(client CapabilitiesClient)
- func (c *Client) SetManagedInstancesPager(pager SQLManagedInstancesPager)
- func (c *Client) SetRecommendationsPager(pager RecommendationsPager)
- func (c *Client) SetReservationsPager(pager ReservationsDetailsPager)
- func (c *Client) SetServersPager(pager SQLServersPager)
- func (c *Client) ValidateOffering(ctx context.Context, rec common.Recommendation) error
- type HTTPClient
- type RecommendationsPager
- type ReservationsDetailsPager
- type SQLManagedInstancesPager
- type SQLPricing
- type SQLServersPager
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 CapabilitiesClient ¶
type CapabilitiesClient interface {
ListByLocation(ctx context.Context, locationName string, options *armsql.CapabilitiesClientListByLocationOptions) (armsql.CapabilitiesClientListByLocationResponse, error)
}
CapabilitiesClient interface for SQL capabilities (enables mocking).
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client handles Azure SQL Database Reserved Capacity.
func NewClient ¶
func NewClient(cred azcore.TokenCredential, subscriptionID, region string) *Client
NewClient creates a new Azure Database client.
func NewClientWithHTTP ¶
func NewClientWithHTTP(cred azcore.TokenCredential, subscriptionID, region string, httpClient HTTPClient) *Client
NewClientWithHTTP creates a new Azure Database client with a custom HTTP client (for testing).
func (*Client) GetExistingCommitments ¶
GetExistingCommitments retrieves existing SQL Database reserved capacity using Azure Resource Graph.
func (*Client) GetOfferingDetails ¶
func (c *Client) GetOfferingDetails(ctx context.Context, rec common.Recommendation) (*common.OfferingDetails, error)
GetOfferingDetails retrieves SQL Database 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 SQL Database reservation recommendations from Azure Consumption API.
func (*Client) GetServiceType ¶
func (c *Client) GetServiceType() common.ServiceType
GetServiceType returns the service type.
func (*Client) GetValidResourceTypes ¶
GetValidResourceTypes returns valid SQL Database 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 SQL Database reserved capacity using the two-step calculatePrice->purchase flow required by Azure's Reservations API (issue #677).
func (*Client) SetCapabilitiesClient ¶
func (c *Client) SetCapabilitiesClient(client CapabilitiesClient)
SetCapabilitiesClient sets the capabilities client (for testing).
func (*Client) SetManagedInstancesPager ¶
func (c *Client) SetManagedInstancesPager(pager SQLManagedInstancesPager)
SetManagedInstancesPager sets the SQL managed instances pager (for testing).
func (*Client) SetRecommendationsPager ¶
func (c *Client) SetRecommendationsPager(pager RecommendationsPager)
SetRecommendationsPager sets the recommendations pager (for testing).
func (*Client) SetReservationsPager ¶
func (c *Client) SetReservationsPager(pager ReservationsDetailsPager)
SetReservationsPager sets the reservations pager (for testing).
func (*Client) SetServersPager ¶
func (c *Client) SetServersPager(pager SQLServersPager)
SetServersPager sets the SQL servers pager (for testing).
func (*Client) ValidateOffering ¶
ValidateOffering validates that a SQL Database SKU exists.
type HTTPClient ¶
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 ReservationsDetailsPager ¶
type ReservationsDetailsPager interface {
More() bool
NextPage(ctx context.Context) (armconsumption.ReservationsDetailsClientListResponse, error)
}
ReservationsDetailsPager interface for reservations details pager (enables mocking).
type SQLManagedInstancesPager ¶
type SQLManagedInstancesPager interface {
More() bool
NextPage(ctx context.Context) (armsql.ManagedInstancesClientListResponse, error)
}
SQLManagedInstancesPager interface for listing SQL managed instances (enables mocking).
type SQLPricing ¶
type SQLPricing struct {
HourlyRate float64
ReservationPrice float64
OnDemandPrice float64
Currency string
SavingsPercentage float64
}
SQLPricing contains pricing information for SQL Database.
type SQLServersPager ¶
type SQLServersPager interface {
More() bool
NextPage(ctx context.Context) (armsql.ServersClientListResponse, error)
}
SQLServersPager interface for listing SQL servers (enables mocking).