MCPcopy Index your code
hub / github.com/OverloadBlitz/cloudcent-cli / DownloadMetadataGz

Method DownloadMetadataGz

internal/api/client.go:192–206  ·  view source on GitHub ↗

DownloadMetadataGz downloads /pricing/metadata and saves as metadata.json.gz.

()

Source from the content-addressed store, hash-verified

190
191// DownloadMetadataGz downloads /pricing/metadata and saves as metadata.json.gz.
192func (c *Client) DownloadMetadataGz() error {
193 status, data, err := c.get(APIBaseURL+"/pricing/metadata", true)
194 if err != nil {
195 return fmt.Errorf("failed to download metadata: %w", err)
196 }
197 if status >= 300 {
198 return fmt.Errorf("failed to download metadata (%d): %s", status, string(data))
199 }
200
201 p, err := config.MetadataGzPath()
202 if err != nil {
203 return err
204 }
205 return os.WriteFile(p, data, 0o644)
206}
207
208// LoadMetadataFromFile reads and decompresses ~/.cloudcent/metadata.json.gz.
209func LoadMetadataFromFile() (*MetadataResponse, error) {

Calls 2

getMethod · 0.95
MetadataGzPathFunction · 0.92