Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: don't require dash when passing cloud and provide comments on handling autodiscover with container URIs #466

Merged
merged 2 commits into from
Jan 29, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 7 additions & 5 deletions falcon/cloud.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,19 +32,21 @@ func Cloud(cloudString string) CloudType {
// CloudValidate parses cloud string (example: us-1, us-2, eu-1, us-gov-1, etc.). Error is returned when string cannot be recognized.
func CloudValidate(cloudString string) (CloudType, error) {
trimmed := strings.TrimSpace(cloudString)
lower := strings.ToLower(trimmed)
stripped := strings.ReplaceAll(trimmed, "-", "")
lower := strings.ToLower(stripped)

switch lower {
case "":
fallthrough
case "autodiscover":
return CloudAutoDiscover, nil
case "us-1":
case "us1":
return CloudUs1, nil
case "us-2":
case "us2":
return CloudUs2, nil
case "eu-1":
case "eu1":
return CloudEu1, nil
case "us-gov-1":
case "usgov1":
return CloudUsGov1, nil
case "gov1":
return CloudGov1, nil
Expand Down
2 changes: 2 additions & 0 deletions falcon/containers.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ func FalconContainerUploadURI(falconCloud CloudType) string {
}

// FalconContainerSensorImageURI returns a URI for downloading a container sensor image. Defaults to the falcon-sensor image.
// When the Falcon Cloud CloudType is set to CloudAutoDiscover, be sure to provide the results of ApiConfig.Cloud after the client
// has been initialized to ensure the correct CloudType is used and not CloudAutoDiscover.
func FalconContainerSensorImageURI(falconCloud CloudType, sensorType SensorType) string {
switch sensorType {
case SidecarSensor:
Expand Down
Loading