Documentation
¶
Overview ¶
Package cloudstorage provides GCP Cloud Storage commitments client
Index ¶
- type BillingService
- type BucketHandle
- type BucketIterator
- type Client
- func (c *Client) GetExistingCommitments(_ 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) 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) SetBillingService(svc BillingService)
- func (c *Client) SetRecommenderClient(_ RecommenderClient)deprecated
- func (c *Client) SetStorageService(svc StorageService)
- func (c *Client) ValidateOffering(ctx context.Context, rec common.Recommendation) error
- type RecommenderClientdeprecated
- type RecommenderIteratordeprecated
- type StoragePricing
- type StorageService
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BillingService ¶
type BillingService interface {
ListSKUs(serviceID string) (*cloudbilling.ListSkusResponse, error)
}
BillingService interface for billing operations (enables mocking).
type BucketHandle ¶
type BucketHandle interface {
Create(ctx context.Context, projectID string, attrs *storage.BucketAttrs) error
}
BucketHandle interface for bucket operations (enables mocking).
type BucketIterator ¶
type BucketIterator interface {
Next() (*storage.BucketAttrs, error)
}
BucketIterator interface for bucket iteration (enables mocking).
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client handles GCP Cloud Storage commitments.
func NewClient ¶
func NewClient(ctx context.Context, projectID, region string, opts ...option.ClientOption) (*Client, error)
NewClient creates a new GCP Cloud Storage client.
func (*Client) GetExistingCommitments ¶
GetExistingCommitments returns an empty slice for Cloud Storage. GCP Cloud Storage has no commitment API: there is no committed-use discount purchase for GCS, and enumerating regional buckets does not represent a commitment -- it caused every bucket in a region to appear as a "commitment" in the UI (10-L2). Return empty until a proper commitment-detection path is available.
func (*Client) GetOfferingDetails ¶
func (c *Client) GetOfferingDetails(ctx context.Context, rec common.Recommendation) (*common.OfferingDetails, error)
GetOfferingDetails retrieves Cloud Storage offering details from GCP Billing API.
func (*Client) GetRecommendations ¶
func (c *Client) GetRecommendations(_ context.Context, _ *common.RecommendationParams) ([]common.Recommendation, error)
GetRecommendations always returns an error: Google has no commitment product for Cloud Storage (issue #78), so there is nothing to recommend. The error is explicit so callers do not read an empty result as "nothing to buy".
func (*Client) GetServiceType ¶
func (c *Client) GetServiceType() common.ServiceType
GetServiceType returns the service type.
func (*Client) GetValidResourceTypes ¶
GetValidResourceTypes returns valid Cloud Storage classes.
func (*Client) PurchaseCommitment ¶
func (c *Client) PurchaseCommitment(ctx context.Context, rec common.Recommendation, opts common.PurchaseOptions) (common.PurchaseResult, error)
PurchaseCommitment is intentionally a no-op for Cloud Storage: GCP has no CUD or commitment purchase API for GCS at all. The previous implementation created a brand-new empty bucket, which is not a commitment and incurs ongoing cost, so a "purchase" silently provisioned billable infrastructure. Cloud Storage recommendations are therefore advisory only; this returns a clear not-supported error and never calls any resource-creation API (issue #640).
func (*Client) SetBillingService ¶
func (c *Client) SetBillingService(svc BillingService)
SetBillingService sets the billing service (for testing).
func (*Client) SetRecommenderClient
deprecated
func (c *Client) SetRecommenderClient(_ RecommenderClient)
SetRecommenderClient ignores the supplied client and does not close it.
Deprecated: Cloud Storage has no commitment recommender.
func (*Client) SetStorageService ¶
func (c *Client) SetStorageService(svc StorageService)
SetStorageService sets the storage service (for testing).
func (*Client) ValidateOffering ¶
ValidateOffering validates that a storage class exists.
type RecommenderClient
deprecated
type RecommenderClient interface {
ListRecommendations(ctx context.Context, req *recommenderpb.ListRecommendationsRequest) RecommenderIterator
Close() error
}
RecommenderClient preserves the legacy injection API for source compatibility.
Deprecated: Cloud Storage has no commitment recommender.
type RecommenderIterator
deprecated
type RecommenderIterator interface {
Next() (*recommenderpb.Recommendation, error)
}
RecommenderIterator preserves the legacy iteration API for source compatibility.
Deprecated: Cloud Storage has no commitment recommender.
type StoragePricing ¶
type StoragePricing struct {
HourlyRate float64
CommitmentPrice float64
OnDemandPrice float64
Currency string
SavingsPercentage float64
}
StoragePricing contains pricing information for Cloud Storage.
type StorageService ¶
type StorageService interface {
Buckets(ctx context.Context, projectID string) BucketIterator
Bucket(name string) BucketHandle
Close() error
}
StorageService interface for storage operations (enables mocking).