Documentation
¶
Overview ¶
Package redshift provides AWS Redshift Reserved Nodes client
Index ¶
- type API
- 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(_ context.Context, _ *common.RecommendationParams) ([]common.Recommendation, error)
- func (c *Client) GetRegion() string
- func (c *Client) GetServiceType() common.ServiceType
- func (c *Client) PurchaseCommitment(ctx context.Context, rec common.Recommendation, opts common.PurchaseOptions) (common.PurchaseResult, error)
- func (c *Client) ReconcilePurchase(ctx context.Context, req common.ReconcileRequest) common.ReconcileResult
- func (c *Client) SetRedshiftAPI(api API)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type API ¶
type API interface {
PurchaseReservedNodeOffering(ctx context.Context, params *redshift.PurchaseReservedNodeOfferingInput, optFns ...func(*redshift.Options)) (*redshift.PurchaseReservedNodeOfferingOutput, error)
DescribeReservedNodeOfferings(ctx context.Context, params *redshift.DescribeReservedNodeOfferingsInput, optFns ...func(*redshift.Options)) (*redshift.DescribeReservedNodeOfferingsOutput, error)
DescribeReservedNodes(ctx context.Context, params *redshift.DescribeReservedNodesInput, optFns ...func(*redshift.Options)) (*redshift.DescribeReservedNodesOutput, error)
}
API defines the interface for Redshift operations (enables mocking).
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client handles AWS Redshift Reserved Nodes.
func NewClient ¶
NewClient creates a new Redshift client with purchase-path retry/timeout settings. See purchasecfg for rationale.
func (*Client) GetExistingCommitments ¶
GetExistingCommitments retrieves existing Redshift Reserved Nodes.
func (*Client) GetOfferingDetails ¶
func (c *Client) GetOfferingDetails(ctx context.Context, rec common.Recommendation) (*common.OfferingDetails, error)
GetOfferingDetails retrieves offering details. All prices are per ONE reservation (callers multiply by rec.Count): UpfrontCost is FixedPrice, RecurringCost the hourly rate, TotalCost upfront plus hourly over the offering duration.
func (*Client) GetRecommendations ¶
func (c *Client) GetRecommendations(_ context.Context, _ *common.RecommendationParams) ([]common.Recommendation, error)
GetRecommendations returns empty as Redshift uses centralized Cost Explorer recommendations.
func (*Client) GetServiceType ¶
func (c *Client) GetServiceType() common.ServiceType
GetServiceType returns the service type.
func (*Client) PurchaseCommitment ¶
func (c *Client) PurchaseCommitment(ctx context.Context, rec common.Recommendation, opts common.PurchaseOptions) (common.PurchaseResult, error)
PurchaseCommitment purchases a Redshift Reserved Node.
The purchase API takes no client token, so a re-drive is recognized by matching an owned node on offering ID, node count and start time (see findMatchingNodes). With an empty IdempotencyToken (CLI) no lookup runs. The tokenized path relies on the caller contract documented on findMatchingNodes: no concurrent same-spec purchase for the account and region.
With an IdempotencyToken and PurchaseOptions.AttemptJournal (go#107) the attempt is also recorded: sending before the call, then purchased or outcome_unknown. A node recorded as purchased by an earlier attempt is adopted without the window, and an unresolved earlier attempt that the window cannot resolve refuses. The window dedupe alone applies when no journal is set.
Reserved nodes cannot be tagged, so the purchased node is not tagged.
func (*Client) ReconcilePurchase ¶
func (c *Client) ReconcilePurchase(ctx context.Context, req common.ReconcileRequest) common.ReconcileResult
ReconcilePurchase reports, read-only, whether a purchase that returned ErrOutcomeUnknown landed. Any doubt or failure is Unknown; see purchasecfg.Decide.
func (*Client) SetRedshiftAPI ¶
SetRedshiftAPI sets a custom Redshift API client (for testing).