cloudstorage

package
v0.0.0-...-a2f6c67 Latest Latest
Warning

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

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

Documentation

Overview

Package cloudstorage provides GCP Cloud Storage commitments client

Index

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

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

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) 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 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

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

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).

Jump to

Keyboard shortcuts

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