From 12efea23f04662944b172c68e99b9f934503cb88 Mon Sep 17 00:00:00 2001 From: David Wolfe Date: Thu, 7 Nov 2024 10:07:25 -0800 Subject: [PATCH] DUPLO-26089 fix a few lint issues --- cmd/duplo-jit/main.go | 6 +++--- duplocloud/api.go | 11 ++++++----- duplocloud/client.go | 4 ++-- 3 files changed, 11 insertions(+), 10 deletions(-) diff --git a/cmd/duplo-jit/main.go b/cmd/duplo-jit/main.go index 70113ef..2485c89 100644 --- a/cmd/duplo-jit/main.go +++ b/cmd/duplo-jit/main.go @@ -138,7 +138,7 @@ func main() { // Identify the tenant name to use for the cache key. var tenantName string client, _ := internal.MustDuploClient(*host, *token, *interactive, false, *port) - *tenantID, tenantName = GetTenantIdAndName(*tenantID, client) + *tenantID, tenantName = getTenantIDAndName(*tenantID, client) // Build the cache key. cacheKey = strings.Join([]string{strings.TrimPrefix(*host, "https://"), "tenant", tenantName}, ",") @@ -191,7 +191,7 @@ func main() { // Identify the tenant name to use for the cache key. var tenantName string client, _ := internal.MustDuploClient(*host, *token, *interactive, false, *port) - *tenantID, tenantName = GetTenantIdAndName(*tenantID, client) + *tenantID, tenantName = getTenantIDAndName(*tenantID, client) // Build the cache key. cacheKey = strings.Join([]string{strings.TrimPrefix(*host, "https://"), "tenant", tenantName}, ",") @@ -215,7 +215,7 @@ func main() { } } -func GetTenantIdAndName(tenantIDorName string, client *duplocloud.Client) (string, string) { +func getTenantIDAndName(tenantIDorName string, client *duplocloud.Client) (string, string) { var tenantID string var tenantName string diff --git a/duplocloud/api.go b/duplocloud/api.go index c8a4e56..9a3032b 100644 --- a/duplocloud/api.go +++ b/duplocloud/api.go @@ -100,12 +100,12 @@ func (c *Client) AdminGetK8sJitAccess(plan string) (*DuploPlanK8ClusterConfig, C return &creds, nil } -// AdminGetJITAwsCredentials retrieves just-in-time admin AWS credentials via the Duplo API. +// AdminGetJitAwsCredentials retrieves just-in-time admin AWS credentials via the Duplo API. func (c *Client) AdminGetJitAwsCredentials() (*AwsJitCredentials, ClientError) { return c.AdminAwsGetJitAccess("admin") } -// TenantGetJITAwsCredentials retrieves just-in-time AWS credentials for a tenant via the Duplo API. +// TenantGetJitAwsCredentials retrieves just-in-time AWS credentials for a tenant via the Duplo API. func (c *Client) TenantGetJitAwsCredentials(tenantID string) (*AwsJitCredentials, ClientError) { creds := AwsJitCredentials{} err := c.getAPI( @@ -143,11 +143,12 @@ func (c *Client) ListTenantsForUser() (*[]UserTenant, ClientError) { return &list, nil } -func (c *Client) GetTenantFeatures(tenantId string) (*DuploTenantFeatures, ClientError) { +// GetTenantFeatures retrieves a tenant's current configuration via the Duplo API. +func (c *Client) GetTenantFeatures(tenantID string) (*DuploTenantFeatures, ClientError) { features := DuploTenantFeatures{} err := c.getAPI( - fmt.Sprintf("GetTenantFeatures(%s)", tenantId), - fmt.Sprintf("v3/features/tenant/%s", tenantId), + fmt.Sprintf("GetTenantFeatures(%s)", tenantID), + fmt.Sprintf("v3/features/tenant/%s", tenantID), &features, ) if err != nil { diff --git a/duplocloud/client.go b/duplocloud/client.go index daf51f1..90a0fe9 100644 --- a/duplocloud/client.go +++ b/duplocloud/client.go @@ -9,7 +9,7 @@ import ( "time" ) -// Represents a connection to the Duplo API +// Client represents a connection to the Duplo API type Client struct { HTTPClient *http.Client HostURL string @@ -66,7 +66,7 @@ func (e clientError) Response() map[string]interface{} { return e.response } -// Represents an error from an API call. +// ClientError represents an error from an API call. type ClientError interface { Error() string Status() int