Skip to content

Commit 51b4b4a

Browse files
Make FluidStack cloud provider ID a constant
- Add const CloudProviderID = "fluidstack" at package level - Update both GetCloudProviderID() methods to use the constant - Update GetTenantID() to use constant in format string for consistency Addresses GitHub PR comment from @theFong requesting to make the hardcoded "fluidstack" string a constant. Co-Authored-By: Alec Fong <alecsanf@usc.edu>
1 parent 3f554ae commit 51b4b4a

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

internal/fluidstack/v1/client.go

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ import (
88
"github.com/brevdev/cloud/pkg/v1"
99
)
1010

11+
const CloudProviderID = "fluidstack"
12+
1113
// FluidStackCredential implements the CloudCredential interface for FluidStack
1214
type FluidStackCredential struct {
1315
RefID string
@@ -35,12 +37,12 @@ func (c *FluidStackCredential) GetAPIType() v1.APIType {
3537

3638
// GetCloudProviderID returns the cloud provider ID for FluidStack
3739
func (c *FluidStackCredential) GetCloudProviderID() v1.CloudProviderID {
38-
return "fluidstack"
40+
return CloudProviderID
3941
}
4042

4143
// GetTenantID returns the tenant ID for FluidStack
4244
func (c *FluidStackCredential) GetTenantID() (string, error) {
43-
return fmt.Sprintf("fluidstack-%x", sha256.Sum256([]byte(c.APIKey))), nil
45+
return fmt.Sprintf("%s-%x", CloudProviderID, sha256.Sum256([]byte(c.APIKey))), nil
4446
}
4547

4648
// GetCapabilities returns the capabilities for FluidStack
@@ -83,7 +85,7 @@ func (c *FluidStackClient) GetAPIType() v1.APIType {
8385

8486
// GetCloudProviderID returns the cloud provider ID for FluidStack
8587
func (c *FluidStackClient) GetCloudProviderID() v1.CloudProviderID {
86-
return "fluidstack"
88+
return CloudProviderID
8789
}
8890

8991
// MakeClient creates a new client instance

0 commit comments

Comments
 (0)