fleet/server/datastore/s3/software_installer.go
Lucas Manuel Rodriguez 404f0d3ac0
Migrate from aws-sdk-go v1 to v2 (#30308)
#29482

[Migrate to the AWS SDK for Go
v2](https://docs.aws.amazon.com/sdk-for-go/v2/developer-guide/migrate-gosdk.html)
documents how to migrate codebases.

QA on features that use AWS SDK Go:
- Bootstrap package:
  - upload:  
  - download: 
  - cleanup: 
- Software (upload, download, installation, etc.) 
  - Cloudfront: Luckly, this feature was already using aws-sdk-go-v2.
- Carves 
- Logging:
	- Firehose 
	- Kinesis 
- Lambda  (tested result logs to a lambda function on our AWS Dogfood
account)
- Email:
	- Amazon SES TODO ⚠️ (this is what Dogfood uses and a few customers)
- We cannot easily test locally, we can use dogfood or load testing
(AWS) environments.

---

- [X] Changes file added for user-visible changes in `changes/`,
`orbit/changes/` or `ee/fleetd-chrome/changes`.
See [Changes
files](https://github.com/fleetdm/fleet/blob/main/docs/Contributing/guides/committing-changes.md#changes-files)
for more information.
- [ ] Manual QA for all new/changed functionality
2025-06-30 17:45:39 -03:00

45 lines
1.2 KiB
Go

package s3
import (
"github.com/fleetdm/fleet/v4/server/config"
)
const softwareInstallersPrefix = "software-installers"
type SoftwareInstallerStore struct {
*commonFileStore
}
// NewSoftwareInstallerStore creates a new instance with the given S3 config.
func NewSoftwareInstallerStore(config config.S3Config) (*SoftwareInstallerStore, error) {
s3store, err := newS3Store(config.SoftwareInstallersToInternalCfg())
if err != nil {
return nil, err
}
return &SoftwareInstallerStore{
&commonFileStore{
s3store: s3store,
pathPrefix: softwareInstallersPrefix,
fileLabel: "software installer",
},
}, nil
}
// NewTestSoftwareInstallerStore is used in tests.
func NewTestSoftwareInstallerStore(conf config.S3Config) (*SoftwareInstallerStore, error) {
store := &s3store{
bucket: "test-bucket",
cloudFrontConfig: &config.S3CloudFrontConfig{
BaseURL: conf.SoftwareInstallersCloudFrontURL,
SigningPublicKeyID: conf.SoftwareInstallersCloudFrontURLSigningPublicKeyID,
Signer: conf.SoftwareInstallersCloudFrontSigner,
},
}
return &SoftwareInstallerStore{
&commonFileStore{
s3store: store,
pathPrefix: softwareInstallersPrefix,
fileLabel: "software installer",
},
}, nil
}