-
Notifications
You must be signed in to change notification settings - Fork 211
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add cluster fqdn to telemetry exported
Signed-off-by: Alex Castilio dos Santos <[email protected]>
- Loading branch information
1 parent
ac893fc
commit effbc1d
Showing
2 changed files
with
32 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
package azure | ||
|
||
import ( | ||
"context" | ||
"fmt" | ||
|
||
"github.com/Azure/azure-sdk-for-go/sdk/azidentity" | ||
armcontainerservice "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerservice/armcontainerservice/v4" | ||
) | ||
|
||
func GetFqdnFn(subscriptionId, resourceGroupName, clusterName string) (string, error) { | ||
cred, err := azidentity.NewAzureCLICredential(nil) | ||
if err != nil { | ||
return "", fmt.Errorf("failed to obtain a credential: %w", err) | ||
} | ||
ctx := context.Background() | ||
clientFactory, err := armcontainerservice.NewClientFactory(subscriptionId, cred, nil) | ||
if err != nil { | ||
return "", fmt.Errorf("failed to create client: %w", err) | ||
} | ||
res, err := clientFactory.NewManagedClustersClient().Get(ctx, resourceGroupName, clusterName, nil) | ||
if err != nil { | ||
return "", fmt.Errorf("failed to finish the get managed cluster client request: %w", err) | ||
} | ||
|
||
return *res.Properties.Fqdn, nil | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters