Exemplo n.º 1
0
func (d Distribution) invalidate(m *Manifest) error {
	var items []*string
	for _, path := range invalidationPathsFromManifest(m) {
		items = append(items, aws.String(path))
	}
	invalidationID := fmt.Sprintf("static-%x", m.digest)
	input := &cloudfront.CreateInvalidationInput{
		DistributionID: aws.String(d.ID),
		InvalidationBatch: &cloudfront.InvalidationBatch{
			CallerReference: aws.String(invalidationID),
			Paths: &cloudfront.Paths{
				Quantity: aws.Long(int64(len(items))),
				Items:    items,
			},
		},
	}
	_, err := cfClient.CreateInvalidation(input)
	if err != nil {
		// printAWSError(err)
		return err
	}

	printer.Infof("Invalidated %d paths for %v\n", len(items), d.DomainName)
	for _, cname := range d.Aliases {
		printer.Infoln("  -> ", *cname)
	}
	return nil
}
Exemplo n.º 2
0
func (c *Config) loadFromPath(path string) {
	path, _ = filepath.Abs(path)
	file, err := os.Open(path)
	if os.IsNotExist(err) {
		printer.Infof("Config file %s not found\n", path)
		os.Exit(1)
	}
	c.load(path, file)
}
Exemplo n.º 3
0
func printStats(stats staticlib.PushStats) {
	printer.Infof("Done: %d files created, %d updated, %d deleted, and %d skipped ~ %s\n", stats.Created, stats.Updated, stats.Deleted, stats.Skipped, formatByteSize(float64(stats.Bytes)))
}