app/platform.go
func (s *platformService) Create(opts appTypes.PlatformOptions) error {
	p := appTypes.Platform{Name: opts.Name}
	if err := s.validate(p); err != nil {
		return err
	}
	err := s.storage.Insert(p)
	if err != nil {
		return err
	}
	opts.ImageName, err = servicemanager.PlatformImage.NewImage(opts.Name)
	if err != nil {
		return err
	}
	err = builder.PlatformAdd(opts)
	if err != nil {
		if imgErr := servicemanager.PlatformImage.DeleteImages(opts.Name); imgErr != nil {
			log.Errorf("unable to remove platform images: %s", imgErr)
		}
		dbErr := s.storage.Delete(p)
		if dbErr != nil {
			return tsuruErrors.NewMultiError(
				errors.Wrapf(dbErr, "unable to rollback platform add"),
				errors.Wrapf(err, "original platform add error"),
			)
		}
		return err
	}
	return servicemanager.PlatformImage.AppendImage(opts.Name, opts.ImageName)
}
func (s *platformService) Create(opts appTypes.PlatformOptions) error {
	p := appTypes.Platform{Name: opts.Name}
	if err := s.validate(p); err != nil {
		return err
	}
	err := s.storage.Insert(p)
	if err != nil {
		return err
	}
	opts.ImageName, err = servicemanager.PlatformImage.NewImage(opts.Name)
	if err != nil {
		return err
	}
	err = builder.PlatformAdd(opts)
	if err != nil {
		if imgErr := servicemanager.PlatformImage.DeleteImages(opts.Name); imgErr != nil {
			log.Errorf("unable to remove platform images: %s", imgErr)
		}
		dbErr := s.storage.Delete(p)
		if dbErr != nil {
			return tsuruErrors.NewMultiError(
				errors.Wrapf(dbErr, "unable to rollback platform add"),
				errors.Wrapf(err, "original platform add error"),
			)
		}
		return err
	}
	return servicemanager.PlatformImage.AppendImage(opts.Name, opts.ImageName)
}
// Create implements Create method of PlatformService interface