From 8760e125cd79c24ae9655f4f040efe2f3ad2f610 Mon Sep 17 00:00:00 2001 From: DylanGuedes Date: Tue, 14 Jan 2025 08:03:25 -0300 Subject: [PATCH] Rename to `az_tenant_id` at all places. Signed-off-by: DylanGuedes --- CHANGELOG.md | 2 +- providers/azure/azure.go | 6 +++--- providers/azure/azure_test.go | 6 +++--- providers/azure/helpers.go | 4 ++-- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ebdbdbe..8e3d802 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,7 +11,7 @@ We use *breaking :warning:* to mark changes that are not backward compatible (re ## Unreleased - [#38](https://github.com/thanos-io/objstore/pull/38) GCS: Upgrade cloud.google.com/go/storage version to `v1.43.0`. - [#145](https://github.com/thanos-io/objstore/pull/145) Include content length in the response of Get and GetRange. -- [#157](https://github.com/thanos-io/objstore/pull/157) Azure: Add `tenant_id`, `client_id` and `client_secret` configs. +- [#157](https://github.com/thanos-io/objstore/pull/157) Azure: Add `az_tenant_id`, `client_id` and `client_secret` configs. ### Fixed - [#153](https://github.com/thanos-io/objstore/pull/153) Metrics: Fix `objstore_bucket_operation_duration_seconds_*` for `get` and `get_range` operations. diff --git a/providers/azure/azure.go b/providers/azure/azure.go index 1fdbd0e..5a59820 100644 --- a/providers/azure/azure.go +++ b/providers/azure/azure.go @@ -48,7 +48,7 @@ var DefaultConfig = Config{ type Config struct { ClientID string `yaml:"client_id"` ClientSecret string `yaml:"client_secret"` - TenantID string `yaml:"tenant_id"` + AzTenantID string `yaml:"az_tenant_id"` StorageAccountName string `yaml:"storage_account"` StorageAccountKey string `yaml:"storage_account_key"` StorageConnectionString string `yaml:"storage_connection_string"` @@ -91,8 +91,8 @@ func (conf *Config) validate() error { errMsg = append(errMsg, "user_assigned_id cannot be set when using client_id authentication") } - if (conf.TenantID != "" || conf.ClientSecret != "" || conf.ClientID != "") && (conf.TenantID == "" || conf.ClientSecret == "" || conf.ClientID == "") { - errMsg = append(errMsg, "tenant_id, client_id, and client_secret must be set together") + if (conf.AzTenantID != "" || conf.ClientSecret != "" || conf.ClientID != "") && (conf.AzTenantID == "" || conf.ClientSecret == "" || conf.ClientID == "") { + errMsg = append(errMsg, "az_tenant_id, client_id, and client_secret must be set together") } if conf.StorageAccountKey != "" && conf.StorageConnectionString != "" { diff --git a/providers/azure/azure_test.go b/providers/azure/azure_test.go index a316ea5..bee65d2 100644 --- a/providers/azure/azure_test.go +++ b/providers/azure/azure_test.go @@ -145,10 +145,10 @@ container: "MyContainer"`), wantFailValidate: true, }, { - name: "Valid TenantID, ClientID, ClientSecret", + name: "Valid AzTenantID, ClientID, ClientSecret", config: []byte(`storage_account: "myAccount" storage_account_key: "" -tenant_id: "1234-56578678-655" +az_tenant_id: "1234-56578678-655" client_id: "1234-56578678-655" client_secret: "1234-56578678-655" container: "MyContainer"`), @@ -156,7 +156,7 @@ container: "MyContainer"`), wantFailValidate: false, }, { - name: "Valid ClientID and ClientSecret but missing TenantID", + name: "Valid ClientID and ClientSecret but missing AzTenantID", config: []byte(`storage_account: "myAccount" storage_account_key: "" client_id: "1234-56578678-655" diff --git a/providers/azure/helpers.go b/providers/azure/helpers.go index 9448d47..4a0ca7e 100644 --- a/providers/azure/helpers.go +++ b/providers/azure/helpers.go @@ -85,8 +85,8 @@ func getContainerClient(conf Config, wrapRoundtripper func(http.RoundTripper) ht } func getTokenCredential(conf Config) (azcore.TokenCredential, error) { - if conf.ClientSecret != "" && conf.TenantID != "" && conf.ClientID != "" { - return azidentity.NewClientSecretCredential(conf.TenantID, conf.ClientID, conf.ClientSecret, &azidentity.ClientSecretCredentialOptions{}) + if conf.ClientSecret != "" && conf.AzTenantID != "" && conf.ClientID != "" { + return azidentity.NewClientSecretCredential(conf.AzTenantID, conf.ClientID, conf.ClientSecret, &azidentity.ClientSecretCredentialOptions{}) } if conf.UserAssignedID == "" {