diff --git a/azure/monitoring_metric.go b/azure/monitoring_metric.go index 155fe7a5..9ac850a3 100644 --- a/azure/monitoring_metric.go +++ b/azure/monitoring_metric.go @@ -5,7 +5,7 @@ import ( "strings" "time" - "github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2021-04-01-preview/insights" + "github.com/Azure/azure-sdk-for-go/profiles/preview/preview/monitor/mgmt/insights" "github.com/turbot/steampipe-plugin-sdk/v5/grpc/proto" "github.com/turbot/steampipe-plugin-sdk/v5/plugin" "github.com/turbot/steampipe-plugin-sdk/v5/plugin/transform" diff --git a/azure/plugin.go b/azure/plugin.go index bc4fec7c..4f442748 100644 --- a/azure/plugin.go +++ b/azure/plugin.go @@ -116,7 +116,7 @@ func Plugin(ctx context.Context) *plugin.Plugin { "azure_key_vault_managed_hardware_security_module": tableAzureKeyVaultManagedHardwareSecurityModule(ctx), "azure_key_vault_secret": tableAzureKeyVaultSecret(ctx), "azure_kubernetes_cluster": tableAzureKubernetesCluster(ctx), - "azure_kubernetes_service_version": tableAzureAKSOrchestractor(ctx), + "azure_kubernetes_service_version": tableAzureAKSVersion(ctx), "azure_kusto_cluster": tableAzureKustoCluster(ctx), "azure_lb": tableAzureLoadBalancer(ctx), "azure_lb_backend_address_pool": tableAzureLoadBalancerBackendAddressPool(ctx), diff --git a/azure/service.go b/azure/service.go index 8ba06dea..78baa5f7 100644 --- a/azure/service.go +++ b/azure/service.go @@ -3,6 +3,8 @@ package azure import ( "bytes" "context" + "crypto" + "crypto/x509" "encoding/json" "fmt" "os" @@ -12,6 +14,11 @@ import ( "strings" "time" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" + cloudPolicy "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azidentity" "github.com/Azure/go-autorest/autorest" "github.com/Azure/go-autorest/autorest/azure" "github.com/Azure/go-autorest/autorest/azure/auth" @@ -21,6 +28,13 @@ import ( ) // Session info +type SessionNew struct { + Cred azcore.TokenCredential + SubscriptionID string + TenantID string + ClientOptions *policy.ClientOptions +} + type Session struct { Authorizer autorest.Authorizer CloudEnvironment string @@ -33,14 +47,279 @@ type Session struct { } /* - GetNewSession creates an session configured from (~/.steampipe/config, environment variables and CLI) in the order: + GetNewSessionUpdated creates an session configured from (~/.steampipe/config, environment variables and CLI) in the order: 1. Client secret 2. Client certificate 3. Username and password -4. MSI +4. Managed identity 5. CLI */ +func GetNewSessionUpdated(ctx context.Context, d *plugin.QueryData) (session *SessionNew, err error) { + logger := plugin.Logger(ctx) + + cacheKey := "GetNewSessionUpdated" + if cachedData, ok := d.ConnectionManager.Cache.Get(cacheKey); ok { + return cachedData.(*SessionNew), nil + } + + logger.Debug("Auth session not found in cache, creating new session") + + var tenantID, subscriptionID, clientID, clientSecret, certificatePath, certificatePassword, username, password, environment string + azureConfig := GetConfig(d.Connection) + + if azureConfig.Environment != nil { + environment = *azureConfig.Environment + } else { + environment = os.Getenv("AZURE_ENVIRONMENT") + } + + if azureConfig.TenantID != nil { + tenantID = *azureConfig.TenantID + } else { + tenantID = os.Getenv(auth.TenantID) + } + + if azureConfig.SubscriptionID != nil { + subscriptionID = *azureConfig.SubscriptionID + } else { + subscriptionID = os.Getenv(auth.SubscriptionID) + } + + if azureConfig.ClientID != nil { + clientID = *azureConfig.ClientID + } else { + clientID = os.Getenv(auth.ClientID) + } + + if azureConfig.ClientSecret != nil { + clientSecret = *azureConfig.ClientSecret + } else { + clientSecret = os.Getenv(auth.ClientSecret) + } + + if azureConfig.CertificatePath != nil { + certificatePath = *azureConfig.CertificatePath + } else { + certificatePath = os.Getenv(auth.CertificatePath) + } + + if azureConfig.Username != nil { + username = *azureConfig.Username + } else { + username = os.Getenv(auth.Username) + } + + if azureConfig.Password != nil { + password = *azureConfig.Password + } else { + password = os.Getenv(auth.Password) + } + + var cred azcore.TokenCredential + var cloudConfiguration cloud.Configuration + switch environment { + case "AZURECHINACLOUD": + cloudConfiguration = cloud.AzureChina + case "AZUREUSGOVERNMENTCLOUD": + cloudConfiguration = cloud.AzureGovernment + default: + cloudConfiguration = cloud.AzurePublic + } + clientOptions := policy.ClientOptions{ClientOptions: cloudPolicy.ClientOptions{Cloud: cloudConfiguration}} + + if tenantID != "" && subscriptionID != "" && clientID != "" && clientSecret != "" { // Client secret authentication + cred, err = azidentity.NewClientSecretCredential( + tenantID, + clientID, + clientSecret, + nil, + ) + if err != nil { + logger.Error("GetNewSessionUpdated", "client_secret_credential_error", err) + return nil, err + } + } else if tenantID != "" && subscriptionID != "" && clientID != "" && certificatePath != "" { // Client certificate authentication + + // Load certificate from given path + loadFile, err := os.ReadFile(certificatePath) + if err != nil { + return nil, fmt.Errorf("error reading certificate from %s: %v", certificatePath, err) + } + + var certs []*x509.Certificate + var key crypto.PrivateKey + if certificatePassword == "" { + certs, key, err = azidentity.ParseCertificates(loadFile, nil) + } else { + certs, key, err = azidentity.ParseCertificates(loadFile, []byte(certificatePassword)) + } + + if err != nil { + return nil, fmt.Errorf("error parsing certificate from %s: %v", certificatePath, err) + } + + cred, err = azidentity.NewClientCertificateCredential( + tenantID, + clientID, + certs, + key, + nil, + ) + if err != nil { + logger.Error("GetNewSessionUpdated", "client_certificate_credential_error", err) + return nil, err + } + } else if tenantID != "" && subscriptionID != "" && clientID != "" && username != "" && password != "" { // Username password authentication + cred, err = azidentity.NewUsernamePasswordCredential( + tenantID, + clientID, + username, + password, + nil, + ) + if err != nil { + logger.Error("GetNewSessionUpdated", "username_password_credential_error", err) + return nil, err + } + } else if tenantID != "" && subscriptionID != "" && clientID != "" { // Managed identity authentication + cred, err = azidentity.NewManagedIdentityCredential( + &azidentity.ManagedIdentityCredentialOptions{ + ID: azidentity.ClientID(clientID), + }, + ) + if err != nil { + logger.Error("GetNewSessionUpdated", "managed_identity_credential_error", err) + return nil, err + } + } else { // CLI Authentication + cred, err = azidentity.NewAzureCLICredential(nil) + if err != nil { + logger.Error("GetNewSessionUpdated", "cli_credential_error", err) + return nil, err + } + subscriptionId, err := getSubscriptionIDFromCLINew() + if err != nil { + return nil, err + } + subscriptionID = subscriptionId + } + sess := &SessionNew{ + Cred: cred, + SubscriptionID: subscriptionID, + TenantID: tenantID, + ClientOptions: &clientOptions, + } + + return sess, err +} + +// getSubscriptionIDFromCLINew executes Azure CLI to get the subscription ID. +func getSubscriptionIDFromCLINew() (string, error) { + const azureCLIPath = "AzureCLIPath" + + azureCLIDefaultPathWindows := fmt.Sprintf("%s\\Microsoft SDKs\\Azure\\CLI2\\wbin; %s\\Microsoft SDKs\\Azure\\CLI2\\wbin", os.Getenv("ProgramFiles(x86)"), os.Getenv("ProgramFiles")) + const azureCLIDefaultPath = "/bin:/sbin:/usr/bin:/usr/local/bin" + + var cliCmd *exec.Cmd + if runtime.GOOS == "windows" { + cliCmd = exec.Command(fmt.Sprintf("%s\\system32\\cmd.exe", os.Getenv("windir"))) + cliCmd.Env = os.Environ() + cliCmd.Env = append(cliCmd.Env, fmt.Sprintf("PATH=%s;%s", os.Getenv(azureCLIPath), azureCLIDefaultPathWindows)) + cliCmd.Args = append(cliCmd.Args, "/c", "az") + } else { + cliCmd = exec.Command("az") + cliCmd.Env = os.Environ() + cliCmd.Env = append(cliCmd.Env, fmt.Sprintf("PATH=%s:%s", os.Getenv(azureCLIPath), azureCLIDefaultPath)) + } + cliCmd.Args = append(cliCmd.Args, "account", "show", "-o", "json") + + var stderr bytes.Buffer + cliCmd.Stderr = &stderr + + output, err := cliCmd.Output() + if err != nil { + return "", fmt.Errorf("invoking Azure CLI failed with the following error: %v", err) + } + + var accountResponse struct { + SubscriptionID string `json:"id"` + } + err = json.Unmarshal(output, &accountResponse) + if err != nil { + return "", fmt.Errorf("error parsing JSON output: %v", err) + } + + return accountResponse.SubscriptionID, nil +} + +type subscription struct { + SubscriptionID string `json:"subscriptionID,omitempty"` + TenantID string `json:"tenantID,omitempty"` +} + +// https://github.com/Azure/go-autorest/blob/3fb5326fea196cd5af02cf105ca246a0fba59021/autorest/azure/cli/token.go#L126 +// NewAuthorizerFromCLIWithResource creates an Authorizer configured from Azure CLI 2.0 for local development scenarios. +func getSubscriptionFromCLI(resource string) (*subscription, error) { + // This is the path that a developer can set to tell this class what the install path for Azure CLI is. + const azureCLIPath = "AzureCLIPath" + + // The default install paths are used to find Azure CLI. This is for security, so that any path in the calling program's Path environment is not used to execute Azure CLI. + azureCLIDefaultPathWindows := fmt.Sprintf("%s\\Microsoft SDKs\\Azure\\CLI2\\wbin; %s\\Microsoft SDKs\\Azure\\CLI2\\wbin", os.Getenv("ProgramFiles(x86)"), os.Getenv("ProgramFiles")) + + // Default path for non-Windows. + const azureCLIDefaultPath = "/bin:/sbin:/usr/bin:/usr/local/bin" + + // Validate resource, since it gets sent as a command line argument to Azure CLI + const invalidResourceErrorTemplate = "Resource %s is not in expected format. Only alphanumeric characters, [dot], [colon], [hyphen], and [forward slash] are allowed." + match, err := regexp.MatchString("^[0-9a-zA-Z-.:/]+$", resource) + if err != nil { + return nil, err + } + if !match { + return nil, fmt.Errorf(invalidResourceErrorTemplate, resource) + } + + // Execute Azure CLI to get token + var cliCmd *exec.Cmd + if runtime.GOOS == "windows" { + cliCmd = exec.Command(fmt.Sprintf("%s\\system32\\cmd.exe", os.Getenv("windir"))) + cliCmd.Env = os.Environ() + cliCmd.Env = append(cliCmd.Env, fmt.Sprintf("PATH=%s;%s", os.Getenv(azureCLIPath), azureCLIDefaultPathWindows)) + cliCmd.Args = append(cliCmd.Args, "/c", "az") + } else { + cliCmd = exec.Command("az") + cliCmd.Env = os.Environ() + cliCmd.Env = append(cliCmd.Env, fmt.Sprintf("PATH=%s:%s", os.Getenv(azureCLIPath), azureCLIDefaultPath)) + } + cliCmd.Args = append(cliCmd.Args, "account", "get-access-token", "-o", "json", "--resource", resource) + + var stderr bytes.Buffer + cliCmd.Stderr = &stderr + + output, err := cliCmd.Output() + if err != nil { + return nil, fmt.Errorf("Invoking Azure CLI failed with the following error: %v", err) + } + + var tokenResponse map[string]interface{} + err = json.Unmarshal(output, &tokenResponse) + if err != nil { + return nil, err + } + + return &subscription{ + SubscriptionID: tokenResponse["subscription"].(string), + TenantID: tokenResponse["tenant"].(string), + }, nil +} + +// WillExpireIn returns true if the Token will expire after the passed time.Duration interval +// from now, false otherwise. +func WillExpireIn(t time.Time, d time.Duration) bool { + return !t.After(time.Now().Add(d)) +} + func GetNewSession(ctx context.Context, d *plugin.QueryData, tokenAudience string) (session *Session, err error) { logger := plugin.Logger(ctx) @@ -278,70 +557,3 @@ func getApplicableAuthorizationDetails(ctx context.Context, settings auth.Enviro return } - -type subscription struct { - SubscriptionID string `json:"subscriptionID,omitempty"` - TenantID string `json:"tenantID,omitempty"` -} - -// https://github.com/Azure/go-autorest/blob/3fb5326fea196cd5af02cf105ca246a0fba59021/autorest/azure/cli/token.go#L126 -// NewAuthorizerFromCLIWithResource creates an Authorizer configured from Azure CLI 2.0 for local development scenarios. -func getSubscriptionFromCLI(resource string) (*subscription, error) { - // This is the path that a developer can set to tell this class what the install path for Azure CLI is. - const azureCLIPath = "AzureCLIPath" - - // The default install paths are used to find Azure CLI. This is for security, so that any path in the calling program's Path environment is not used to execute Azure CLI. - azureCLIDefaultPathWindows := fmt.Sprintf("%s\\Microsoft SDKs\\Azure\\CLI2\\wbin; %s\\Microsoft SDKs\\Azure\\CLI2\\wbin", os.Getenv("ProgramFiles(x86)"), os.Getenv("ProgramFiles")) - - // Default path for non-Windows. - const azureCLIDefaultPath = "/bin:/sbin:/usr/bin:/usr/local/bin" - - // Validate resource, since it gets sent as a command line argument to Azure CLI - const invalidResourceErrorTemplate = "Resource %s is not in expected format. Only alphanumeric characters, [dot], [colon], [hyphen], and [forward slash] are allowed." - match, err := regexp.MatchString("^[0-9a-zA-Z-.:/]+$", resource) - if err != nil { - return nil, err - } - if !match { - return nil, fmt.Errorf(invalidResourceErrorTemplate, resource) - } - - // Execute Azure CLI to get token - var cliCmd *exec.Cmd - if runtime.GOOS == "windows" { - cliCmd = exec.Command(fmt.Sprintf("%s\\system32\\cmd.exe", os.Getenv("windir"))) - cliCmd.Env = os.Environ() - cliCmd.Env = append(cliCmd.Env, fmt.Sprintf("PATH=%s;%s", os.Getenv(azureCLIPath), azureCLIDefaultPathWindows)) - cliCmd.Args = append(cliCmd.Args, "/c", "az") - } else { - cliCmd = exec.Command("az") - cliCmd.Env = os.Environ() - cliCmd.Env = append(cliCmd.Env, fmt.Sprintf("PATH=%s:%s", os.Getenv(azureCLIPath), azureCLIDefaultPath)) - } - cliCmd.Args = append(cliCmd.Args, "account", "get-access-token", "-o", "json", "--resource", resource) - - var stderr bytes.Buffer - cliCmd.Stderr = &stderr - - output, err := cliCmd.Output() - if err != nil { - return nil, fmt.Errorf("Invoking Azure CLI failed with the following error: %v", err) - } - - var tokenResponse map[string]interface{} - err = json.Unmarshal(output, &tokenResponse) - if err != nil { - return nil, err - } - - return &subscription{ - SubscriptionID: tokenResponse["subscription"].(string), - TenantID: tokenResponse["tenant"].(string), - }, nil -} - -// WillExpireIn returns true if the Token will expire after the passed time.Duration interval -// from now, false otherwise. -func WillExpireIn(t time.Time, d time.Duration) bool { - return !t.After(time.Now().Add(d)) -} diff --git a/azure/table_azure_alert_management.go b/azure/table_azure_alert_management.go index 9b15e351..8f97f62f 100644 --- a/azure/table_azure_alert_management.go +++ b/azure/table_azure_alert_management.go @@ -4,7 +4,7 @@ import ( "context" "fmt" - "github.com/Azure/azure-sdk-for-go/services/alertsmanagement/mgmt/2019-03-01/alertsmanagement" + "github.com/Azure/azure-sdk-for-go/profiles/latest/alertsmanagement/mgmt/alertsmanagement" "github.com/turbot/steampipe-plugin-sdk/v5/grpc/proto" "github.com/turbot/steampipe-plugin-sdk/v5/plugin/transform" diff --git a/azure/table_azure_api_management.go b/azure/table_azure_api_management.go index b5325393..d8844247 100644 --- a/azure/table_azure_api_management.go +++ b/azure/table_azure_api_management.go @@ -3,8 +3,8 @@ package azure import ( "context" - "github.com/Azure/azure-sdk-for-go/profiles/2020-09-01/monitor/mgmt/insights" - "github.com/Azure/azure-sdk-for-go/services/apimanagement/mgmt/2020-12-01/apimanagement" + "github.com/Azure/azure-sdk-for-go/profiles/latest/apimanagement/mgmt/apimanagement" + "github.com/Azure/azure-sdk-for-go/profiles/preview/preview/monitor/mgmt/insights" "github.com/turbot/steampipe-plugin-sdk/v5/grpc/proto" "github.com/turbot/steampipe-plugin-sdk/v5/plugin/transform" diff --git a/azure/table_azure_api_management_backend.go b/azure/table_azure_api_management_backend.go index f9fa98ba..fa0ff71c 100644 --- a/azure/table_azure_api_management_backend.go +++ b/azure/table_azure_api_management_backend.go @@ -5,7 +5,7 @@ import ( "fmt" "strings" - "github.com/Azure/azure-sdk-for-go/services/apimanagement/mgmt/2020-12-01/apimanagement" + "github.com/Azure/azure-sdk-for-go/profiles/latest/apimanagement/mgmt/apimanagement" "github.com/turbot/steampipe-plugin-sdk/v5/grpc/proto" "github.com/turbot/steampipe-plugin-sdk/v5/plugin/transform" diff --git a/azure/table_azure_app_configuration.go b/azure/table_azure_app_configuration.go index 609863dc..ea80d1ea 100644 --- a/azure/table_azure_app_configuration.go +++ b/azure/table_azure_app_configuration.go @@ -3,8 +3,8 @@ package azure import ( "context" - "github.com/Azure/azure-sdk-for-go/profiles/2020-09-01/monitor/mgmt/insights" - "github.com/Azure/azure-sdk-for-go/services/appconfiguration/mgmt/2020-06-01/appconfiguration" + "github.com/Azure/azure-sdk-for-go/profiles/preview/preview/monitor/mgmt/insights" + "github.com/Azure/azure-sdk-for-go/profiles/latest/appconfiguration/mgmt/appconfiguration" "github.com/turbot/steampipe-plugin-sdk/v5/grpc/proto" "github.com/turbot/steampipe-plugin-sdk/v5/plugin/transform" diff --git a/azure/table_azure_app_service_environment.go b/azure/table_azure_app_service_environment.go index ebe5811c..ad0cdd9b 100644 --- a/azure/table_azure_app_service_environment.go +++ b/azure/table_azure_app_service_environment.go @@ -3,7 +3,7 @@ package azure import ( "context" - "github.com/Azure/azure-sdk-for-go/services/web/mgmt/2020-06-01/web" + "github.com/Azure/azure-sdk-for-go/profiles/latest/web/mgmt/web" "github.com/turbot/steampipe-plugin-sdk/v5/grpc/proto" "github.com/turbot/steampipe-plugin-sdk/v5/plugin/transform" diff --git a/azure/table_azure_app_service_function_app.go b/azure/table_azure_app_service_function_app.go index ef66e007..63b91f1c 100644 --- a/azure/table_azure_app_service_function_app.go +++ b/azure/table_azure_app_service_function_app.go @@ -4,7 +4,7 @@ import ( "context" "strings" - "github.com/Azure/azure-sdk-for-go/services/web/mgmt/2020-06-01/web" + "github.com/Azure/azure-sdk-for-go/profiles/latest/web/mgmt/web" "github.com/turbot/steampipe-plugin-sdk/v5/grpc/proto" "github.com/turbot/steampipe-plugin-sdk/v5/plugin/transform" diff --git a/azure/table_azure_app_service_plan.go b/azure/table_azure_app_service_plan.go index ee4ee937..d24bcb07 100644 --- a/azure/table_azure_app_service_plan.go +++ b/azure/table_azure_app_service_plan.go @@ -4,7 +4,7 @@ import ( "context" "strings" - "github.com/Azure/azure-sdk-for-go/services/web/mgmt/2020-06-01/web" + "github.com/Azure/azure-sdk-for-go/profiles/latest/web/mgmt/web" "github.com/turbot/go-kit/types" "github.com/turbot/steampipe-plugin-sdk/v5/grpc/proto" "github.com/turbot/steampipe-plugin-sdk/v5/plugin/transform" diff --git a/azure/table_azure_app_service_web_app.go b/azure/table_azure_app_service_web_app.go index 59b38976..478e7be3 100644 --- a/azure/table_azure_app_service_web_app.go +++ b/azure/table_azure_app_service_web_app.go @@ -3,7 +3,7 @@ package azure import ( "context" - "github.com/Azure/azure-sdk-for-go/services/web/mgmt/2020-06-01/web" + "github.com/Azure/azure-sdk-for-go/profiles/latest/web/mgmt/web" "github.com/turbot/go-kit/types" "github.com/turbot/steampipe-plugin-sdk/v5/grpc/proto" "github.com/turbot/steampipe-plugin-sdk/v5/plugin/transform" @@ -388,7 +388,7 @@ func getAppServiceWebAppVnetConnection(ctx context.Context, d *plugin.QueryData, return nil, err } - if op.VnetInfoProperties != nil { + if op.VnetInfo != nil { appVnetConnection := make(map[string]interface{}) if op.Name != nil { appVnetConnection["name"] = op.Name @@ -399,7 +399,7 @@ func getAppServiceWebAppVnetConnection(ctx context.Context, d *plugin.QueryData, if op.Type != nil { appVnetConnection["type"] = op.Type } - appVnetConnection["properties"] = op.VnetInfoProperties + appVnetConnection["properties"] = op.VnetInfo return appVnetConnection, nil } diff --git a/azure/table_azure_app_service_web_app_slot.go b/azure/table_azure_app_service_web_app_slot.go index bdc856de..89efa648 100644 --- a/azure/table_azure_app_service_web_app_slot.go +++ b/azure/table_azure_app_service_web_app_slot.go @@ -4,7 +4,7 @@ import ( "context" "strings" - "github.com/Azure/azure-sdk-for-go/services/web/mgmt/2020-06-01/web" + "github.com/Azure/azure-sdk-for-go/profiles/latest/web/mgmt/web" "github.com/turbot/go-kit/types" "github.com/turbot/steampipe-plugin-sdk/v5/grpc/proto" "github.com/turbot/steampipe-plugin-sdk/v5/plugin/transform" diff --git a/azure/table_azure_application_gateway.go b/azure/table_azure_application_gateway.go index ff6b3648..a7ef5b5d 100644 --- a/azure/table_azure_application_gateway.go +++ b/azure/table_azure_application_gateway.go @@ -3,8 +3,8 @@ package azure import ( "context" - "github.com/Azure/azure-sdk-for-go/profiles/2020-09-01/monitor/mgmt/insights" - "github.com/Azure/azure-sdk-for-go/services/network/mgmt/2021-02-01/network" + "github.com/Azure/azure-sdk-for-go/profiles/preview/preview/monitor/mgmt/insights" + "github.com/Azure/azure-sdk-for-go/profiles/latest/network/mgmt/network" "github.com/turbot/steampipe-plugin-sdk/v5/grpc/proto" "github.com/turbot/steampipe-plugin-sdk/v5/plugin/transform" diff --git a/azure/table_azure_application_insight.go b/azure/table_azure_application_insight.go index 6c54c33b..e7cef5d8 100644 --- a/azure/table_azure_application_insight.go +++ b/azure/table_azure_application_insight.go @@ -3,7 +3,7 @@ package azure import ( "context" - "github.com/Azure/azure-sdk-for-go/services/appinsights/mgmt/2020-02-02/insights" + "github.com/Azure/azure-sdk-for-go/profiles/latest/appinsights/mgmt/insights" "github.com/turbot/steampipe-plugin-sdk/v5/grpc/proto" "github.com/turbot/steampipe-plugin-sdk/v5/plugin/transform" diff --git a/azure/table_azure_application_security_group.go b/azure/table_azure_application_security_group.go index 3db3dd0e..53ed2179 100644 --- a/azure/table_azure_application_security_group.go +++ b/azure/table_azure_application_security_group.go @@ -3,7 +3,7 @@ package azure import ( "context" - "github.com/Azure/azure-sdk-for-go/services/network/mgmt/2020-05-01/network" + "github.com/Azure/azure-sdk-for-go/profiles/latest/network/mgmt/network" "github.com/turbot/steampipe-plugin-sdk/v5/grpc/proto" "github.com/turbot/steampipe-plugin-sdk/v5/plugin/transform" diff --git a/azure/table_azure_automation_account.go b/azure/table_azure_automation_account.go index d70c79c7..d8b2830b 100644 --- a/azure/table_azure_automation_account.go +++ b/azure/table_azure_automation_account.go @@ -3,7 +3,7 @@ package azure import ( "context" - "github.com/Azure/azure-sdk-for-go/services/automation/mgmt/2019-06-01/automation" + "github.com/Azure/azure-sdk-for-go/profiles/latest/automation/mgmt/automation" "github.com/turbot/steampipe-plugin-sdk/v5/grpc/proto" "github.com/turbot/steampipe-plugin-sdk/v5/plugin/transform" diff --git a/azure/table_azure_automation_variable.go b/azure/table_azure_automation_variable.go index 194d2370..833cbed2 100644 --- a/azure/table_azure_automation_variable.go +++ b/azure/table_azure_automation_variable.go @@ -4,7 +4,7 @@ import ( "context" "strings" - "github.com/Azure/azure-sdk-for-go/services/automation/mgmt/2019-06-01/automation" + "github.com/Azure/azure-sdk-for-go/profiles/latest/automation/mgmt/automation" "github.com/turbot/steampipe-plugin-sdk/v5/grpc/proto" "github.com/turbot/steampipe-plugin-sdk/v5/plugin/transform" diff --git a/azure/table_azure_backup_policy.go b/azure/table_azure_backup_policy.go index 90a893a6..6f590652 100644 --- a/azure/table_azure_backup_policy.go +++ b/azure/table_azure_backup_policy.go @@ -4,8 +4,8 @@ import ( "context" "strings" + "github.com/Azure/azure-sdk-for-go/profiles/latest/recoveryservices/mgmt/backup" "github.com/Azure/azure-sdk-for-go/profiles/latest/recoveryservices/mgmt/recoveryservices" - "github.com/Azure/azure-sdk-for-go/services/recoveryservices/mgmt/2021-01-01/backup" "github.com/turbot/steampipe-plugin-sdk/v5/grpc/proto" "github.com/turbot/steampipe-plugin-sdk/v5/plugin/transform" diff --git a/azure/table_azure_bastion_host.go b/azure/table_azure_bastion_host.go index 58066201..94915d3f 100644 --- a/azure/table_azure_bastion_host.go +++ b/azure/table_azure_bastion_host.go @@ -3,7 +3,7 @@ package azure import ( "context" - "github.com/Azure/azure-sdk-for-go/services/network/mgmt/2020-05-01/network" + "github.com/Azure/azure-sdk-for-go/profiles/latest/network/mgmt/network" "github.com/turbot/steampipe-plugin-sdk/v5/grpc/proto" "github.com/turbot/steampipe-plugin-sdk/v5/plugin/transform" diff --git a/azure/table_azure_batch_account.go b/azure/table_azure_batch_account.go index c69ab12c..2d505ff3 100644 --- a/azure/table_azure_batch_account.go +++ b/azure/table_azure_batch_account.go @@ -3,8 +3,8 @@ package azure import ( "context" - "github.com/Azure/azure-sdk-for-go/profiles/2020-09-01/monitor/mgmt/insights" - "github.com/Azure/azure-sdk-for-go/services/batch/mgmt/2020-09-01/batch" + "github.com/Azure/azure-sdk-for-go/profiles/latest/batch/mgmt/batch" + "github.com/Azure/azure-sdk-for-go/profiles/preview/preview/monitor/mgmt/insights" "github.com/turbot/steampipe-plugin-sdk/v5/grpc/proto" "github.com/turbot/steampipe-plugin-sdk/v5/plugin/transform" diff --git a/azure/table_azure_cognitive_account.go b/azure/table_azure_cognitive_account.go index f40aa143..06fe3df8 100644 --- a/azure/table_azure_cognitive_account.go +++ b/azure/table_azure_cognitive_account.go @@ -3,8 +3,9 @@ package azure import ( "context" - "github.com/Azure/azure-sdk-for-go/profiles/2020-09-01/monitor/mgmt/insights" - "github.com/Azure/azure-sdk-for-go/services/cognitiveservices/mgmt/2021-04-30/cognitiveservices" + "github.com/Azure/azure-sdk-for-go/profiles/latest/cognitiveservices/mgmt/cognitiveservices" + "github.com/Azure/azure-sdk-for-go/profiles/preview/preview/monitor/mgmt/insights" + "github.com/turbot/steampipe-plugin-sdk/v5/grpc/proto" "github.com/turbot/steampipe-plugin-sdk/v5/plugin/transform" diff --git a/azure/table_azure_compute_availability_set.go b/azure/table_azure_compute_availability_set.go index eb7a649a..c6299d1c 100644 --- a/azure/table_azure_compute_availability_set.go +++ b/azure/table_azure_compute_availability_set.go @@ -3,7 +3,7 @@ package azure import ( "context" - "github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2020-06-01/compute" + "github.com/Azure/azure-sdk-for-go/profiles/latest/compute/mgmt/compute" "github.com/turbot/steampipe-plugin-sdk/v5/grpc/proto" "github.com/turbot/steampipe-plugin-sdk/v5/plugin" "github.com/turbot/steampipe-plugin-sdk/v5/plugin/transform" diff --git a/azure/table_azure_compute_disk.go b/azure/table_azure_compute_disk.go index cfdfda13..afd596fd 100644 --- a/azure/table_azure_compute_disk.go +++ b/azure/table_azure_compute_disk.go @@ -3,7 +3,7 @@ package azure import ( "context" - "github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2020-06-01/compute" + "github.com/Azure/azure-sdk-for-go/profiles/latest/compute/mgmt/compute" "github.com/turbot/steampipe-plugin-sdk/v5/grpc/proto" "github.com/turbot/steampipe-plugin-sdk/v5/plugin" "github.com/turbot/steampipe-plugin-sdk/v5/plugin/transform" diff --git a/azure/table_azure_compute_disk_access.go b/azure/table_azure_compute_disk_access.go index 44215214..38a3175d 100644 --- a/azure/table_azure_compute_disk_access.go +++ b/azure/table_azure_compute_disk_access.go @@ -3,7 +3,7 @@ package azure import ( "context" - "github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2020-06-01/compute" + "github.com/Azure/azure-sdk-for-go/profiles/latest/compute/mgmt/compute" "github.com/turbot/steampipe-plugin-sdk/v5/grpc/proto" "github.com/turbot/steampipe-plugin-sdk/v5/plugin" "github.com/turbot/steampipe-plugin-sdk/v5/plugin/transform" diff --git a/azure/table_azure_compute_disk_encryption_set.go b/azure/table_azure_compute_disk_encryption_set.go index 79cf442e..994fc988 100644 --- a/azure/table_azure_compute_disk_encryption_set.go +++ b/azure/table_azure_compute_disk_encryption_set.go @@ -3,7 +3,7 @@ package azure import ( "context" - "github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2020-06-01/compute" + "github.com/Azure/azure-sdk-for-go/profiles/latest/compute/mgmt/compute" "github.com/turbot/steampipe-plugin-sdk/v5/grpc/proto" "github.com/turbot/steampipe-plugin-sdk/v5/plugin" "github.com/turbot/steampipe-plugin-sdk/v5/plugin/transform" diff --git a/azure/table_azure_compute_disk_metric_read_ops.go b/azure/table_azure_compute_disk_metric_read_ops.go index 5ff4d250..94b2fdc5 100644 --- a/azure/table_azure_compute_disk_metric_read_ops.go +++ b/azure/table_azure_compute_disk_metric_read_ops.go @@ -3,7 +3,7 @@ package azure import ( "context" - "github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2020-06-01/compute" + "github.com/Azure/azure-sdk-for-go/profiles/latest/compute/mgmt/compute" "github.com/turbot/steampipe-plugin-sdk/v5/grpc/proto" "github.com/turbot/steampipe-plugin-sdk/v5/plugin" "github.com/turbot/steampipe-plugin-sdk/v5/plugin/transform" diff --git a/azure/table_azure_compute_disk_metric_read_ops_daily.go b/azure/table_azure_compute_disk_metric_read_ops_daily.go index 5f359ffb..61c01974 100644 --- a/azure/table_azure_compute_disk_metric_read_ops_daily.go +++ b/azure/table_azure_compute_disk_metric_read_ops_daily.go @@ -3,7 +3,7 @@ package azure import ( "context" - "github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2020-06-01/compute" + "github.com/Azure/azure-sdk-for-go/profiles/latest/compute/mgmt/compute" "github.com/turbot/steampipe-plugin-sdk/v5/grpc/proto" "github.com/turbot/steampipe-plugin-sdk/v5/plugin" "github.com/turbot/steampipe-plugin-sdk/v5/plugin/transform" diff --git a/azure/table_azure_compute_disk_metric_read_ops_hourly.go b/azure/table_azure_compute_disk_metric_read_ops_hourly.go index 4a18617e..a742af9c 100644 --- a/azure/table_azure_compute_disk_metric_read_ops_hourly.go +++ b/azure/table_azure_compute_disk_metric_read_ops_hourly.go @@ -3,7 +3,7 @@ package azure import ( "context" - "github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2020-06-01/compute" + "github.com/Azure/azure-sdk-for-go/profiles/latest/compute/mgmt/compute" "github.com/turbot/steampipe-plugin-sdk/v5/grpc/proto" "github.com/turbot/steampipe-plugin-sdk/v5/plugin" "github.com/turbot/steampipe-plugin-sdk/v5/plugin/transform" diff --git a/azure/table_azure_compute_disk_metric_write_ops.go b/azure/table_azure_compute_disk_metric_write_ops.go index da040dc8..5af2bbe5 100644 --- a/azure/table_azure_compute_disk_metric_write_ops.go +++ b/azure/table_azure_compute_disk_metric_write_ops.go @@ -3,7 +3,7 @@ package azure import ( "context" - "github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2020-06-01/compute" + "github.com/Azure/azure-sdk-for-go/profiles/latest/compute/mgmt/compute" "github.com/turbot/steampipe-plugin-sdk/v5/grpc/proto" "github.com/turbot/steampipe-plugin-sdk/v5/plugin" "github.com/turbot/steampipe-plugin-sdk/v5/plugin/transform" diff --git a/azure/table_azure_compute_disk_metric_write_ops_daily.go b/azure/table_azure_compute_disk_metric_write_ops_daily.go index 0eb1ddb9..6c1d9479 100644 --- a/azure/table_azure_compute_disk_metric_write_ops_daily.go +++ b/azure/table_azure_compute_disk_metric_write_ops_daily.go @@ -3,7 +3,7 @@ package azure import ( "context" - "github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2020-06-01/compute" + "github.com/Azure/azure-sdk-for-go/profiles/latest/compute/mgmt/compute" "github.com/turbot/steampipe-plugin-sdk/v5/grpc/proto" "github.com/turbot/steampipe-plugin-sdk/v5/plugin" "github.com/turbot/steampipe-plugin-sdk/v5/plugin/transform" diff --git a/azure/table_azure_compute_disk_metric_write_ops_hourly.go b/azure/table_azure_compute_disk_metric_write_ops_hourly.go index 20edf0c3..f0e7fa7c 100644 --- a/azure/table_azure_compute_disk_metric_write_ops_hourly.go +++ b/azure/table_azure_compute_disk_metric_write_ops_hourly.go @@ -3,7 +3,7 @@ package azure import ( "context" - "github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2020-06-01/compute" + "github.com/Azure/azure-sdk-for-go/profiles/latest/compute/mgmt/compute" "github.com/turbot/steampipe-plugin-sdk/v5/grpc/proto" "github.com/turbot/steampipe-plugin-sdk/v5/plugin" "github.com/turbot/steampipe-plugin-sdk/v5/plugin/transform" diff --git a/azure/table_azure_compute_image.go b/azure/table_azure_compute_image.go index f51d56ed..77b0d84c 100644 --- a/azure/table_azure_compute_image.go +++ b/azure/table_azure_compute_image.go @@ -3,7 +3,7 @@ package azure import ( "context" - "github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2020-06-01/compute" + "github.com/Azure/azure-sdk-for-go/profiles/latest/compute/mgmt/compute" "github.com/turbot/steampipe-plugin-sdk/v5/grpc/proto" "github.com/turbot/steampipe-plugin-sdk/v5/plugin/transform" diff --git a/azure/table_azure_compute_resource_sku.go b/azure/table_azure_compute_resource_sku.go index 0dd1cd1f..bb91a512 100644 --- a/azure/table_azure_compute_resource_sku.go +++ b/azure/table_azure_compute_resource_sku.go @@ -4,7 +4,7 @@ import ( "context" "strings" - "github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2017-09-01/skus" + "github.com/Azure/azure-sdk-for-go/profiles/latest/compute/mgmt/skus" "github.com/turbot/steampipe-plugin-sdk/v5/grpc/proto" "github.com/turbot/steampipe-plugin-sdk/v5/plugin/transform" diff --git a/azure/table_azure_compute_snapshot.go b/azure/table_azure_compute_snapshot.go index 07f2d862..cd77c6d0 100644 --- a/azure/table_azure_compute_snapshot.go +++ b/azure/table_azure_compute_snapshot.go @@ -3,7 +3,7 @@ package azure import ( "context" - "github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2020-06-01/compute" + "github.com/Azure/azure-sdk-for-go/profiles/latest/compute/mgmt/compute" "github.com/turbot/steampipe-plugin-sdk/v5/grpc/proto" "github.com/turbot/steampipe-plugin-sdk/v5/plugin" "github.com/turbot/steampipe-plugin-sdk/v5/plugin/transform" diff --git a/azure/table_azure_compute_ssh_key.go b/azure/table_azure_compute_ssh_key.go index 491feca6..2b878215 100644 --- a/azure/table_azure_compute_ssh_key.go +++ b/azure/table_azure_compute_ssh_key.go @@ -3,7 +3,7 @@ package azure import ( "context" - "github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2020-06-01/compute" + "github.com/Azure/azure-sdk-for-go/profiles/latest/compute/mgmt/compute" "github.com/turbot/steampipe-plugin-sdk/v5/grpc/proto" "github.com/turbot/steampipe-plugin-sdk/v5/plugin" "github.com/turbot/steampipe-plugin-sdk/v5/plugin/transform" diff --git a/azure/table_azure_compute_virtual_machine.go b/azure/table_azure_compute_virtual_machine.go index 8501a4c3..e4f5c1bf 100644 --- a/azure/table_azure_compute_virtual_machine.go +++ b/azure/table_azure_compute_virtual_machine.go @@ -5,9 +5,9 @@ import ( "fmt" "strings" - "github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2020-06-01/compute" - "github.com/Azure/azure-sdk-for-go/services/guestconfiguration/mgmt/2020-06-25/guestconfiguration" - "github.com/Azure/azure-sdk-for-go/services/network/mgmt/2020-05-01/network" + "github.com/Azure/azure-sdk-for-go/profiles/latest/compute/mgmt/compute" + "github.com/Azure/azure-sdk-for-go/profiles/latest/guestconfiguration/mgmt/guestconfiguration" + "github.com/Azure/azure-sdk-for-go/profiles/latest/network/mgmt/network" "github.com/turbot/go-kit/types" "github.com/turbot/steampipe-plugin-sdk/v5/grpc/proto" @@ -401,7 +401,7 @@ func listComputeVirtualMachines(ctx context.Context, d *plugin.QueryData, _ *plu subscriptionID := session.SubscriptionID client := compute.NewVirtualMachinesClientWithBaseURI(session.ResourceManagerEndpoint, subscriptionID) client.Authorizer = session.Authorizer - result, err := client.ListAll(ctx, "") + result, err := client.ListAll(ctx, "", "") if err != nil { return nil, err } diff --git a/azure/table_azure_compute_virtual_machine_metric_available_memory.go b/azure/table_azure_compute_virtual_machine_metric_available_memory.go index 9904a4bf..81f6f780 100644 --- a/azure/table_azure_compute_virtual_machine_metric_available_memory.go +++ b/azure/table_azure_compute_virtual_machine_metric_available_memory.go @@ -3,7 +3,7 @@ package azure import ( "context" - "github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2020-06-01/compute" + "github.com/Azure/azure-sdk-for-go/profiles/latest/compute/mgmt/compute" "github.com/turbot/steampipe-plugin-sdk/v5/grpc/proto" "github.com/turbot/steampipe-plugin-sdk/v5/plugin" "github.com/turbot/steampipe-plugin-sdk/v5/plugin/transform" diff --git a/azure/table_azure_compute_virtual_machine_metric_available_memory_daily.go b/azure/table_azure_compute_virtual_machine_metric_available_memory_daily.go index d87568a8..c8e06380 100644 --- a/azure/table_azure_compute_virtual_machine_metric_available_memory_daily.go +++ b/azure/table_azure_compute_virtual_machine_metric_available_memory_daily.go @@ -3,7 +3,7 @@ package azure import ( "context" - "github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2020-06-01/compute" + "github.com/Azure/azure-sdk-for-go/profiles/latest/compute/mgmt/compute" "github.com/turbot/steampipe-plugin-sdk/v5/grpc/proto" "github.com/turbot/steampipe-plugin-sdk/v5/plugin" "github.com/turbot/steampipe-plugin-sdk/v5/plugin/transform" diff --git a/azure/table_azure_compute_virtual_machine_metric_available_memory_hourly.go b/azure/table_azure_compute_virtual_machine_metric_available_memory_hourly.go index f2e0615f..c6b81111 100644 --- a/azure/table_azure_compute_virtual_machine_metric_available_memory_hourly.go +++ b/azure/table_azure_compute_virtual_machine_metric_available_memory_hourly.go @@ -3,7 +3,7 @@ package azure import ( "context" - "github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2020-06-01/compute" + "github.com/Azure/azure-sdk-for-go/profiles/latest/compute/mgmt/compute" "github.com/turbot/steampipe-plugin-sdk/v5/grpc/proto" "github.com/turbot/steampipe-plugin-sdk/v5/plugin" "github.com/turbot/steampipe-plugin-sdk/v5/plugin/transform" diff --git a/azure/table_azure_compute_virtual_machine_metric_cpu_utilization.go b/azure/table_azure_compute_virtual_machine_metric_cpu_utilization.go index e74d06b7..23033eb6 100644 --- a/azure/table_azure_compute_virtual_machine_metric_cpu_utilization.go +++ b/azure/table_azure_compute_virtual_machine_metric_cpu_utilization.go @@ -3,7 +3,7 @@ package azure import ( "context" - "github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2020-06-01/compute" + "github.com/Azure/azure-sdk-for-go/profiles/latest/compute/mgmt/compute" "github.com/turbot/steampipe-plugin-sdk/v5/grpc/proto" "github.com/turbot/steampipe-plugin-sdk/v5/plugin" "github.com/turbot/steampipe-plugin-sdk/v5/plugin/transform" diff --git a/azure/table_azure_compute_virtual_machine_metric_cpu_utilization_daily.go b/azure/table_azure_compute_virtual_machine_metric_cpu_utilization_daily.go index 05057988..acd801d2 100644 --- a/azure/table_azure_compute_virtual_machine_metric_cpu_utilization_daily.go +++ b/azure/table_azure_compute_virtual_machine_metric_cpu_utilization_daily.go @@ -3,7 +3,7 @@ package azure import ( "context" - "github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2020-06-01/compute" + "github.com/Azure/azure-sdk-for-go/profiles/latest/compute/mgmt/compute" "github.com/turbot/steampipe-plugin-sdk/v5/grpc/proto" "github.com/turbot/steampipe-plugin-sdk/v5/plugin" "github.com/turbot/steampipe-plugin-sdk/v5/plugin/transform" diff --git a/azure/table_azure_compute_virtual_machine_metric_cpu_utilization_hourly.go b/azure/table_azure_compute_virtual_machine_metric_cpu_utilization_hourly.go index 9fe1c941..af782890 100644 --- a/azure/table_azure_compute_virtual_machine_metric_cpu_utilization_hourly.go +++ b/azure/table_azure_compute_virtual_machine_metric_cpu_utilization_hourly.go @@ -3,7 +3,7 @@ package azure import ( "context" - "github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2020-06-01/compute" + "github.com/Azure/azure-sdk-for-go/profiles/latest/compute/mgmt/compute" "github.com/turbot/steampipe-plugin-sdk/v5/grpc/proto" "github.com/turbot/steampipe-plugin-sdk/v5/plugin" "github.com/turbot/steampipe-plugin-sdk/v5/plugin/transform" diff --git a/azure/table_azure_compute_virtual_machine_scale_set.go b/azure/table_azure_compute_virtual_machine_scale_set.go index 9a2596f3..d7b5e62a 100644 --- a/azure/table_azure_compute_virtual_machine_scale_set.go +++ b/azure/table_azure_compute_virtual_machine_scale_set.go @@ -4,7 +4,7 @@ import ( "context" "strings" - "github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2020-06-01/compute" + "github.com/Azure/azure-sdk-for-go/profiles/latest/compute/mgmt/compute" "github.com/turbot/steampipe-plugin-sdk/v5/grpc/proto" "github.com/turbot/steampipe-plugin-sdk/v5/plugin" "github.com/turbot/steampipe-plugin-sdk/v5/plugin/transform" @@ -268,7 +268,7 @@ func getAzureComputeVirtualMachineScaleSet(ctx context.Context, d *plugin.QueryD client := compute.NewVirtualMachineScaleSetsClientWithBaseURI(session.ResourceManagerEndpoint, subscriptionID) client.Authorizer = session.Authorizer - op, err := client.Get(context.Background(), resourceGroup, name) + op, err := client.Get(ctx, resourceGroup, name, "") if err != nil { return nil, err } diff --git a/azure/table_azure_compute_virtual_machine_scale_set_network_interface.go b/azure/table_azure_compute_virtual_machine_scale_set_network_interface.go index b21e867b..726e144c 100644 --- a/azure/table_azure_compute_virtual_machine_scale_set_network_interface.go +++ b/azure/table_azure_compute_virtual_machine_scale_set_network_interface.go @@ -4,8 +4,8 @@ import ( "context" "strings" - "github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2020-06-01/compute" - "github.com/Azure/azure-sdk-for-go/services/network/mgmt/2020-05-01/network" + "github.com/Azure/azure-sdk-for-go/profiles/latest/compute/mgmt/compute" + "github.com/Azure/azure-sdk-for-go/profiles/latest/network/mgmt/network" "github.com/turbot/go-kit/types" "github.com/turbot/steampipe-plugin-sdk/v5/grpc/proto" "github.com/turbot/steampipe-plugin-sdk/v5/plugin" diff --git a/azure/table_azure_compute_virtual_machine_scale_set_vm.go b/azure/table_azure_compute_virtual_machine_scale_set_vm.go index 6bf60295..e63c4ba7 100644 --- a/azure/table_azure_compute_virtual_machine_scale_set_vm.go +++ b/azure/table_azure_compute_virtual_machine_scale_set_vm.go @@ -4,7 +4,7 @@ import ( "context" "strings" - "github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2020-06-01/compute" + "github.com/Azure/azure-sdk-for-go/profiles/latest/compute/mgmt/compute" "github.com/turbot/steampipe-plugin-sdk/v5/grpc/proto" "github.com/turbot/steampipe-plugin-sdk/v5/plugin" "github.com/turbot/steampipe-plugin-sdk/v5/plugin/transform" diff --git a/azure/table_azure_consumption_usage.go b/azure/table_azure_consumption_usage.go index ed44680d..93b65d28 100644 --- a/azure/table_azure_consumption_usage.go +++ b/azure/table_azure_consumption_usage.go @@ -6,7 +6,7 @@ import ( "strings" "time" - "github.com/Azure/azure-sdk-for-go/services/consumption/mgmt/2019-10-01/consumption" + "github.com/Azure/azure-sdk-for-go/profiles/latest/consumption/mgmt/consumption" "github.com/turbot/steampipe-plugin-sdk/v5/grpc/proto" "github.com/turbot/steampipe-plugin-sdk/v5/plugin/transform" diff --git a/azure/table_azure_container_group.go b/azure/table_azure_container_group.go index e4a15eee..36f4bd38 100644 --- a/azure/table_azure_container_group.go +++ b/azure/table_azure_container_group.go @@ -3,7 +3,7 @@ package azure import ( "context" - "github.com/Azure/azure-sdk-for-go/services/containerinstance/mgmt/2021-07-01/containerinstance" + "github.com/Azure/azure-sdk-for-go/profiles/latest/containerinstance/mgmt/containerinstance" "github.com/turbot/steampipe-plugin-sdk/v5/grpc/proto" "github.com/turbot/steampipe-plugin-sdk/v5/plugin" "github.com/turbot/steampipe-plugin-sdk/v5/plugin/transform" diff --git a/azure/table_azure_container_registry.go b/azure/table_azure_container_registry.go index 1c6911d0..7a176a3b 100644 --- a/azure/table_azure_container_registry.go +++ b/azure/table_azure_container_registry.go @@ -4,7 +4,7 @@ import ( "context" "strings" - "github.com/Azure/azure-sdk-for-go/services/preview/containerregistry/mgmt/2020-11-01-preview/containerregistry" + "github.com/Azure/azure-sdk-for-go/profiles/latest/containerregistry/mgmt/containerregistry" "github.com/turbot/steampipe-plugin-sdk/v5/grpc/proto" "github.com/turbot/steampipe-plugin-sdk/v5/plugin" "github.com/turbot/steampipe-plugin-sdk/v5/plugin/transform" diff --git a/azure/table_azure_cosmosdb_account.go b/azure/table_azure_cosmosdb_account.go index 6a27f2d8..7db507f6 100644 --- a/azure/table_azure_cosmosdb_account.go +++ b/azure/table_azure_cosmosdb_account.go @@ -4,7 +4,7 @@ import ( "context" "strings" - "github.com/Azure/azure-sdk-for-go/services/cosmos-db/mgmt/2021-06-15/documentdb" + "github.com/Azure/azure-sdk-for-go/profiles/latest/cosmos-db/mgmt/documentdb" "github.com/turbot/steampipe-plugin-sdk/v5/grpc/proto" "github.com/turbot/steampipe-plugin-sdk/v5/plugin/transform" @@ -277,6 +277,18 @@ func tableAzureCosmosDBAccount(_ context.Context) *plugin.Table { } } + +type PrivateConnectionInfo struct { + PrivateEndpointConnectionId string + PrivateEndpointId string + PrivateEndpointConnectionName string + PrivateEndpointConnectionType string + PrivateLinkServiceConnectionStateStatus string + PrivateLinkServiceConnectionStateDescription string + PrivateLinkServiceConnectionStateActionsRequired string + ProvisioningState string +} + //// LIST FUNCTION func listCosmosDBAccounts(ctx context.Context, d *plugin.QueryData, _ *plugin.HydrateData) (interface{}, error) { diff --git a/azure/table_azure_cosmosdb_mongo_collection.go b/azure/table_azure_cosmosdb_mongo_collection.go index 8a561fa0..1c276480 100644 --- a/azure/table_azure_cosmosdb_mongo_collection.go +++ b/azure/table_azure_cosmosdb_mongo_collection.go @@ -4,7 +4,7 @@ import ( "context" "strings" - "github.com/Azure/azure-sdk-for-go/services/preview/cosmos-db/mgmt/2021-04-01-preview/documentdb" + "github.com/Azure/azure-sdk-for-go/profiles/latest/cosmos-db/mgmt/documentdb" "github.com/turbot/steampipe-plugin-sdk/v5/grpc/proto" "github.com/turbot/steampipe-plugin-sdk/v5/plugin/transform" diff --git a/azure/table_azure_cosmosdb_mongo_database.go b/azure/table_azure_cosmosdb_mongo_database.go index 688d5b91..b32c132f 100644 --- a/azure/table_azure_cosmosdb_mongo_database.go +++ b/azure/table_azure_cosmosdb_mongo_database.go @@ -4,7 +4,7 @@ import ( "context" "strings" - "github.com/Azure/azure-sdk-for-go/services/preview/cosmos-db/mgmt/2021-04-01-preview/documentdb" + "github.com/Azure/azure-sdk-for-go/profiles/latest/cosmos-db/mgmt/documentdb" "github.com/turbot/steampipe-plugin-sdk/v5/grpc/proto" "github.com/turbot/steampipe-plugin-sdk/v5/plugin/transform" diff --git a/azure/table_azure_cosmosdb_restorable_database_account.go b/azure/table_azure_cosmosdb_restorable_database_account.go index db3bc903..19cb3d6a 100644 --- a/azure/table_azure_cosmosdb_restorable_database_account.go +++ b/azure/table_azure_cosmosdb_restorable_database_account.go @@ -3,7 +3,7 @@ package azure import ( "context" - "github.com/Azure/azure-sdk-for-go/services/preview/cosmos-db/mgmt/2021-04-01-preview/documentdb" + "github.com/Azure/azure-sdk-for-go/profiles/latest/cosmos-db/mgmt/documentdb" "github.com/Azure/go-autorest/autorest/date" "github.com/turbot/steampipe-plugin-sdk/v5/grpc/proto" "github.com/turbot/steampipe-plugin-sdk/v5/plugin/transform" diff --git a/azure/table_azure_cosmosdb_sql_database.go b/azure/table_azure_cosmosdb_sql_database.go index 6bc2208c..32a6faf7 100644 --- a/azure/table_azure_cosmosdb_sql_database.go +++ b/azure/table_azure_cosmosdb_sql_database.go @@ -4,7 +4,7 @@ import ( "context" "strings" - "github.com/Azure/azure-sdk-for-go/services/preview/cosmos-db/mgmt/2020-04-01-preview/documentdb" + "github.com/Azure/azure-sdk-for-go/profiles/latest/cosmos-db/mgmt/documentdb" "github.com/turbot/steampipe-plugin-sdk/v5/grpc/proto" "github.com/turbot/steampipe-plugin-sdk/v5/plugin/transform" diff --git a/azure/table_azure_data_factory.go b/azure/table_azure_data_factory.go index 0d4b0345..d729ad45 100644 --- a/azure/table_azure_data_factory.go +++ b/azure/table_azure_data_factory.go @@ -4,7 +4,7 @@ import ( "context" "strings" - "github.com/Azure/azure-sdk-for-go/services/datafactory/mgmt/2018-06-01/datafactory" + "github.com/Azure/azure-sdk-for-go/profiles/latest/datafactory/mgmt/datafactory" "github.com/turbot/steampipe-plugin-sdk/v5/grpc/proto" "github.com/turbot/steampipe-plugin-sdk/v5/plugin/transform" diff --git a/azure/table_azure_data_factory_dataset.go b/azure/table_azure_data_factory_dataset.go index 7db03dcc..280b7c88 100644 --- a/azure/table_azure_data_factory_dataset.go +++ b/azure/table_azure_data_factory_dataset.go @@ -4,7 +4,7 @@ import ( "context" "strings" - "github.com/Azure/azure-sdk-for-go/services/datafactory/mgmt/2018-06-01/datafactory" + "github.com/Azure/azure-sdk-for-go/profiles/latest/datafactory/mgmt/datafactory" "github.com/turbot/steampipe-plugin-sdk/v5/grpc/proto" "github.com/turbot/steampipe-plugin-sdk/v5/plugin/transform" diff --git a/azure/table_azure_data_factory_pipeline.go b/azure/table_azure_data_factory_pipeline.go index 53598f74..f5a788d1 100644 --- a/azure/table_azure_data_factory_pipeline.go +++ b/azure/table_azure_data_factory_pipeline.go @@ -4,7 +4,7 @@ import ( "context" "strings" - "github.com/Azure/azure-sdk-for-go/services/datafactory/mgmt/2018-06-01/datafactory" + "github.com/Azure/azure-sdk-for-go/profiles/latest/datafactory/mgmt/datafactory" "github.com/turbot/steampipe-plugin-sdk/v5/grpc/proto" "github.com/turbot/steampipe-plugin-sdk/v5/plugin/transform" diff --git a/azure/table_azure_data_lake_analytics_account.go b/azure/table_azure_data_lake_analytics_account.go index 084019e7..99c4b4df 100644 --- a/azure/table_azure_data_lake_analytics_account.go +++ b/azure/table_azure_data_lake_analytics_account.go @@ -4,8 +4,9 @@ import ( "context" "strings" - "github.com/Azure/azure-sdk-for-go/profiles/2020-09-01/monitor/mgmt/insights" - "github.com/Azure/azure-sdk-for-go/services/datalake/analytics/mgmt/2016-11-01/account" + "github.com/Azure/azure-sdk-for-go/profiles/latest/datalake/analytics/mgmt/account" + "github.com/Azure/azure-sdk-for-go/profiles/preview/preview/monitor/mgmt/insights" + "github.com/turbot/steampipe-plugin-sdk/v5/grpc/proto" "github.com/turbot/steampipe-plugin-sdk/v5/plugin/transform" diff --git a/azure/table_azure_data_lake_store.go b/azure/table_azure_data_lake_store.go index ae22a969..b7c1f0bb 100644 --- a/azure/table_azure_data_lake_store.go +++ b/azure/table_azure_data_lake_store.go @@ -4,8 +4,8 @@ import ( "context" "strings" - "github.com/Azure/azure-sdk-for-go/profiles/2020-09-01/monitor/mgmt/insights" - "github.com/Azure/azure-sdk-for-go/services/datalake/store/mgmt/2016-11-01/account" + "github.com/Azure/azure-sdk-for-go/profiles/preview/preview/monitor/mgmt/insights" + "github.com/Azure/azure-sdk-for-go/profiles/latest/datalake/analytics/mgmt/account" "github.com/turbot/steampipe-plugin-sdk/v5/grpc/proto" "github.com/turbot/steampipe-plugin-sdk/v5/plugin/transform" @@ -275,7 +275,7 @@ func getDataLakeStore(ctx context.Context, d *plugin.QueryData, h *plugin.Hydrat var name, resourceGroup string if h.Item != nil { - data := h.Item.(account.DataLakeStoreAccountBasic) + data := h.Item.(account.DataLakeAnalyticsAccountBasic) splitID := strings.Split(*data.ID, "/") name = *data.Name resourceGroup = splitID[4] @@ -340,9 +340,9 @@ func listDataLakeStoreDiagnosticSettings(ctx context.Context, d *plugin.QueryDat func getLakeStoreID(item interface{}) string { switch item := item.(type) { - case account.DataLakeStoreAccountBasic: + case account.DataLakeAnalyticsAccountBasic: return *item.ID - case account.DataLakeStoreAccount: + case account.DataLakeAnalyticsAccount: return *item.ID } return "" diff --git a/azure/table_azure_databox_edge_device.go b/azure/table_azure_databox_edge_device.go index 520eaa18..8d267340 100644 --- a/azure/table_azure_databox_edge_device.go +++ b/azure/table_azure_databox_edge_device.go @@ -3,7 +3,7 @@ package azure import ( "context" - "github.com/Azure/azure-sdk-for-go/services/databoxedge/mgmt/2019-07-01/databoxedge" + "github.com/Azure/azure-sdk-for-go/profiles/latest/databoxedge/mgmt/databoxedge" "github.com/turbot/steampipe-plugin-sdk/v5/grpc/proto" "github.com/turbot/steampipe-plugin-sdk/v5/plugin/transform" diff --git a/azure/table_azure_databricks_workspace.go b/azure/table_azure_databricks_workspace.go index afe27b7e..a0e3ae34 100644 --- a/azure/table_azure_databricks_workspace.go +++ b/azure/table_azure_databricks_workspace.go @@ -3,7 +3,7 @@ package azure import ( "context" - "github.com/Azure/azure-sdk-for-go/services/databricks/mgmt/2018-04-01/databricks" + "github.com/Azure/azure-sdk-for-go/profiles/latest/databricks/mgmt/databricks" "github.com/turbot/steampipe-plugin-sdk/v5/grpc/proto" "github.com/turbot/steampipe-plugin-sdk/v5/plugin/transform" diff --git a/azure/table_azure_diagnostic_setting.go b/azure/table_azure_diagnostic_setting.go index 15f82cf5..04e0dfa0 100644 --- a/azure/table_azure_diagnostic_setting.go +++ b/azure/table_azure_diagnostic_setting.go @@ -4,7 +4,7 @@ import ( "context" "strings" - "github.com/Azure/azure-sdk-for-go/profiles/2020-09-01/monitor/mgmt/insights" + "github.com/Azure/azure-sdk-for-go/profiles/preview/preview/monitor/mgmt/insights" "github.com/turbot/steampipe-plugin-sdk/v5/grpc/proto" "github.com/turbot/steampipe-plugin-sdk/v5/plugin/transform" diff --git a/azure/table_azure_dns_zone.go b/azure/table_azure_dns_zone.go index 7ad73b5d..532b1a83 100644 --- a/azure/table_azure_dns_zone.go +++ b/azure/table_azure_dns_zone.go @@ -3,7 +3,7 @@ package azure import ( "context" - "github.com/Azure/azure-sdk-for-go/services/dns/mgmt/2018-05-01/dns" + "github.com/Azure/azure-sdk-for-go/profiles/latest/dns/mgmt/dns" "github.com/turbot/steampipe-plugin-sdk/v5/grpc/proto" "github.com/turbot/steampipe-plugin-sdk/v5/plugin/transform" diff --git a/azure/table_azure_eventgrid_domain.go b/azure/table_azure_eventgrid_domain.go index 94695b3b..90d8c1ab 100644 --- a/azure/table_azure_eventgrid_domain.go +++ b/azure/table_azure_eventgrid_domain.go @@ -3,8 +3,8 @@ package azure import ( "context" - "github.com/Azure/azure-sdk-for-go/profiles/2020-09-01/monitor/mgmt/insights" - "github.com/Azure/azure-sdk-for-go/services/preview/eventgrid/mgmt/2021-06-01-preview/eventgrid" + "github.com/Azure/azure-sdk-for-go/profiles/latest/eventgrid/mgmt/eventgrid" + "github.com/Azure/azure-sdk-for-go/profiles/preview/preview/monitor/mgmt/insights" "github.com/turbot/steampipe-plugin-sdk/v5/grpc/proto" "github.com/turbot/steampipe-plugin-sdk/v5/plugin" "github.com/turbot/steampipe-plugin-sdk/v5/plugin/transform" diff --git a/azure/table_azure_eventgrid_topic.go b/azure/table_azure_eventgrid_topic.go index 41735468..f5d3ce70 100644 --- a/azure/table_azure_eventgrid_topic.go +++ b/azure/table_azure_eventgrid_topic.go @@ -3,8 +3,9 @@ package azure import ( "context" - "github.com/Azure/azure-sdk-for-go/profiles/2020-09-01/monitor/mgmt/insights" - "github.com/Azure/azure-sdk-for-go/services/preview/eventgrid/mgmt/2021-06-01-preview/eventgrid" + "github.com/Azure/azure-sdk-for-go/profiles/latest/eventgrid/mgmt/eventgrid" + "github.com/Azure/azure-sdk-for-go/profiles/preview/preview/monitor/mgmt/insights" + "github.com/turbot/steampipe-plugin-sdk/v5/grpc/proto" "github.com/turbot/steampipe-plugin-sdk/v5/plugin" "github.com/turbot/steampipe-plugin-sdk/v5/plugin/transform" diff --git a/azure/table_azure_eventhub_namespace.go b/azure/table_azure_eventhub_namespace.go index 38a19b5d..2a6a30d8 100644 --- a/azure/table_azure_eventhub_namespace.go +++ b/azure/table_azure_eventhub_namespace.go @@ -4,8 +4,8 @@ import ( "context" "strings" - "github.com/Azure/azure-sdk-for-go/profiles/2020-09-01/monitor/mgmt/insights" - "github.com/Azure/azure-sdk-for-go/services/preview/eventhub/mgmt/2018-01-01-preview/eventhub" + "github.com/Azure/azure-sdk-for-go/profiles/preview/preview/eventhub/mgmt/eventhub" + "github.com/Azure/azure-sdk-for-go/profiles/preview/preview/monitor/mgmt/insights" "github.com/turbot/steampipe-plugin-sdk/v5/grpc/proto" "github.com/turbot/steampipe-plugin-sdk/v5/plugin" "github.com/turbot/steampipe-plugin-sdk/v5/plugin/transform" diff --git a/azure/table_azure_express_route_circuit.go b/azure/table_azure_express_route_circuit.go index 9d48a9f1..f1df48cc 100644 --- a/azure/table_azure_express_route_circuit.go +++ b/azure/table_azure_express_route_circuit.go @@ -3,7 +3,8 @@ package azure import ( "context" - "github.com/Azure/azure-sdk-for-go/services/network/mgmt/2020-07-01/network" + "github.com/Azure/azure-sdk-for-go/profiles/latest/network/mgmt/network" + "github.com/turbot/steampipe-plugin-sdk/v5/grpc/proto" "github.com/turbot/steampipe-plugin-sdk/v5/plugin" "github.com/turbot/steampipe-plugin-sdk/v5/plugin/transform" diff --git a/azure/table_azure_firewall.go b/azure/table_azure_firewall.go index 26f45002..d5ae17e9 100644 --- a/azure/table_azure_firewall.go +++ b/azure/table_azure_firewall.go @@ -3,7 +3,7 @@ package azure import ( "context" - "github.com/Azure/azure-sdk-for-go/services/network/mgmt/2020-07-01/network" + "github.com/Azure/azure-sdk-for-go/profiles/latest/network/mgmt/network" "github.com/turbot/steampipe-plugin-sdk/v5/grpc/proto" "github.com/turbot/steampipe-plugin-sdk/v5/plugin/transform" diff --git a/azure/table_azure_firewall_policy.go b/azure/table_azure_firewall_policy.go index 4e18b764..8d8bfc53 100644 --- a/azure/table_azure_firewall_policy.go +++ b/azure/table_azure_firewall_policy.go @@ -3,7 +3,7 @@ package azure import ( "context" - "github.com/Azure/azure-sdk-for-go/services/network/mgmt/2020-07-01/network" + "github.com/Azure/azure-sdk-for-go/profiles/latest/network/mgmt/network" "github.com/turbot/steampipe-plugin-sdk/v5/grpc/proto" "github.com/turbot/steampipe-plugin-sdk/v5/plugin/transform" diff --git a/azure/table_azure_frontdoor.go b/azure/table_azure_frontdoor.go index dc40cc63..de9760de 100644 --- a/azure/table_azure_frontdoor.go +++ b/azure/table_azure_frontdoor.go @@ -3,8 +3,8 @@ package azure import ( "context" - "github.com/Azure/azure-sdk-for-go/profiles/2020-09-01/monitor/mgmt/insights" - "github.com/Azure/azure-sdk-for-go/services/frontdoor/mgmt/2020-05-01/frontdoor" + "github.com/Azure/azure-sdk-for-go/profiles/preview/preview/monitor/mgmt/insights" + "github.com/Azure/azure-sdk-for-go/profiles/latest/frontdoor/mgmt/frontdoor" "github.com/turbot/steampipe-plugin-sdk/v5/grpc/proto" "github.com/turbot/steampipe-plugin-sdk/v5/plugin/transform" diff --git a/azure/table_azure_hdinsight_cluster.go b/azure/table_azure_hdinsight_cluster.go index 5e79104d..f997265a 100644 --- a/azure/table_azure_hdinsight_cluster.go +++ b/azure/table_azure_hdinsight_cluster.go @@ -3,8 +3,8 @@ package azure import ( "context" - "github.com/Azure/azure-sdk-for-go/profiles/2020-09-01/monitor/mgmt/insights" - "github.com/Azure/azure-sdk-for-go/services/hdinsight/mgmt/2018-06-01/hdinsight" + "github.com/Azure/azure-sdk-for-go/profiles/latest/hdinsight/mgmt/hdinsight" + "github.com/Azure/azure-sdk-for-go/profiles/preview/preview/monitor/mgmt/insights" "github.com/turbot/steampipe-plugin-sdk/v5/grpc/proto" "github.com/turbot/steampipe-plugin-sdk/v5/plugin/transform" diff --git a/azure/table_azure_healthcare_service.go b/azure/table_azure_healthcare_service.go index e4ee9fff..5f4367b4 100644 --- a/azure/table_azure_healthcare_service.go +++ b/azure/table_azure_healthcare_service.go @@ -4,8 +4,8 @@ import ( "context" "strings" - "github.com/Azure/azure-sdk-for-go/profiles/2020-09-01/monitor/mgmt/insights" "github.com/Azure/azure-sdk-for-go/profiles/latest/healthcareapis/mgmt/healthcareapis" + "github.com/Azure/azure-sdk-for-go/profiles/preview/preview/monitor/mgmt/insights" "github.com/turbot/steampipe-plugin-sdk/v5/grpc/proto" "github.com/turbot/steampipe-plugin-sdk/v5/plugin/transform" diff --git a/azure/table_azure_hpc_cache.go b/azure/table_azure_hpc_cache.go index 29342fc9..d28d50b2 100644 --- a/azure/table_azure_hpc_cache.go +++ b/azure/table_azure_hpc_cache.go @@ -3,7 +3,8 @@ package azure import ( "context" - "github.com/Azure/azure-sdk-for-go/services/storagecache/mgmt/2021-05-01/storagecache" + "github.com/Azure/azure-sdk-for-go/profiles/latest/storagecache/mgmt/storagecache" + "github.com/Azure/go-autorest/autorest/date" "github.com/turbot/steampipe-plugin-sdk/v5/grpc/proto" "github.com/turbot/steampipe-plugin-sdk/v5/plugin/transform" diff --git a/azure/table_azure_hybrid_kubernetes_connected_cluster.go b/azure/table_azure_hybrid_kubernetes_connected_cluster.go index a59dec1a..4d5f4576 100644 --- a/azure/table_azure_hybrid_kubernetes_connected_cluster.go +++ b/azure/table_azure_hybrid_kubernetes_connected_cluster.go @@ -293,7 +293,7 @@ func listHybridKubernetesConnectedClusterExtensions(ctx context.Context, d *plug client := kubernetesconfiguration.NewExtensionsClientWithBaseURI(session.ResourceManagerEndpoint, subscriptionID) client.Authorizer = session.Authorizer - extensions := []kubernetesconfiguration.ExtensionInstance{} + extensions := []kubernetesconfiguration.Extension{} result, err := client.List(ctx, resourceGroup, "Microsoft.Kubernetes", "connectedClusters", *cluster.Name) if err != nil { plugin.Logger(ctx).Error("listHybridKubernetesConnectedClusterExtensions", "list", err) diff --git a/azure/table_azure_iothub.go b/azure/table_azure_iothub.go index aea12224..936e8c43 100644 --- a/azure/table_azure_iothub.go +++ b/azure/table_azure_iothub.go @@ -3,8 +3,9 @@ package azure import ( "context" - "github.com/Azure/azure-sdk-for-go/profiles/2020-09-01/monitor/mgmt/insights" - "github.com/Azure/azure-sdk-for-go/services/iothub/mgmt/2020-03-01/devices" + "github.com/Azure/azure-sdk-for-go/profiles/latest/iothub/mgmt/devices" + "github.com/Azure/azure-sdk-for-go/profiles/preview/preview/monitor/mgmt/insights" + "github.com/turbot/steampipe-plugin-sdk/v5/grpc/proto" "github.com/turbot/steampipe-plugin-sdk/v5/plugin/transform" diff --git a/azure/table_azure_iothub_dps.go b/azure/table_azure_iothub_dps.go index ec22b805..c3d1bce0 100644 --- a/azure/table_azure_iothub_dps.go +++ b/azure/table_azure_iothub_dps.go @@ -3,8 +3,8 @@ package azure import ( "context" - "github.com/Azure/azure-sdk-for-go/profiles/2020-09-01/monitor/mgmt/insights" "github.com/Azure/azure-sdk-for-go/profiles/latest/provisioningservices/mgmt/iothub" + "github.com/Azure/azure-sdk-for-go/profiles/preview/preview/monitor/mgmt/insights" "github.com/turbot/steampipe-plugin-sdk/v5/grpc/proto" "github.com/turbot/steampipe-plugin-sdk/v5/plugin/transform" diff --git a/azure/table_azure_key_vault.go b/azure/table_azure_key_vault.go index b39ad9fa..25eb1771 100644 --- a/azure/table_azure_key_vault.go +++ b/azure/table_azure_key_vault.go @@ -4,8 +4,8 @@ import ( "context" "strings" - "github.com/Azure/azure-sdk-for-go/profiles/2020-09-01/monitor/mgmt/insights" - "github.com/Azure/azure-sdk-for-go/services/keyvault/mgmt/2019-09-01/keyvault" + "github.com/Azure/azure-sdk-for-go/profiles/latest/keyvault/mgmt/keyvault" + "github.com/Azure/azure-sdk-for-go/profiles/preview/preview/monitor/mgmt/insights" "github.com/turbot/steampipe-plugin-sdk/v5/grpc/proto" "github.com/turbot/steampipe-plugin-sdk/v5/plugin/transform" @@ -349,8 +349,8 @@ func extractKeyVaultPrivateEndpointConnections(ctx context.Context, d *transform privateEndpoint.PrivateEndpointId = *connection.PrivateEndpoint.ID } if connection.PrivateLinkServiceConnectionState != nil { - if connection.PrivateLinkServiceConnectionState.ActionRequired != nil { - privateEndpoint.PrivateLinkServiceConnectionStateActionRequired = *connection.PrivateLinkServiceConnectionState.ActionRequired + if connection.PrivateLinkServiceConnectionState.ActionsRequired != "" { + privateEndpoint.PrivateLinkServiceConnectionStateActionRequired = string(connection.PrivateLinkServiceConnectionState.ActionsRequired) } if connection.PrivateLinkServiceConnectionState.Description != nil { privateEndpoint.PrivateLinkServiceConnectionStateDescription = *connection.PrivateLinkServiceConnectionState.Description diff --git a/azure/table_azure_key_vault_deleted_vault.go b/azure/table_azure_key_vault_deleted_vault.go index efa998c3..9b761b13 100644 --- a/azure/table_azure_key_vault_deleted_vault.go +++ b/azure/table_azure_key_vault_deleted_vault.go @@ -3,7 +3,8 @@ package azure import ( "context" - "github.com/Azure/azure-sdk-for-go/services/keyvault/mgmt/2019-09-01/keyvault" + "github.com/Azure/azure-sdk-for-go/profiles/latest/keyvault/mgmt/keyvault" + "github.com/turbot/steampipe-plugin-sdk/v5/grpc/proto" "github.com/turbot/steampipe-plugin-sdk/v5/plugin/transform" diff --git a/azure/table_azure_key_vault_key.go b/azure/table_azure_key_vault_key.go index 102e7bb7..c238025e 100644 --- a/azure/table_azure_key_vault_key.go +++ b/azure/table_azure_key_vault_key.go @@ -4,7 +4,7 @@ import ( "context" "strings" - "github.com/Azure/azure-sdk-for-go/services/keyvault/mgmt/2019-09-01/keyvault" + "github.com/Azure/azure-sdk-for-go/profiles/latest/keyvault/mgmt/keyvault" "github.com/turbot/steampipe-plugin-sdk/v5/grpc/proto" "github.com/turbot/steampipe-plugin-sdk/v5/plugin/transform" diff --git a/azure/table_azure_key_vault_key_version.go b/azure/table_azure_key_vault_key_version.go index 8029cd96..ed8d7826 100644 --- a/azure/table_azure_key_vault_key_version.go +++ b/azure/table_azure_key_vault_key_version.go @@ -5,7 +5,7 @@ import ( "strings" "sync" - "github.com/Azure/azure-sdk-for-go/services/keyvault/mgmt/2019-09-01/keyvault" + "github.com/Azure/azure-sdk-for-go/profiles/latest/keyvault/mgmt/keyvault" "github.com/turbot/steampipe-plugin-sdk/v5/grpc/proto" "github.com/turbot/steampipe-plugin-sdk/v5/plugin/transform" diff --git a/azure/table_azure_key_vault_managed_hardware_security_module.go b/azure/table_azure_key_vault_managed_hardware_security_module.go index 2d22173e..027f9449 100644 --- a/azure/table_azure_key_vault_managed_hardware_security_module.go +++ b/azure/table_azure_key_vault_managed_hardware_security_module.go @@ -4,8 +4,8 @@ import ( "context" "strings" - "github.com/Azure/azure-sdk-for-go/profiles/2020-09-01/monitor/mgmt/insights" - "github.com/Azure/azure-sdk-for-go/services/preview/keyvault/mgmt/2020-04-01-preview/keyvault" + "github.com/Azure/azure-sdk-for-go/profiles/preview/preview/monitor/mgmt/insights" + "github.com/Azure/azure-sdk-for-go/profiles/latest/keyvault/mgmt/keyvault" "github.com/turbot/steampipe-plugin-sdk/v5/grpc/proto" "github.com/turbot/steampipe-plugin-sdk/v5/plugin/transform" diff --git a/azure/table_azure_key_vault_secret.go b/azure/table_azure_key_vault_secret.go index e45057c6..85b1a725 100644 --- a/azure/table_azure_key_vault_secret.go +++ b/azure/table_azure_key_vault_secret.go @@ -4,7 +4,7 @@ import ( "context" "strings" - "github.com/Azure/azure-sdk-for-go/services/keyvault/mgmt/2019-09-01/keyvault" + "github.com/Azure/azure-sdk-for-go/profiles/latest/keyvault/mgmt/keyvault" secret "github.com/Azure/azure-sdk-for-go/services/keyvault/v7.1/keyvault" "github.com/turbot/steampipe-plugin-sdk/v5/grpc/proto" "github.com/turbot/steampipe-plugin-sdk/v5/plugin/transform" diff --git a/azure/table_azure_kubernetes_cluster.go b/azure/table_azure_kubernetes_cluster.go index 0cd1a830..4751495d 100644 --- a/azure/table_azure_kubernetes_cluster.go +++ b/azure/table_azure_kubernetes_cluster.go @@ -3,7 +3,7 @@ package azure import ( "context" - "github.com/Azure/azure-sdk-for-go/services/containerservice/mgmt/2021-02-01/containerservice" + "github.com/Azure/azure-sdk-for-go/profiles/latest/containerservice/mgmt/containerservice" "github.com/turbot/steampipe-plugin-sdk/v5/grpc/proto" "github.com/turbot/steampipe-plugin-sdk/v5/plugin/transform" diff --git a/azure/table_azure_kubernetes_service_version.go b/azure/table_azure_kubernetes_service_version.go index c49e631f..cd7c3613 100644 --- a/azure/table_azure_kubernetes_service_version.go +++ b/azure/table_azure_kubernetes_service_version.go @@ -3,7 +3,7 @@ package azure import ( "context" - "github.com/Azure/azure-sdk-for-go/services/containerservice/mgmt/2020-09-01/containerservice" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerservice/armcontainerservice/v4" "github.com/turbot/steampipe-plugin-sdk/v5/grpc/proto" "github.com/turbot/steampipe-plugin-sdk/v5/plugin/transform" @@ -12,54 +12,24 @@ import ( //// TABLE DEFINITION //// -func tableAzureAKSOrchestractor(_ context.Context) *plugin.Table { +func tableAzureAKSVersion(_ context.Context) *plugin.Table { return &plugin.Table{ Name: "azure_kubernetes_service_version", Description: "Azure Kubernetes Service Version", List: &plugin.ListConfig{ - Hydrate: listAKSOrchestractors, + Hydrate: listAKSVersions, KeyColumns: plugin.KeyColumnSlice{ { Name: "location", Require: plugin.Required, }, - { - Name: "resource_type", - Require: plugin.Optional, - }, }, }, Columns: azureColumns([]*plugin.Column{ { - Name: "name", - Type: proto.ColumnType_STRING, - Description: "Name of the orchestrator version profile list result.", - }, - { - Name: "id", - Description: "ID of the orchestrator version profile list result.", - Type: proto.ColumnType_STRING, - Transform: transform.FromGo(), - }, - { - Name: "type", - Description: "Type of the orchestrator version profile list result.", - Type: proto.ColumnType_STRING, - }, - { - Name: "orchestrator_type", - Description: "The orchestrator type.", - Type: proto.ColumnType_STRING, - }, - { - Name: "orchestrator_version", - Description: "Orchestrator version (major, minor, patch).", + Name: "version", Type: proto.ColumnType_STRING, - }, - { - Name: "default", - Description: "Installed by default if version is not specified.", - Type: proto.ColumnType_BOOL, + Description: "The major.minor version of Kubernetes release.", }, { Name: "is_preview", @@ -67,14 +37,13 @@ func tableAzureAKSOrchestractor(_ context.Context) *plugin.Table { Type: proto.ColumnType_BOOL, }, { - Name: "resource_type", - Description: "Whether Kubernetes version is currently in preview.", - Type: proto.ColumnType_STRING, - Transform: transform.FromQual("resource_type"), + Name: "capabilities", + Description: "Capabilities on this Kubernetes version.", + Type: proto.ColumnType_JSON, }, { - Name: "upgrades", - Description: "The list of available upgrade versions.", + Name: "patch_versions", + Description: "Patch versions of Kubernetes release.", Type: proto.ColumnType_JSON, }, @@ -83,13 +52,7 @@ func tableAzureAKSOrchestractor(_ context.Context) *plugin.Table { Name: "title", Description: ColumnDescriptionTitle, Type: proto.ColumnType_STRING, - Transform: transform.FromField("Name"), - }, - { - Name: "akas", - Description: ColumnDescriptionAkas, - Type: proto.ColumnType_JSON, - Transform: transform.FromField("ID").Transform(idToAkas), + Transform: transform.FromField("Version"), }, // Azure standard columns @@ -103,64 +66,31 @@ func tableAzureAKSOrchestractor(_ context.Context) *plugin.Table { } } -type OrchestratorInfo struct { - // ID - READ-ONLY; Id of the orchestrator version profile list result. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; Name of the orchestrator version profile list result. - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; Type of the orchestrator version profile list result. - Type *string `json:"type,omitempty"` - // OrchestratorType - Orchestrator type. - OrchestratorType *string `json:"orchestratorType,omitempty"` - // OrchestratorVersion - Orchestrator version (major, minor, patch). - OrchestratorVersion *string `json:"orchestratorVersion,omitempty"` - // Default - Installed by default if version is not specified. - Default *bool `json:"default,omitempty"` - // IsPreview - Whether Kubernetes version is currently in preview. - IsPreview *bool `json:"isPreview,omitempty"` - // Upgrades - The list of available upgrade versions. - Upgrades *[]containerservice.OrchestratorProfile `json:"upgrades,omitempty"` -} - //// LIST FUNCTION -func listAKSOrchestractors(ctx context.Context, d *plugin.QueryData, _ *plugin.HydrateData) (interface{}, error) { +func listAKSVersions(ctx context.Context, d *plugin.QueryData, _ *plugin.HydrateData) (interface{}, error) { location := d.EqualsQualString("location") - resourceType := d.EqualsQualString("resource_type") // Empty Check if location == "" { return nil, nil } - session, err := GetNewSession(ctx, d, "MANAGEMENT") + session, err := GetNewSessionUpdated(ctx, d) if err != nil { - plugin.Logger(ctx).Error("azure_kubernetes_service_version.listAKSOrchestractors", "session_error", err) + plugin.Logger(ctx).Error("azure_kubernetes_service_version.listAKSVersions", "session_error", err) return nil, err } - subscriptionID := session.SubscriptionID - - containerserviceClient := containerservice.NewContainerServicesClientWithBaseURI(session.ResourceManagerEndpoint, subscriptionID) - containerserviceClient.Authorizer = session.Authorizer - - result, err := containerserviceClient.ListOrchestrators(ctx, location, resourceType) + client, err := armcontainerservice.NewManagedClustersClient(session.SubscriptionID, session.Cred, session.ClientOptions) if err != nil { - plugin.Logger(ctx).Error("azure_kubernetes_service_version.listAKSOrchestractors", "api_error", err) return nil, err } - for _, op := range *result.Orchestrators { - d.StreamListItem(ctx, &OrchestratorInfo{ - ID: result.ID, - Name: result.Name, - Type: result.Type, - OrchestratorType: op.OrchestratorType, - OrchestratorVersion: op.OrchestratorVersion, - Default: op.Default, - IsPreview: op.IsPreview, - Upgrades: op.Upgrades, - }) + result, err := client.ListKubernetesVersions(ctx, location, nil) + + for _, op := range result.Values { + d.StreamListItem(ctx, op) // Check if context has been cancelled or if the limit has been hit (if specified) // if there is a limit, it will return the number of rows required to reach this limit if d.RowsRemaining(ctx) == 0 { diff --git a/azure/table_azure_kusto_cluster.go b/azure/table_azure_kusto_cluster.go index c9f44efa..1bcc84a9 100644 --- a/azure/table_azure_kusto_cluster.go +++ b/azure/table_azure_kusto_cluster.go @@ -3,7 +3,7 @@ package azure import ( "context" - "github.com/Azure/azure-sdk-for-go/services/kusto/mgmt/2021-01-01/kusto" + "github.com/Azure/azure-sdk-for-go/profiles/latest/kusto/mgmt/kusto" "github.com/turbot/steampipe-plugin-sdk/v5/grpc/proto" "github.com/turbot/steampipe-plugin-sdk/v5/plugin/transform" diff --git a/azure/table_azure_lb.go b/azure/table_azure_lb.go index 5ca51ee3..b5e7068b 100644 --- a/azure/table_azure_lb.go +++ b/azure/table_azure_lb.go @@ -3,8 +3,8 @@ package azure import ( "context" - "github.com/Azure/azure-sdk-for-go/profiles/2020-09-01/monitor/mgmt/insights" - "github.com/Azure/azure-sdk-for-go/services/network/mgmt/2021-02-01/network" + "github.com/Azure/azure-sdk-for-go/profiles/latest/network/mgmt/network" + "github.com/Azure/azure-sdk-for-go/profiles/preview/preview/monitor/mgmt/insights" "github.com/turbot/steampipe-plugin-sdk/v5/grpc/proto" "github.com/turbot/steampipe-plugin-sdk/v5/plugin/transform" diff --git a/azure/table_azure_lb_backend_address_pool.go b/azure/table_azure_lb_backend_address_pool.go index 30aa405c..19c9994b 100644 --- a/azure/table_azure_lb_backend_address_pool.go +++ b/azure/table_azure_lb_backend_address_pool.go @@ -4,7 +4,7 @@ import ( "context" "strings" - "github.com/Azure/azure-sdk-for-go/services/network/mgmt/2021-02-01/network" + "github.com/Azure/azure-sdk-for-go/profiles/latest/network/mgmt/network" "github.com/turbot/steampipe-plugin-sdk/v5/grpc/proto" "github.com/turbot/steampipe-plugin-sdk/v5/plugin/transform" diff --git a/azure/table_azure_lb_nat_rule.go b/azure/table_azure_lb_nat_rule.go index b144e63d..a94b8ff6 100644 --- a/azure/table_azure_lb_nat_rule.go +++ b/azure/table_azure_lb_nat_rule.go @@ -4,7 +4,7 @@ import ( "context" "strings" - "github.com/Azure/azure-sdk-for-go/services/network/mgmt/2021-02-01/network" + "github.com/Azure/azure-sdk-for-go/profiles/latest/network/mgmt/network" "github.com/turbot/steampipe-plugin-sdk/v5/grpc/proto" "github.com/turbot/steampipe-plugin-sdk/v5/plugin/transform" diff --git a/azure/table_azure_lb_outbound_rule.go b/azure/table_azure_lb_outbound_rule.go index 9e24b5d6..9f4f0635 100644 --- a/azure/table_azure_lb_outbound_rule.go +++ b/azure/table_azure_lb_outbound_rule.go @@ -4,7 +4,7 @@ import ( "context" "strings" - "github.com/Azure/azure-sdk-for-go/services/network/mgmt/2021-02-01/network" +"github.com/Azure/azure-sdk-for-go/profiles/latest/network/mgmt/network" "github.com/turbot/steampipe-plugin-sdk/v5/grpc/proto" "github.com/turbot/steampipe-plugin-sdk/v5/plugin/transform" diff --git a/azure/table_azure_lb_probe.go b/azure/table_azure_lb_probe.go index 3df9b17b..3a7ab18a 100644 --- a/azure/table_azure_lb_probe.go +++ b/azure/table_azure_lb_probe.go @@ -4,7 +4,7 @@ import ( "context" "strings" - "github.com/Azure/azure-sdk-for-go/services/network/mgmt/2021-02-01/network" +"github.com/Azure/azure-sdk-for-go/profiles/latest/network/mgmt/network" "github.com/turbot/steampipe-plugin-sdk/v5/grpc/proto" "github.com/turbot/steampipe-plugin-sdk/v5/plugin/transform" diff --git a/azure/table_azure_lb_rule.go b/azure/table_azure_lb_rule.go index 48648292..c112ef43 100644 --- a/azure/table_azure_lb_rule.go +++ b/azure/table_azure_lb_rule.go @@ -4,7 +4,7 @@ import ( "context" "strings" - "github.com/Azure/azure-sdk-for-go/services/network/mgmt/2021-02-01/network" +"github.com/Azure/azure-sdk-for-go/profiles/latest/network/mgmt/network" "github.com/turbot/steampipe-plugin-sdk/v5/grpc/proto" "github.com/turbot/steampipe-plugin-sdk/v5/plugin/transform" diff --git a/azure/table_azure_log_alert.go b/azure/table_azure_log_alert.go index 4713ce90..764c22f3 100644 --- a/azure/table_azure_log_alert.go +++ b/azure/table_azure_log_alert.go @@ -3,7 +3,7 @@ package azure import ( "context" - "github.com/Azure/azure-sdk-for-go/profiles/2020-09-01/monitor/mgmt/insights" + "github.com/Azure/azure-sdk-for-go/profiles/preview/preview/monitor/mgmt/insights" "github.com/turbot/steampipe-plugin-sdk/v5/grpc/proto" "github.com/turbot/steampipe-plugin-sdk/v5/plugin/transform" @@ -132,7 +132,7 @@ func listLogAlerts(ctx context.Context, d *plugin.QueryData, _ *plugin.HydrateDa return nil, err } - for _, alertLog := range *result.Value { + for _, alertLog := range result.Values() { d.StreamListItem(ctx, alertLog) // Check if context has been cancelled or if the limit has been hit (if specified) // if there is a limit, it will return the number of rows required to reach this limit diff --git a/azure/table_azure_log_profile.go b/azure/table_azure_log_profile.go index 7669b7b8..1033e1c2 100644 --- a/azure/table_azure_log_profile.go +++ b/azure/table_azure_log_profile.go @@ -3,7 +3,7 @@ package azure import ( "context" - "github.com/Azure/azure-sdk-for-go/profiles/2020-09-01/monitor/mgmt/insights" + "github.com/Azure/azure-sdk-for-go/profiles/preview/preview/monitor/mgmt/insights" "github.com/turbot/steampipe-plugin-sdk/v5/grpc/proto" "github.com/turbot/steampipe-plugin-sdk/v5/plugin/transform" diff --git a/azure/table_azure_logic_app_workflow.go b/azure/table_azure_logic_app_workflow.go index a343ea5c..8b8f1682 100644 --- a/azure/table_azure_logic_app_workflow.go +++ b/azure/table_azure_logic_app_workflow.go @@ -3,8 +3,8 @@ package azure import ( "context" - "github.com/Azure/azure-sdk-for-go/profiles/2020-09-01/monitor/mgmt/insights" - "github.com/Azure/azure-sdk-for-go/services/logic/mgmt/2019-05-01/logic" + "github.com/Azure/azure-sdk-for-go/profiles/latest/logic/mgmt/logic" + "github.com/Azure/azure-sdk-for-go/profiles/preview/preview/monitor/mgmt/insights" "github.com/turbot/steampipe-plugin-sdk/v5/grpc/proto" "github.com/turbot/steampipe-plugin-sdk/v5/plugin/transform" diff --git a/azure/table_azure_machine_learning_workspace.go b/azure/table_azure_machine_learning_workspace.go index 044039e8..9cacfaeb 100644 --- a/azure/table_azure_machine_learning_workspace.go +++ b/azure/table_azure_machine_learning_workspace.go @@ -3,8 +3,9 @@ package azure import ( "context" - "github.com/Azure/azure-sdk-for-go/profiles/2020-09-01/monitor/mgmt/insights" - "github.com/Azure/azure-sdk-for-go/services/preview/machinelearningservices/mgmt/2020-02-18-preview/machinelearningservices" + "github.com/Azure/azure-sdk-for-go/profiles/latest/machinelearningservices/mgmt/machinelearningservices" + "github.com/Azure/azure-sdk-for-go/profiles/preview/preview/monitor/mgmt/insights" + "github.com/turbot/steampipe-plugin-sdk/v5/grpc/proto" "github.com/turbot/steampipe-plugin-sdk/v5/plugin/transform" diff --git a/azure/table_azure_management_lock.go b/azure/table_azure_management_lock.go index 0f9f287a..ef1fda56 100644 --- a/azure/table_azure_management_lock.go +++ b/azure/table_azure_management_lock.go @@ -5,7 +5,7 @@ import ( "fmt" "strings" - "github.com/Azure/azure-sdk-for-go/services/resources/mgmt/2016-09-01/locks" + "github.com/Azure/azure-sdk-for-go/profiles/latest/resources/mgmt/locks" "github.com/turbot/steampipe-plugin-sdk/v5/grpc/proto" "github.com/turbot/steampipe-plugin-sdk/v5/plugin/transform" diff --git a/azure/table_azure_mariadb_server.go b/azure/table_azure_mariadb_server.go index 68607d70..e461614d 100644 --- a/azure/table_azure_mariadb_server.go +++ b/azure/table_azure_mariadb_server.go @@ -3,7 +3,8 @@ package azure import ( "context" - "github.com/Azure/azure-sdk-for-go/services/mariadb/mgmt/2020-01-01/mariadb" + "github.com/Azure/azure-sdk-for-go/profiles/latest/mariadb/mgmt/mariadb" + "github.com/turbot/steampipe-plugin-sdk/v5/grpc/proto" "github.com/turbot/steampipe-plugin-sdk/v5/plugin" "github.com/turbot/steampipe-plugin-sdk/v5/plugin/transform" diff --git a/azure/table_azure_monitor_activity_log_event.go b/azure/table_azure_monitor_activity_log_event.go index d09f3c12..0e52e775 100644 --- a/azure/table_azure_monitor_activity_log_event.go +++ b/azure/table_azure_monitor_activity_log_event.go @@ -8,7 +8,7 @@ import ( "github.com/turbot/steampipe-plugin-sdk/v5/plugin" "github.com/turbot/steampipe-plugin-sdk/v5/plugin/transform" - "github.com/Azure/azure-sdk-for-go/profiles/2020-09-01/monitor/mgmt/insights" + "github.com/Azure/azure-sdk-for-go/profiles/preview/preview/monitor/mgmt/insights" ) //// TABLE DEFINITION diff --git a/azure/table_azure_monitor_log_profile.go b/azure/table_azure_monitor_log_profile.go index 9171bb0f..f9a68637 100644 --- a/azure/table_azure_monitor_log_profile.go +++ b/azure/table_azure_monitor_log_profile.go @@ -7,7 +7,7 @@ import ( "github.com/turbot/steampipe-plugin-sdk/v5/plugin" "github.com/turbot/steampipe-plugin-sdk/v5/plugin/transform" - "github.com/Azure/azure-sdk-for-go/profiles/2020-09-01/monitor/mgmt/insights" + "github.com/Azure/azure-sdk-for-go/profiles/preview/preview/monitor/mgmt/insights" ) //// TABLE DEFINITION diff --git a/azure/table_azure_mssql_elasticpool.go b/azure/table_azure_mssql_elasticpool.go index d79c9c33..ef2c237d 100644 --- a/azure/table_azure_mssql_elasticpool.go +++ b/azure/table_azure_mssql_elasticpool.go @@ -4,12 +4,12 @@ import ( "context" "strings" + "github.com/Azure/azure-sdk-for-go/profiles/latest/sql/mgmt/sql" + "github.com/turbot/steampipe-plugin-sdk/v5/grpc/proto" "github.com/turbot/steampipe-plugin-sdk/v5/plugin" "github.com/turbot/steampipe-plugin-sdk/v5/plugin/transform" - - "github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2017-03-01-preview/sql" - sqlv3 "github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/v3.0/sql" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/sql/armsql" ) //// TABLE DEFINITION @@ -153,7 +153,7 @@ func listMSSQLElasticPools(ctx context.Context, d *plugin.QueryData, h *plugin.H client := sql.NewElasticPoolsClientWithBaseURI(session.ResourceManagerEndpoint, subscriptionID) client.Authorizer = session.Authorizer - server := h.Item.(sqlv3.Server) + server := h.Item.(armsql.Server) serverName := *server.Name resourceGroup := strings.Split(*server.ID, "/")[4] diff --git a/azure/table_azure_mssql_managed_instance.go b/azure/table_azure_mssql_managed_instance.go index c83a9f2c..d328ced3 100644 --- a/azure/table_azure_mssql_managed_instance.go +++ b/azure/table_azure_mssql_managed_instance.go @@ -8,7 +8,7 @@ import ( "github.com/turbot/steampipe-plugin-sdk/v5/plugin" "github.com/turbot/steampipe-plugin-sdk/v5/plugin/transform" - "github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/v5.0/sql" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/sql/armsql" ) //// TABLE DEFINITION @@ -48,121 +48,121 @@ func tableAzureMSSQLManagedInstance(_ context.Context) *plugin.Table { Name: "state", Description: "The state of the managed instance.", Type: proto.ColumnType_STRING, - Transform: transform.FromField("ManagedInstanceProperties.State"), + Transform: transform.FromField("Properties.State"), }, { Name: "administrator_login", Description: "Administrator username for the managed instance.", Type: proto.ColumnType_STRING, - Transform: transform.FromField("ManagedInstanceProperties.AdministratorLogin"), + Transform: transform.FromField("Properties.AdministratorLogin"), }, { Name: "administrator_login_password", Description: "Administrator password for the managed instance.", Type: proto.ColumnType_STRING, - Transform: transform.FromField("ManagedInstanceProperties.AdministratorLoginPassword"), + Transform: transform.FromField("Properties.AdministratorLoginPassword"), }, { Name: "collation", Description: "Collation of the managed instance.", Type: proto.ColumnType_STRING, - Transform: transform.FromField("ManagedInstanceProperties.Collation"), + Transform: transform.FromField("Properties.Collation"), }, { Name: "dns_zone", Description: "The Dns zone that the managed instance is in.", Type: proto.ColumnType_STRING, - Transform: transform.FromField("ManagedInstanceProperties.DNSZone"), + Transform: transform.FromField("Properties.DNSZone"), }, { Name: "dns_zone_partner", Description: "The resource id of another managed instance whose DNS zone this managed instance will share after creation.", Type: proto.ColumnType_STRING, - Transform: transform.FromField("ManagedInstanceProperties.DNSZonePartner"), + Transform: transform.FromField("Properties.DNSZonePartner"), }, { Name: "fully_qualified_domain_name", Description: "The fully qualified domain name of the managed instance.", Type: proto.ColumnType_STRING, - Transform: transform.FromField("ManagedInstanceProperties.FullyQualifiedDomainName"), + Transform: transform.FromField("Properties.FullyQualifiedDomainName"), }, { Name: "instance_pool_id", Description: "The Id of the instance pool this managed server belongs to.", Type: proto.ColumnType_STRING, - Transform: transform.FromField("ManagedInstanceProperties.InstancePoolID"), + Transform: transform.FromField("Properties.InstancePoolID"), }, { Name: "license_type", Description: "The license type of the managed instance.", Type: proto.ColumnType_STRING, - Transform: transform.FromField("ManagedInstanceProperties.LicenseType"), + Transform: transform.FromField("Properties.LicenseType"), }, { Name: "maintenance_configuration_id", Description: "Specifies maintenance configuration id to apply to this managed instance.", Type: proto.ColumnType_STRING, - Transform: transform.FromField("ManagedInstanceProperties.MaintenanceConfigurationID"), + Transform: transform.FromField("Properties.MaintenanceConfigurationID"), }, { Name: "managed_instance_create_mode", Description: "Specifies the mode of database creation.", Type: proto.ColumnType_STRING, - Transform: transform.FromField("ManagedInstanceProperties.ManagedInstanceCreateMode"), + Transform: transform.FromField("Properties.ManagedInstanceCreateMode"), }, { Name: "minimal_tls_version", Description: "Minimal TLS version of the managed instance.", Type: proto.ColumnType_STRING, - Transform: transform.FromField("ManagedInstanceProperties.MinimalTLSVersion"), + Transform: transform.FromField("Properties.MinimalTLSVersion"), }, { Name: "proxy_override", Description: "Connection type used for connecting to the instance.", Type: proto.ColumnType_STRING, - Transform: transform.FromField("ManagedInstanceProperties.ProxyOverride"), + Transform: transform.FromField("Properties.ProxyOverride"), }, { Name: "public_data_endpoint_enabled", Description: "Whether or not the public data endpoint is enabled.", Type: proto.ColumnType_BOOL, - Transform: transform.FromField("ManagedInstanceProperties.PublicDataEndpointEnabled"), + Transform: transform.FromField("Properties.PublicDataEndpointEnabled"), }, { Name: "restore_point_in_time", Description: "Specifies the point in time of the source database that will be restored to create the new database.", Type: proto.ColumnType_TIMESTAMP, - Transform: transform.FromField("ManagedInstanceProperties.RestorePointInTime").Transform(convertDateToTime), + Transform: transform.FromField("Properties.RestorePointInTime"), }, { Name: "source_managed_instance_id", Description: "The resource identifier of the source managed instance associated with create operation of this instance.", Type: proto.ColumnType_STRING, - Transform: transform.FromField("ManagedInstanceProperties.SourceManagedInstanceID"), + Transform: transform.FromField("Properties.SourceManagedInstanceID"), }, { Name: "storage_size_in_gb", Description: "The managed instance storage size in GB.", Type: proto.ColumnType_INT, - Transform: transform.FromField("ManagedInstanceProperties.StorageSizeInGB"), + Transform: transform.FromField("Properties.StorageSizeInGB"), }, { Name: "subnet_id", Description: "Subnet resource ID for the managed instance.", Type: proto.ColumnType_STRING, - Transform: transform.FromField("ManagedInstanceProperties.SubnetID"), + Transform: transform.FromField("Properties.SubnetID"), }, { Name: "timezone_id", Description: "Id of the timezone.", Type: proto.ColumnType_STRING, - Transform: transform.FromField("ManagedInstanceProperties.TimezoneID"), + Transform: transform.FromField("Properties.TimezoneID"), }, { Name: "v_cores", Description: "The number of vcores of the managed instance.", Type: proto.ColumnType_INT, - Transform: transform.FromField("ManagedInstanceProperties.VCores"), + Transform: transform.FromField("Properties.VCores"), }, { Name: "encryption_protectors", @@ -235,36 +235,27 @@ func tableAzureMSSQLManagedInstance(_ context.Context) *plugin.Table { //// LIST FUNCTION func listMSSQLManagedInstances(ctx context.Context, d *plugin.QueryData, _ *plugin.HydrateData) (interface{}, error) { - session, err := GetNewSession(ctx, d, "MANAGEMENT") + session, err := GetNewSessionUpdated(ctx, d) if err != nil { + plugin.Logger(ctx).Error("azure_mssql_managed_instance.listMSSQLManagedInstances", "session_error", err) return nil, err } - subscriptionID := session.SubscriptionID - client := sql.NewManagedInstancesClientWithBaseURI(session.ResourceManagerEndpoint, subscriptionID) - client.Authorizer = session.Authorizer - result, err := client.List(ctx, "") + client, err := armsql.NewManagedInstancesClient(session.SubscriptionID, session.Cred, session.ClientOptions) if err != nil { - plugin.Logger(ctx).Error("listMSSQLManagedInstances", "list", err) + plugin.Logger(ctx).Error("azure_mssql_managed_instance.listMSSQLManagedInstances", "client_error", err) return nil, err } - for _, managedInstance := range result.Values() { - d.StreamListItem(ctx, managedInstance) - // Check if context has been cancelled or if the limit has been hit (if specified) - // if there is a limit, it will return the number of rows required to reach this limit - if d.RowsRemaining(ctx) == 0 { - return nil, nil - } - } - for result.NotDone() { - err = result.NextWithContext(ctx) + pager := client.NewListPager(nil) + for pager.More() { + result, err := pager.NextPage(ctx) if err != nil { - plugin.Logger(ctx).Error("listMSSQLManagedInstances", "list_paging", err) + plugin.Logger(ctx).Error("azure_mssql_managed_instance.listMSSQLManagedInstances", "api_error", err) return nil, err } - for _, managedInstance := range result.Values() { - d.StreamListItem(ctx, managedInstance) + for _, managedInstance := range result.Value { + d.StreamListItem(ctx, *managedInstance) // Check if context has been cancelled or if the limit has been hit (if specified) // if there is a limit, it will return the number of rows required to reach this limit if d.RowsRemaining(ctx) == 0 { @@ -272,6 +263,7 @@ func listMSSQLManagedInstances(ctx context.Context, d *plugin.QueryData, _ *plug } } } + return nil, err } @@ -280,33 +272,35 @@ func listMSSQLManagedInstances(ctx context.Context, d *plugin.QueryData, _ *plug func getMSSQLManagedInstance(ctx context.Context, d *plugin.QueryData, h *plugin.HydrateData) (interface{}, error) { plugin.Logger(ctx).Trace("getMSSQLManagedInstance") - name := d.EqualsQuals["name"].GetStringValue() - resourceGroup := d.EqualsQuals["resource_group"].GetStringValue() + name := d.EqualsQualString("name") + resourceGroup := d.EqualsQualString("resource_group") // Return nil, of no input provided if name == "" || resourceGroup == "" { return nil, nil } - session, err := GetNewSession(ctx, d, "MANAGEMENT") + session, err := GetNewSessionUpdated(ctx, d) if err != nil { + plugin.Logger(ctx).Error("azure_mssql_managed_instance.getMSSQLManagedInstance", "session_error", err) + return nil, err + } + client, err := armsql.NewManagedInstancesClient(session.SubscriptionID, session.Cred, session.ClientOptions) + if err != nil { + plugin.Logger(ctx).Error("azure_mssql_managed_instance.getMSSQLManagedInstance", "client_error", err) return nil, err } - subscriptionID := session.SubscriptionID - - client := sql.NewManagedInstancesClientWithBaseURI(session.ResourceManagerEndpoint, subscriptionID) - client.Authorizer = session.Authorizer - op, err := client.Get(ctx, resourceGroup, name, "") + op, err := client.Get(ctx, resourceGroup, name, nil) if err != nil { - plugin.Logger(ctx).Error("getMSSQLManagedInstance", "get", err) + plugin.Logger(ctx).Error("azure_mssql_managed_instance.getMSSQLManagedInstance", "api_error", err) return nil, err } // In some cases resource does not give any notFound error // instead of notFound error, it returns empty data if op.ID != nil { - return op, nil + return op.ManagedInstance, nil } return nil, nil @@ -315,40 +309,30 @@ func getMSSQLManagedInstance(ctx context.Context, d *plugin.QueryData, h *plugin func listMSSQLManagedInstanceEncryptionProtectors(ctx context.Context, d *plugin.QueryData, h *plugin.HydrateData) (interface{}, error) { plugin.Logger(ctx).Trace("listMSSQLManagedInstanceEncryptionProtectors") - managedInstance := h.Item.(sql.ManagedInstance) + managedInstance := h.Item.(armsql.ManagedInstance) resourceGroup := strings.Split(string(*managedInstance.ID), "/")[4] managedInstanceName := *managedInstance.Name - session, err := GetNewSession(ctx, d, "MANAGEMENT") + session, err := GetNewSessionUpdated(ctx, d) if err != nil { + plugin.Logger(ctx).Error("azure_mssql_managed_instance.listMSSQLManagedInstanceEncryptionProtectors", "session_error", err) return nil, err } - subscriptionID := session.SubscriptionID - - client := sql.NewManagedInstanceEncryptionProtectorsClientWithBaseURI(session.ResourceManagerEndpoint, subscriptionID) - client.Authorizer = session.Authorizer - - op, err := client.ListByInstance(ctx, resourceGroup, managedInstanceName) + client, err := armsql.NewManagedInstanceEncryptionProtectorsClient(session.SubscriptionID, session.Cred, session.ClientOptions) if err != nil { - plugin.Logger(ctx).Error("listMSSQLManagedInstanceEncryptionProtectors", "list", err) + plugin.Logger(ctx).Error("azure_mssql_managed_instance.listMSSQLManagedInstanceEncryptionProtectors", "client_error", err) return nil, err } - var managedInstanceEncryptionProtectors []map[string]interface{} - - for _, i := range op.Values() { - managedInstanceEncryptionProtectors = append(managedInstanceEncryptionProtectors, extractMSSQLManagedInstanceEncryptionProtector(i)) - } - - for op.NotDone() { - err = op.NextWithContext(ctx) + pager := client.NewListByInstancePager(resourceGroup, managedInstanceName, nil) + var managedInstanceEncryptionProtectors []*armsql.ManagedInstanceEncryptionProtector + for pager.More() { + result, err := pager.NextPage(ctx) if err != nil { - plugin.Logger(ctx).Error("listMSSQLManagedInstanceEncryptionProtectors", "list_paging", err) + plugin.Logger(ctx).Error("azure_mssql_managed_instance.listMSSQLManagedInstanceEncryptionProtectors", "api_error", err) return nil, err } - for _, i := range op.Values() { - managedInstanceEncryptionProtectors = append(managedInstanceEncryptionProtectors, extractMSSQLManagedInstanceEncryptionProtector(i)) - } + managedInstanceEncryptionProtectors = append(managedInstanceEncryptionProtectors, result.Value...) } return managedInstanceEncryptionProtectors, nil @@ -357,40 +341,30 @@ func listMSSQLManagedInstanceEncryptionProtectors(ctx context.Context, d *plugin func listMSSQLManagedInstanceVulnerabilityAssessments(ctx context.Context, d *plugin.QueryData, h *plugin.HydrateData) (interface{}, error) { plugin.Logger(ctx).Trace("listMSSQLManagedInstanceVulnerabilityAssessments") - managedInstance := h.Item.(sql.ManagedInstance) + managedInstance := h.Item.(armsql.ManagedInstance) resourceGroup := strings.Split(string(*managedInstance.ID), "/")[4] managedInstanceName := *managedInstance.Name - session, err := GetNewSession(ctx, d, "MANAGEMENT") + session, err := GetNewSessionUpdated(ctx, d) if err != nil { + plugin.Logger(ctx).Error("azure_mssql_managed_instance.listMSSQLManagedInstanceVulnerabilityAssessments", "session_error", err) return nil, err } - subscriptionID := session.SubscriptionID - - client := sql.NewManagedInstanceVulnerabilityAssessmentsClientWithBaseURI(session.ResourceManagerEndpoint, subscriptionID) - client.Authorizer = session.Authorizer - - op, err := client.ListByInstance(ctx, resourceGroup, managedInstanceName) + client, err := armsql.NewManagedInstanceVulnerabilityAssessmentsClient(session.SubscriptionID, session.Cred, session.ClientOptions) if err != nil { - plugin.Logger(ctx).Error("listMSSQLManagedInstanceVulnerabilityAssessments", "list", err) + plugin.Logger(ctx).Error("azure_mssql_managed_instance.listMSSQLManagedInstanceVulnerabilityAssessments", "client_error", err) return nil, err } - var managedInstanceVulnerabilityAssessments []map[string]interface{} - - for _, i := range op.Values() { - managedInstanceVulnerabilityAssessments = append(managedInstanceVulnerabilityAssessments, extractMSSQLManagedInstanceVulnerabilityAssessment(i)) - } - - for op.NotDone() { - err = op.NextWithContext(ctx) + pager := client.NewListByInstancePager(resourceGroup, managedInstanceName, nil) + var managedInstanceVulnerabilityAssessments []*armsql.ManagedInstanceVulnerabilityAssessment + for pager.More() { + result, err := pager.NextPage(ctx) if err != nil { - plugin.Logger(ctx).Error("listMSSQLManagedInstanceVulnerabilityAssessments", "list_paging", err) + plugin.Logger(ctx).Error("azure_mssql_managed_instance.listMSSQLManagedInstanceVulnerabilityAssessments", "api_error", err) return nil, err } - for _, i := range op.Values() { - managedInstanceVulnerabilityAssessments = append(managedInstanceVulnerabilityAssessments, extractMSSQLManagedInstanceVulnerabilityAssessment(i)) - } + managedInstanceVulnerabilityAssessments = append(managedInstanceVulnerabilityAssessments, result.Value...) } return managedInstanceVulnerabilityAssessments, nil @@ -399,148 +373,31 @@ func listMSSQLManagedInstanceVulnerabilityAssessments(ctx context.Context, d *pl func listMSSQLManagedInstanceSecurityAlertPolicies(ctx context.Context, d *plugin.QueryData, h *plugin.HydrateData) (interface{}, error) { plugin.Logger(ctx).Trace("listMSSQLManagedInstanceSecurityAlertPolicies") - managedInstance := h.Item.(sql.ManagedInstance) + managedInstance := h.Item.(armsql.ManagedInstance) resourceGroup := strings.Split(string(*managedInstance.ID), "/")[4] managedInstanceName := *managedInstance.Name - session, err := GetNewSession(ctx, d, "MANAGEMENT") + session, err := GetNewSessionUpdated(ctx, d) if err != nil { + plugin.Logger(ctx).Error("azure_mssql_managed_instance.listMSSQLManagedInstanceSecurityAlertPolicies", "session_error", err) return nil, err } - subscriptionID := session.SubscriptionID - - client := sql.NewManagedServerSecurityAlertPoliciesClientWithBaseURI(session.ResourceManagerEndpoint, subscriptionID) - client.Authorizer = session.Authorizer - - op, err := client.ListByInstance(ctx, resourceGroup, managedInstanceName) + client, err := armsql.NewManagedServerSecurityAlertPoliciesClient(session.SubscriptionID, session.Cred, session.ClientOptions) if err != nil { - plugin.Logger(ctx).Error("listMSSQLManagedInstanceSecurityAlertPolicies", "list", err) + plugin.Logger(ctx).Error("azure_mssql_managed_instance.listMSSQLManagedInstanceSecurityAlertPolicies", "client_error", err) return nil, err } - var managedInstanceSecurityAlertPolicies []map[string]interface{} - - for _, i := range op.Values() { - managedInstanceSecurityAlertPolicies = append(managedInstanceSecurityAlertPolicies, extractMSSQLManagedInstanceSecurityAlertPolicy(i)) - } - - for op.NotDone() { - err = op.NextWithContext(ctx) + pager := client.NewListByInstancePager(resourceGroup, managedInstanceName, nil) + var managedInstanceSecurityAlertPolicies []*armsql.ManagedServerSecurityAlertPolicy + for pager.More() { + result, err := pager.NextPage(ctx) if err != nil { - plugin.Logger(ctx).Error("listMSSQLManagedInstanceSecurityAlertPolicies", "list_paging", err) + plugin.Logger(ctx).Error("azure_mssql_managed_instance.listMSSQLManagedInstanceSecurityAlertPolicies", "api_error", err) return nil, err } - for _, i := range op.Values() { - managedInstanceSecurityAlertPolicies = append(managedInstanceSecurityAlertPolicies, extractMSSQLManagedInstanceSecurityAlertPolicy(i)) - } + managedInstanceSecurityAlertPolicies = append(managedInstanceSecurityAlertPolicies, result.Value...) } return managedInstanceSecurityAlertPolicies, nil } - -// If we return the API response directly, the output will not provide -// all the properties of SecurityAlertPolicies -func extractMSSQLManagedInstanceSecurityAlertPolicy(i sql.ManagedServerSecurityAlertPolicy) map[string]interface{} { - managedInstanceSecurityAlertPolicy := make(map[string]interface{}) - if i.ID != nil { - managedInstanceSecurityAlertPolicy["id"] = *i.ID - } - if i.Name != nil { - managedInstanceSecurityAlertPolicy["name"] = *i.Name - } - if i.Type != nil { - managedInstanceSecurityAlertPolicy["type"] = *i.Type - } - if i.SystemData != nil { - managedInstanceSecurityAlertPolicy["systemData"] = i.SystemData - } - if i.SecurityAlertsPolicyProperties != nil { - if len(i.SecurityAlertsPolicyProperties.State) > 0 { - managedInstanceSecurityAlertPolicy["state"] = i.SecurityAlertsPolicyProperties.State - } - if i.SecurityAlertsPolicyProperties.DisabledAlerts != nil { - managedInstanceSecurityAlertPolicy["disabledAlerts"] = i.SecurityAlertsPolicyProperties.DisabledAlerts - } - if i.SecurityAlertsPolicyProperties.EmailAddresses != nil { - managedInstanceSecurityAlertPolicy["emailAddresses"] = i.SecurityAlertsPolicyProperties.EmailAddresses - } - if i.SecurityAlertsPolicyProperties.EmailAccountAdmins != nil { - managedInstanceSecurityAlertPolicy["emailAccountAdmins"] = i.SecurityAlertsPolicyProperties.EmailAccountAdmins - } - if i.SecurityAlertsPolicyProperties.StorageEndpoint != nil { - managedInstanceSecurityAlertPolicy["storageEndpoint"] = i.SecurityAlertsPolicyProperties.StorageEndpoint - } - if i.SecurityAlertsPolicyProperties.StorageAccountAccessKey != nil { - managedInstanceSecurityAlertPolicy["storageAccountAccessKey"] = i.SecurityAlertsPolicyProperties.StorageAccountAccessKey - } - if i.SecurityAlertsPolicyProperties.RetentionDays != nil { - managedInstanceSecurityAlertPolicy["retentionDays"] = i.SecurityAlertsPolicyProperties.RetentionDays - } - if i.SecurityAlertsPolicyProperties.CreationTime != nil { - managedInstanceSecurityAlertPolicy["creationTime"] = i.SecurityAlertsPolicyProperties.CreationTime - } - } - return managedInstanceSecurityAlertPolicy -} - -// If we return the API response directly, the output will not provide -// all the properties of ManagedInstanceVulnerabilityAssessment -func extractMSSQLManagedInstanceVulnerabilityAssessment(i sql.ManagedInstanceVulnerabilityAssessment) map[string]interface{} { - managedInstanceVulnerabilityAssessment := make(map[string]interface{}) - if i.ID != nil { - managedInstanceVulnerabilityAssessment["id"] = *i.ID - } - if i.Name != nil { - managedInstanceVulnerabilityAssessment["name"] = *i.Name - } - if i.Type != nil { - managedInstanceVulnerabilityAssessment["type"] = *i.Type - } - if i.ManagedInstanceVulnerabilityAssessmentProperties.RecurringScans != nil { - managedInstanceVulnerabilityAssessment["recurringScans"] = i.ManagedInstanceVulnerabilityAssessmentProperties.RecurringScans - } - if i.ManagedInstanceVulnerabilityAssessmentProperties.StorageAccountAccessKey != nil { - managedInstanceVulnerabilityAssessment["storageAccountAccessKey"] = *i.ManagedInstanceVulnerabilityAssessmentProperties.StorageAccountAccessKey - } - if i.ManagedInstanceVulnerabilityAssessmentProperties.StorageContainerPath != nil { - managedInstanceVulnerabilityAssessment["storageContainerPath"] = *i.ManagedInstanceVulnerabilityAssessmentProperties.StorageContainerPath - } - if i.ManagedInstanceVulnerabilityAssessmentProperties.StorageContainerSasKey != nil { - managedInstanceVulnerabilityAssessment["storageContainerSasKey"] = *i.ManagedInstanceVulnerabilityAssessmentProperties.StorageContainerSasKey - } - return managedInstanceVulnerabilityAssessment -} - -// If we return the API response directly, the output will not provide -// all the properties of ManagedInstanceEncryptionProtector -func extractMSSQLManagedInstanceEncryptionProtector(i sql.ManagedInstanceEncryptionProtector) map[string]interface{} { - managedInstanceEncryptionProtector := make(map[string]interface{}) - if i.ID != nil { - managedInstanceEncryptionProtector["id"] = *i.ID - } - if i.Name != nil { - managedInstanceEncryptionProtector["name"] = *i.Name - } - if i.Type != nil { - managedInstanceEncryptionProtector["type"] = *i.Type - } - if i.Kind != nil { - managedInstanceEncryptionProtector["kind"] = *i.Kind - } - if i.ManagedInstanceEncryptionProtectorProperties.AutoRotationEnabled != nil { - managedInstanceEncryptionProtector["autoRotationEnabled"] = i.ManagedInstanceEncryptionProtectorProperties.AutoRotationEnabled - } - if i.ManagedInstanceEncryptionProtectorProperties.ServerKeyName != nil { - managedInstanceEncryptionProtector["serverKeyName"] = i.ManagedInstanceEncryptionProtectorProperties.ServerKeyName - } - if len(i.ManagedInstanceEncryptionProtectorProperties.ServerKeyType) > 0 { - managedInstanceEncryptionProtector["serverKeyType"] = i.ManagedInstanceEncryptionProtectorProperties.ServerKeyType - } - if i.ManagedInstanceEncryptionProtectorProperties.Thumbprint != nil { - managedInstanceEncryptionProtector["thumbprint"] = i.ManagedInstanceEncryptionProtectorProperties.Thumbprint - } - if i.ManagedInstanceEncryptionProtectorProperties.URI != nil { - managedInstanceEncryptionProtector["uri"] = i.ManagedInstanceEncryptionProtectorProperties.URI - } - return managedInstanceEncryptionProtector -} diff --git a/azure/table_azure_mssql_virtual_machine.go b/azure/table_azure_mssql_virtual_machine.go index 884a8ae1..af5ee96e 100644 --- a/azure/table_azure_mssql_virtual_machine.go +++ b/azure/table_azure_mssql_virtual_machine.go @@ -3,11 +3,10 @@ package azure import ( "context" + "github.com/Azure/azure-sdk-for-go/profiles/preview/preview/sqlvirtualmachine/mgmt/sqlvirtualmachine" "github.com/turbot/steampipe-plugin-sdk/v5/grpc/proto" "github.com/turbot/steampipe-plugin-sdk/v5/plugin" "github.com/turbot/steampipe-plugin-sdk/v5/plugin/transform" - - "github.com/Azure/azure-sdk-for-go/services/preview/sqlvirtualmachine/mgmt/2017-03-01-preview/sqlvirtualmachine" ) //// TABLE DEFINITION diff --git a/azure/table_azure_mysql_flexible_server.go b/azure/table_azure_mysql_flexible_server.go index 48cca411..996d38f8 100644 --- a/azure/table_azure_mysql_flexible_server.go +++ b/azure/table_azure_mysql_flexible_server.go @@ -9,7 +9,7 @@ import ( "github.com/turbot/steampipe-plugin-sdk/v5/plugin/transform" "github.com/Azure/azure-sdk-for-go/profiles/latest/resources/mgmt/resources" - "github.com/Azure/azure-sdk-for-go/services/mysql/mgmt/2021-05-01/mysqlflexibleservers" + "github.com/Azure/azure-sdk-for-go/profiles/latest/mysql/mgmt/mysqlflexibleservers" ) //// TABLE DEFINITION diff --git a/azure/table_azure_mysql_server.go b/azure/table_azure_mysql_server.go index ea18f06b..9eace32c 100644 --- a/azure/table_azure_mysql_server.go +++ b/azure/table_azure_mysql_server.go @@ -8,7 +8,7 @@ import ( "github.com/turbot/steampipe-plugin-sdk/v5/plugin" "github.com/turbot/steampipe-plugin-sdk/v5/plugin/transform" - "github.com/Azure/azure-sdk-for-go/services/mysql/mgmt/2020-01-01/mysql" + "github.com/Azure/azure-sdk-for-go/profiles/latest/mysql/mgmt/mysql" ) //// TABLE DEFINITION @@ -450,7 +450,6 @@ func getMySQLServerSecurityAlertPolicy(ctx context.Context, d *plugin.QueryData, return nil, err } subscriptionID := session.SubscriptionID - client := mysql.NewServerSecurityAlertPoliciesClientWithBaseURI(session.ResourceManagerEndpoint, subscriptionID) client.Authorizer = session.Authorizer diff --git a/azure/table_azure_nat_gateway.go b/azure/table_azure_nat_gateway.go index 3d4dc9dd..a5c17173 100644 --- a/azure/table_azure_nat_gateway.go +++ b/azure/table_azure_nat_gateway.go @@ -3,7 +3,7 @@ package azure import ( "context" - "github.com/Azure/azure-sdk-for-go/services/network/mgmt/2021-03-01/network" + "github.com/Azure/azure-sdk-for-go/profiles/latest/network/mgmt/network" "github.com/turbot/steampipe-plugin-sdk/v5/grpc/proto" "github.com/turbot/steampipe-plugin-sdk/v5/plugin/transform" diff --git a/azure/table_azure_network_interface.go b/azure/table_azure_network_interface.go index 9391a939..d036e255 100644 --- a/azure/table_azure_network_interface.go +++ b/azure/table_azure_network_interface.go @@ -3,7 +3,7 @@ package azure import ( "context" - "github.com/Azure/azure-sdk-for-go/services/network/mgmt/2020-05-01/network" + "github.com/Azure/azure-sdk-for-go/profiles/latest/network/mgmt/network" "github.com/turbot/steampipe-plugin-sdk/v5/grpc/proto" "github.com/turbot/steampipe-plugin-sdk/v5/plugin/transform" diff --git a/azure/table_azure_network_security_group.go b/azure/table_azure_network_security_group.go index c4efa605..d2043d1f 100644 --- a/azure/table_azure_network_security_group.go +++ b/azure/table_azure_network_security_group.go @@ -3,8 +3,8 @@ package azure import ( "context" - "github.com/Azure/azure-sdk-for-go/profiles/2020-09-01/monitor/mgmt/insights" - "github.com/Azure/azure-sdk-for-go/services/network/mgmt/2020-05-01/network" + "github.com/Azure/azure-sdk-for-go/profiles/latest/network/mgmt/network" + "github.com/Azure/azure-sdk-for-go/profiles/preview/preview/monitor/mgmt/insights" "github.com/turbot/steampipe-plugin-sdk/v5/grpc/proto" "github.com/turbot/steampipe-plugin-sdk/v5/plugin/transform" diff --git a/azure/table_azure_network_watcher.go b/azure/table_azure_network_watcher.go index 85077a39..dd505002 100644 --- a/azure/table_azure_network_watcher.go +++ b/azure/table_azure_network_watcher.go @@ -3,7 +3,7 @@ package azure import ( "context" - "github.com/Azure/azure-sdk-for-go/services/network/mgmt/2020-05-01/network" + "github.com/Azure/azure-sdk-for-go/profiles/latest/network/mgmt/network" "github.com/turbot/steampipe-plugin-sdk/v5/grpc/proto" "github.com/turbot/steampipe-plugin-sdk/v5/plugin/transform" diff --git a/azure/table_azure_network_watcher_flow_log.go b/azure/table_azure_network_watcher_flow_log.go index ec7333a0..6972c82b 100644 --- a/azure/table_azure_network_watcher_flow_log.go +++ b/azure/table_azure_network_watcher_flow_log.go @@ -4,7 +4,7 @@ import ( "context" "strings" - "github.com/Azure/azure-sdk-for-go/services/network/mgmt/2020-05-01/network" + "github.com/Azure/azure-sdk-for-go/profiles/latest/network/mgmt/network" "github.com/turbot/steampipe-plugin-sdk/v5/grpc/proto" "github.com/turbot/steampipe-plugin-sdk/v5/plugin/transform" diff --git a/azure/table_azure_policy_definition.go b/azure/table_azure_policy_definition.go index 5cdbf776..8cfaf7e8 100644 --- a/azure/table_azure_policy_definition.go +++ b/azure/table_azure_policy_definition.go @@ -4,7 +4,7 @@ import ( "context" "strings" - "github.com/Azure/azure-sdk-for-go/services/resources/mgmt/2019-09-01/policy" + "github.com/Azure/azure-sdk-for-go/profiles/latest/resources/mgmt/policy" "github.com/turbot/steampipe-plugin-sdk/v5/grpc/proto" "github.com/turbot/steampipe-plugin-sdk/v5/plugin/transform" diff --git a/azure/table_azure_postgresql_flexible_server.go b/azure/table_azure_postgresql_flexible_server.go index 0375d7f8..42561e2f 100644 --- a/azure/table_azure_postgresql_flexible_server.go +++ b/azure/table_azure_postgresql_flexible_server.go @@ -10,7 +10,7 @@ import ( "github.com/turbot/steampipe-plugin-sdk/v5/plugin/transform" "github.com/Azure/azure-sdk-for-go/profiles/latest/resources/mgmt/resources" - "github.com/Azure/azure-sdk-for-go/services/postgresql/mgmt/2021-06-01/postgresqlflexibleservers" + "github.com/Azure/azure-sdk-for-go/profiles/latest/postgresql/mgmt/postgresqlflexibleservers" ) //// TABLE DEFINITION diff --git a/azure/table_azure_postgresql_server.go b/azure/table_azure_postgresql_server.go index 37df7427..f9769963 100644 --- a/azure/table_azure_postgresql_server.go +++ b/azure/table_azure_postgresql_server.go @@ -4,12 +4,11 @@ import ( "context" "strings" + "github.com/Azure/azure-sdk-for-go/profiles/latest/postgresql/mgmt/postgresql" + "github.com/Azure/go-autorest/autorest/date" "github.com/turbot/steampipe-plugin-sdk/v5/grpc/proto" "github.com/turbot/steampipe-plugin-sdk/v5/plugin" "github.com/turbot/steampipe-plugin-sdk/v5/plugin/transform" - - "github.com/Azure/azure-sdk-for-go/services/postgresql/mgmt/2020-01-01/postgresql" - "github.com/Azure/go-autorest/autorest/date" ) //// TABLE DEFINITION diff --git a/azure/table_azure_private_dns_zone.go b/azure/table_azure_private_dns_zone.go index 67eadaa4..d5aae8b6 100644 --- a/azure/table_azure_private_dns_zone.go +++ b/azure/table_azure_private_dns_zone.go @@ -3,8 +3,8 @@ package azure import ( "context" - "github.com/Azure/azure-sdk-for-go/services/dns/mgmt/2018-05-01/dns" - "github.com/Azure/azure-sdk-for-go/services/privatedns/mgmt/2018-09-01/privatedns" + "github.com/Azure/azure-sdk-for-go/profiles/latest/dns/mgmt/dns" + "github.com/Azure/azure-sdk-for-go/profiles/latest/privatedns/mgmt/privatedns" "github.com/turbot/steampipe-plugin-sdk/v5/grpc/proto" "github.com/turbot/steampipe-plugin-sdk/v5/plugin/transform" diff --git a/azure/table_azure_provider.go b/azure/table_azure_provider.go index ad0bfdbc..f9e8bba6 100644 --- a/azure/table_azure_provider.go +++ b/azure/table_azure_provider.go @@ -3,7 +3,7 @@ package azure import ( "context" - "github.com/Azure/azure-sdk-for-go/services/resources/mgmt/2018-05-01/resources" + "github.com/Azure/azure-sdk-for-go/profiles/latest/resources/mgmt/resources" "github.com/turbot/steampipe-plugin-sdk/v5/grpc/proto" "github.com/turbot/steampipe-plugin-sdk/v5/plugin/transform" @@ -77,7 +77,7 @@ func listProviders(ctx context.Context, d *plugin.QueryData, _ *plugin.HydrateDa resourcesClient := resources.NewProvidersClientWithBaseURI(session.ResourceManagerEndpoint, subscriptionID) resourcesClient.Authorizer = session.Authorizer - result, err := resourcesClient.List(ctx, nil, "") + result, err := resourcesClient.List(ctx, "") if err != nil { return nil, err } diff --git a/azure/table_azure_public_ip.go b/azure/table_azure_public_ip.go index 7036e3f1..e26dde58 100644 --- a/azure/table_azure_public_ip.go +++ b/azure/table_azure_public_ip.go @@ -3,8 +3,8 @@ package azure import ( "context" + "github.com/Azure/azure-sdk-for-go/profiles/latest/network/mgmt/network" "github.com/Azure/azure-sdk-for-go/profiles/latest/resources/mgmt/resources" - "github.com/Azure/azure-sdk-for-go/services/network/mgmt/2020-05-01/network" "github.com/turbot/steampipe-plugin-sdk/v5/grpc/proto" "github.com/turbot/steampipe-plugin-sdk/v5/plugin/transform" diff --git a/azure/table_azure_recovery_services_backup_job.go b/azure/table_azure_recovery_services_backup_job.go index 50daa48d..89573e26 100644 --- a/azure/table_azure_recovery_services_backup_job.go +++ b/azure/table_azure_recovery_services_backup_job.go @@ -5,7 +5,6 @@ import ( "strings" "github.com/Azure/azure-sdk-for-go/profiles/latest/recoveryservices/mgmt/recoveryservices" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/v3" "github.com/turbot/steampipe-plugin-sdk/v5/grpc/proto" "github.com/turbot/steampipe-plugin-sdk/v5/plugin" @@ -122,21 +121,13 @@ type JobInfo struct { //// LIST FUNCTION //// func listRecoveryServicesBackupJobs(ctx context.Context, d *plugin.QueryData, h *plugin.HydrateData) (interface{}, error) { - session, err := GetNewSession(ctx, d, "MANAGEMENT") + session, err := GetNewSessionUpdated(ctx, d) if err != nil { + plugin.Logger(ctx).Error("azure_recovery_services_backup_job.listRecoveryServicesBackupJobs", "session_error", err) return nil, err } - - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - plugin.Logger(ctx).Error("azure_backup_job.listAzureBackupJobs", "NewDefaultAzureCredential", err) - return nil, err - } - vault := h.Item.(recoveryservices.Vault) - plugin.Logger(ctx).Error("Parameter ====>>", vault.Name, strings.Split(*vault.ID, "/")[4]) - vaultName := d.EqualsQualString("vault_name") rgName := d.EqualsQualString("resource_group") @@ -152,8 +143,7 @@ func listRecoveryServicesBackupJobs(ctx context.Context, d *plugin.QueryData, h } } - subscriptionID := session.SubscriptionID - clientFactory, err := armrecoveryservicesbackup.NewBackupJobsClient(subscriptionID, cred, nil) + clientFactory, err := armrecoveryservicesbackup.NewBackupJobsClient(session.SubscriptionID, session.Cred, session.ClientOptions) if err != nil { plugin.Logger(ctx).Error("azure_recovery_services_backup_job.listRecoveryServicesBackupJobs", "client_error", err) return nil, nil diff --git a/azure/table_azure_recovery_services_vault.go b/azure/table_azure_recovery_services_vault.go index 76651894..770a6b4c 100644 --- a/azure/table_azure_recovery_services_vault.go +++ b/azure/table_azure_recovery_services_vault.go @@ -3,8 +3,8 @@ package azure import ( "context" - "github.com/Azure/azure-sdk-for-go/profiles/2020-09-01/monitor/mgmt/insights" "github.com/Azure/azure-sdk-for-go/profiles/latest/recoveryservices/mgmt/recoveryservices" + "github.com/Azure/azure-sdk-for-go/profiles/preview/preview/monitor/mgmt/insights" "github.com/turbot/steampipe-plugin-sdk/v5/grpc/proto" "github.com/turbot/steampipe-plugin-sdk/v5/plugin/transform" diff --git a/azure/table_azure_redis_cache.go b/azure/table_azure_redis_cache.go index 16fd1ad6..1379d69e 100644 --- a/azure/table_azure_redis_cache.go +++ b/azure/table_azure_redis_cache.go @@ -3,7 +3,8 @@ package azure import ( "context" - "github.com/Azure/azure-sdk-for-go/services/redis/mgmt/2020-06-01/redis" + "github.com/Azure/azure-sdk-for-go/profiles/latest/redis/mgmt/redis" + "github.com/turbot/steampipe-plugin-sdk/v5/grpc/proto" "github.com/turbot/steampipe-plugin-sdk/v5/plugin" "github.com/turbot/steampipe-plugin-sdk/v5/plugin/transform" diff --git a/azure/table_azure_role_assignment.go b/azure/table_azure_role_assignment.go index a1fd4c5b..fea70dd3 100644 --- a/azure/table_azure_role_assignment.go +++ b/azure/table_azure_role_assignment.go @@ -4,7 +4,8 @@ import ( "context" "fmt" - "github.com/Azure/azure-sdk-for-go/services/preview/authorization/mgmt/2018-09-01-preview/authorization" + "github.com/Azure/azure-sdk-for-go/profiles/latest/authorization/mgmt/authorization" + "github.com/turbot/steampipe-plugin-sdk/v5/grpc/proto" "github.com/turbot/steampipe-plugin-sdk/v5/plugin/transform" diff --git a/azure/table_azure_role_definition.go b/azure/table_azure_role_definition.go index fc2f0f5a..5a3201f6 100644 --- a/azure/table_azure_role_definition.go +++ b/azure/table_azure_role_definition.go @@ -3,7 +3,7 @@ package azure import ( "context" - "github.com/Azure/azure-sdk-for-go/services/preview/authorization/mgmt/2018-09-01-preview/authorization" + "github.com/Azure/azure-sdk-for-go/profiles/latest/authorization/mgmt/authorization" "github.com/turbot/steampipe-plugin-sdk/v5/grpc/proto" "github.com/turbot/steampipe-plugin-sdk/v5/plugin/transform" diff --git a/azure/table_azure_route_table.go b/azure/table_azure_route_table.go index d351c053..2c9b8da9 100644 --- a/azure/table_azure_route_table.go +++ b/azure/table_azure_route_table.go @@ -3,7 +3,8 @@ package azure import ( "context" - "github.com/Azure/azure-sdk-for-go/services/network/mgmt/2020-05-01/network" + "github.com/Azure/azure-sdk-for-go/profiles/latest/network/mgmt/network" + "github.com/turbot/steampipe-plugin-sdk/v5/grpc/proto" "github.com/turbot/steampipe-plugin-sdk/v5/plugin/transform" diff --git a/azure/table_azure_search_service.go b/azure/table_azure_search_service.go index a750c9f7..3a1332ea 100644 --- a/azure/table_azure_search_service.go +++ b/azure/table_azure_search_service.go @@ -3,8 +3,8 @@ package azure import ( "context" - "github.com/Azure/azure-sdk-for-go/profiles/2020-09-01/monitor/mgmt/insights" - "github.com/Azure/azure-sdk-for-go/services/search/mgmt/2020-08-01/search" + "github.com/Azure/azure-sdk-for-go/profiles/latest/search/mgmt/search" + "github.com/Azure/azure-sdk-for-go/profiles/preview/preview/monitor/mgmt/insights" "github.com/turbot/steampipe-plugin-sdk/v5/grpc/proto" "github.com/turbot/steampipe-plugin-sdk/v5/plugin" "github.com/turbot/steampipe-plugin-sdk/v5/plugin/transform" diff --git a/azure/table_azure_security_center_auto_provisioning.go b/azure/table_azure_security_center_auto_provisioning.go index 56e0a0af..3d6b1409 100644 --- a/azure/table_azure_security_center_auto_provisioning.go +++ b/azure/table_azure_security_center_auto_provisioning.go @@ -3,7 +3,7 @@ package azure import ( "context" - "github.com/Azure/azure-sdk-for-go/services/preview/security/mgmt/v1.0/security" + "github.com/Azure/azure-sdk-for-go/profiles/preview/preview/security/mgmt/security" "github.com/turbot/steampipe-plugin-sdk/v5/grpc/proto" "github.com/turbot/steampipe-plugin-sdk/v5/plugin/transform" @@ -73,7 +73,7 @@ func listSecurityCenterAutoProvisioning(ctx context.Context, d *plugin.QueryData } subscriptionID := session.SubscriptionID - autoProvisioningClient := security.NewAutoProvisioningSettingsClientWithBaseURI(session.ResourceManagerEndpoint, subscriptionID, "") + autoProvisioningClient := security.NewAutoProvisioningSettingsClientWithBaseURI(session.ResourceManagerEndpoint, subscriptionID) autoProvisioningClient.Authorizer = session.Authorizer result, err := autoProvisioningClient.List(ctx) @@ -118,7 +118,7 @@ func getSecurityCenterAutoProvisioning(ctx context.Context, d *plugin.QueryData, name := d.EqualsQuals["name"].GetStringValue() subscriptionID := session.SubscriptionID - autoProvisioningClient := security.NewAutoProvisioningSettingsClientWithBaseURI(session.ResourceManagerEndpoint, subscriptionID, "") + autoProvisioningClient := security.NewAutoProvisioningSettingsClientWithBaseURI(session.ResourceManagerEndpoint, subscriptionID) autoProvisioningClient.Authorizer = session.Authorizer autoProvisioning, err := autoProvisioningClient.Get(ctx, name) diff --git a/azure/table_azure_security_center_automation.go b/azure/table_azure_security_center_automation.go index b0ac164b..15f8348e 100644 --- a/azure/table_azure_security_center_automation.go +++ b/azure/table_azure_security_center_automation.go @@ -3,7 +3,7 @@ package azure import ( "context" - "github.com/Azure/azure-sdk-for-go/services/preview/security/mgmt/v3.0/security" + "github.com/Azure/azure-sdk-for-go/profiles/preview/preview/security/mgmt/security" "github.com/turbot/steampipe-plugin-sdk/v5/grpc/proto" "github.com/turbot/steampipe-plugin-sdk/v5/plugin/transform" @@ -126,7 +126,7 @@ func listSecurityCenterAutomations(ctx context.Context, d *plugin.QueryData, _ * } subscriptionID := session.SubscriptionID - automationClient := security.NewAutomationsClientWithBaseURI(session.ResourceManagerEndpoint, subscriptionID, "") + automationClient := security.NewAutomationsClientWithBaseURI(session.ResourceManagerEndpoint, subscriptionID) automationClient.Authorizer = session.Authorizer result, err := automationClient.List(ctx) @@ -173,7 +173,7 @@ func getSecurityCenterAutomation(ctx context.Context, d *plugin.QueryData, _ *pl name := d.EqualsQuals["name"].GetStringValue() subscriptionID := session.SubscriptionID - automationClient := security.NewAutomationsClientWithBaseURI(session.ResourceManagerEndpoint, subscriptionID, "") + automationClient := security.NewAutomationsClientWithBaseURI(session.ResourceManagerEndpoint, subscriptionID) automationClient.Authorizer = session.Authorizer automation, err := automationClient.Get(ctx, resourceGroup, name) diff --git a/azure/table_azure_security_center_contact.go b/azure/table_azure_security_center_contact.go index 91a0f296..c3f95c82 100644 --- a/azure/table_azure_security_center_contact.go +++ b/azure/table_azure_security_center_contact.go @@ -3,7 +3,7 @@ package azure import ( "context" - "github.com/Azure/azure-sdk-for-go/services/preview/security/mgmt/v1.0/security" + "github.com/Azure/azure-sdk-for-go/profiles/preview/preview/security/mgmt/security" "github.com/turbot/steampipe-plugin-sdk/v5/grpc/proto" "github.com/turbot/steampipe-plugin-sdk/v5/plugin/transform" @@ -91,7 +91,7 @@ func listSecurityCenterContacts(ctx context.Context, d *plugin.QueryData, _ *plu } subscriptionID := session.SubscriptionID - contactClient := security.NewContactsClientWithBaseURI(session.ResourceManagerEndpoint, subscriptionID, "") + contactClient := security.NewContactsClientWithBaseURI(session.ResourceManagerEndpoint, subscriptionID) contactClient.Authorizer = session.Authorizer result, err := contactClient.List(ctx) @@ -136,7 +136,7 @@ func getSecurityCenterContact(ctx context.Context, d *plugin.QueryData, _ *plugi name := d.EqualsQuals["name"].GetStringValue() subscriptionID := session.SubscriptionID - contactClient := security.NewContactsClientWithBaseURI(session.ResourceManagerEndpoint, subscriptionID, "") + contactClient := security.NewContactsClientWithBaseURI(session.ResourceManagerEndpoint, subscriptionID) contactClient.Authorizer = session.Authorizer contact, err := contactClient.Get(ctx, name) diff --git a/azure/table_azure_security_center_jit_network_access_policy.go b/azure/table_azure_security_center_jit_network_access_policy.go index 30cbd05f..a1b901de 100644 --- a/azure/table_azure_security_center_jit_network_access_policy.go +++ b/azure/table_azure_security_center_jit_network_access_policy.go @@ -3,7 +3,7 @@ package azure import ( "context" - "github.com/Azure/azure-sdk-for-go/services/preview/security/mgmt/v1.0/security" + "github.com/Azure/azure-sdk-for-go/profiles/preview/preview/security/mgmt/security" "github.com/turbot/steampipe-plugin-sdk/v5/grpc/proto" "github.com/turbot/steampipe-plugin-sdk/v5/plugin/transform" @@ -80,7 +80,7 @@ func listSecurityCenterJITNetworkAccessPolicies(ctx context.Context, d *plugin.Q } subscriptionID := session.SubscriptionID - client := security.NewJitNetworkAccessPoliciesClientWithBaseURI(session.ResourceManagerEndpoint, subscriptionID, "") + client := security.NewJitNetworkAccessPoliciesClientWithBaseURI(session.ResourceManagerEndpoint, subscriptionID) client.Authorizer = session.Authorizer result, err := client.List(ctx) diff --git a/azure/table_azure_security_center_setting.go b/azure/table_azure_security_center_setting.go index 9b998246..dbfc529b 100644 --- a/azure/table_azure_security_center_setting.go +++ b/azure/table_azure_security_center_setting.go @@ -3,7 +3,7 @@ package azure import ( "context" - "github.com/Azure/azure-sdk-for-go/services/preview/security/mgmt/v3.0/security" + "github.com/Azure/azure-sdk-for-go/profiles/preview/preview/security/mgmt/security" "github.com/turbot/steampipe-plugin-sdk/v5/grpc/proto" "github.com/turbot/steampipe-plugin-sdk/v5/plugin/transform" @@ -37,9 +37,8 @@ func tableAzureSecurityCenterSetting(_ context.Context) *plugin.Table { }, { Name: "enabled", - Description: "Data export setting status.", + Description: "Check if the setting is enabled.", Type: proto.ColumnType_BOOL, - Transform: transform.FromField("DataExportSettingProperties.Enabled"), }, { Name: "type", @@ -48,7 +47,7 @@ func tableAzureSecurityCenterSetting(_ context.Context) *plugin.Table { }, { Name: "kind", - Description: "The kind of the settings string (DataExportSettings).", + Description: "The kind of the setting.", Type: proto.ColumnType_STRING, }, @@ -69,6 +68,14 @@ func tableAzureSecurityCenterSetting(_ context.Context) *plugin.Table { } } +type SecurityCenterSettings struct { + ID *string + Name *string + Enabled *bool + Type *string + Kind security.KindEnum2 +} + //// LIST FUNCTION func listSecurityCenterSettings(ctx context.Context, d *plugin.QueryData, _ *plugin.HydrateData) (interface{}, error) { @@ -78,7 +85,7 @@ func listSecurityCenterSettings(ctx context.Context, d *plugin.QueryData, _ *plu } subscriptionID := session.SubscriptionID - settingClient := security.NewSettingsClientWithBaseURI(session.ResourceManagerEndpoint, subscriptionID, "") + settingClient := security.NewSettingsClientWithBaseURI(session.ResourceManagerEndpoint, subscriptionID) settingClient.Authorizer = session.Authorizer result, err := settingClient.List(ctx) @@ -87,7 +94,34 @@ func listSecurityCenterSettings(ctx context.Context, d *plugin.QueryData, _ *plu } for _, setting := range result.Values() { - d.StreamListItem(ctx, setting) + + // Check if dataExportSettings + if dataExportSettings, ok := setting.AsDataExportSettings(); ok { + d.StreamListItem(ctx, SecurityCenterSettings{ + ID: dataExportSettings.ID, + Name: dataExportSettings.Name, + Enabled: dataExportSettings.Enabled, + Type: dataExportSettings.Type, + Kind: dataExportSettings.Kind, + }) + } else if alertSyncSettings, ok := setting.AsAlertSyncSettings(); ok { // Check if alertSyncSettings + d.StreamListItem(ctx, SecurityCenterSettings{ + ID: alertSyncSettings.ID, + Name: alertSyncSettings.Name, + Enabled: alertSyncSettings.Enabled, + Type: alertSyncSettings.Type, + Kind: alertSyncSettings.Kind, + }) + } else { + setting, _ := setting.AsSetting() // Basic settings + d.StreamListItem(ctx, SecurityCenterSettings{ + ID: setting.ID, + Name: setting.Name, + Type: setting.Type, + Kind: setting.Kind, + }) + } + // Check if context has been cancelled or if the limit has been hit (if specified) // if there is a limit, it will return the number of rows required to reach this limit if d.RowsRemaining(ctx) == 0 { @@ -101,9 +135,35 @@ func listSecurityCenterSettings(ctx context.Context, d *plugin.QueryData, _ *plu return err, nil } for _, setting := range result.Values() { - d.StreamListItem(ctx, setting) + + // Check if dataExportSettings + if dataExportSettings, ok := setting.AsDataExportSettings(); ok { + d.StreamListItem(ctx, SecurityCenterSettings{ + ID: dataExportSettings.ID, + Name: dataExportSettings.Name, + Enabled: dataExportSettings.Enabled, + Type: dataExportSettings.Type, + Kind: dataExportSettings.Kind, + }) + } else if alertSyncSettings, ok := setting.AsAlertSyncSettings(); ok { // Check if alertSyncSettings + d.StreamListItem(ctx, SecurityCenterSettings{ + ID: alertSyncSettings.ID, + Name: alertSyncSettings.Name, + Enabled: alertSyncSettings.Enabled, + Type: alertSyncSettings.Type, + Kind: alertSyncSettings.Kind, + }) + } else { + setting, _ := setting.AsSetting() // Basic settings + d.StreamListItem(ctx, SecurityCenterSettings{ + ID: setting.ID, + Name: setting.Name, + Type: setting.Type, + Kind: setting.Kind, + }) + } + // Check if context has been cancelled or if the limit has been hit (if specified) - // if there is a limit, it will return the number of rows required to reach this limit if d.RowsRemaining(ctx) == 0 { return nil, nil } @@ -123,13 +183,20 @@ func getSecurityCenterSetting(ctx context.Context, d *plugin.QueryData, _ *plugi name := d.EqualsQuals["name"].GetStringValue() subscriptionID := session.SubscriptionID - settingClient := security.NewSettingsClientWithBaseURI(session.ResourceManagerEndpoint, subscriptionID, "") + settingClient := security.NewSettingsClientWithBaseURI(session.ResourceManagerEndpoint, subscriptionID) settingClient.Authorizer = session.Authorizer - setting, err := settingClient.Get(ctx, name) + setting, err := settingClient.Get(ctx, security.SettingName4(name)) if err != nil { return err, nil } - return setting.Value, nil + if dataExportSettings, ok := setting.Value.AsDataExportSettings(); ok { + return dataExportSettings, nil + } else if alertSyncSettings, ok := setting.Value.AsAlertSyncSettings(); ok { + return alertSyncSettings, nil + } else { + settings, _ := setting.Value.AsSetting() + return settings, nil + } } diff --git a/azure/table_azure_security_center_sub_assessment.go b/azure/table_azure_security_center_sub_assessment.go index 1bf807b1..cccd0a01 100644 --- a/azure/table_azure_security_center_sub_assessment.go +++ b/azure/table_azure_security_center_sub_assessment.go @@ -6,7 +6,7 @@ import ( "regexp" "strings" - "github.com/Azure/azure-sdk-for-go/services/preview/security/mgmt/v1.0/security" + "github.com/Azure/azure-sdk-for-go/profiles/preview/preview/security/mgmt/security" "github.com/turbot/go-kit/types" "github.com/turbot/steampipe-plugin-sdk/v5/grpc/proto" "github.com/turbot/steampipe-plugin-sdk/v5/plugin/transform" @@ -156,7 +156,7 @@ func listSecurityCenterSubAssessments(ctx context.Context, d *plugin.QueryData, } subscriptionID := session.SubscriptionID - subAssessmentClient := security.NewSubAssessmentsClientWithBaseURI(session.ResourceManagerEndpoint, subscriptionID, "") + subAssessmentClient := security.NewSubAssessmentsClientWithBaseURI(session.ResourceManagerEndpoint, subscriptionID) subAssessmentClient.Authorizer = session.Authorizer result, err := subAssessmentClient.ListAll(ctx, "subscriptions/"+subscriptionID) diff --git a/azure/table_azure_security_center_subscription_pricing.go b/azure/table_azure_security_center_subscription_pricing.go index e181d244..72529626 100644 --- a/azure/table_azure_security_center_subscription_pricing.go +++ b/azure/table_azure_security_center_subscription_pricing.go @@ -3,7 +3,7 @@ package azure import ( "context" - "github.com/Azure/azure-sdk-for-go/services/preview/security/mgmt/v3.0/security" + "github.com/Azure/azure-sdk-for-go/profiles/preview/preview/security/mgmt/security" "github.com/turbot/steampipe-plugin-sdk/v5/grpc/proto" "github.com/turbot/steampipe-plugin-sdk/v5/plugin/transform" @@ -81,7 +81,7 @@ func listSecurityCenterPricings(ctx context.Context, d *plugin.QueryData, _ *plu } subscriptionID := session.SubscriptionID - settingClient := security.NewPricingsClientWithBaseURI(session.ResourceManagerEndpoint, subscriptionID, "") + settingClient := security.NewPricingsClientWithBaseURI(session.ResourceManagerEndpoint, subscriptionID) settingClient.Authorizer = session.Authorizer result, err := settingClient.List(ctx) @@ -116,7 +116,7 @@ func getSecurityCenterPricing(ctx context.Context, d *plugin.QueryData, _ *plugi } subscriptionID := session.SubscriptionID - settingClient := security.NewPricingsClientWithBaseURI(session.ResourceManagerEndpoint, subscriptionID, name) + settingClient := security.NewPricingsClientWithBaseURI(session.ResourceManagerEndpoint, subscriptionID) settingClient.Authorizer = session.Authorizer setting, err := settingClient.Get(ctx, name) diff --git a/azure/table_azure_service_fabric_cluster.go b/azure/table_azure_service_fabric_cluster.go index b74cf62b..c4e4298b 100644 --- a/azure/table_azure_service_fabric_cluster.go +++ b/azure/table_azure_service_fabric_cluster.go @@ -3,7 +3,7 @@ package azure import ( "context" - "github.com/Azure/azure-sdk-for-go/services/servicefabric/mgmt/2019-03-01/servicefabric" + "github.com/Azure/azure-sdk-for-go/profiles/latest/servicefabric/mgmt/servicefabric" "github.com/turbot/steampipe-plugin-sdk/v5/grpc/proto" "github.com/turbot/steampipe-plugin-sdk/v5/plugin/transform" diff --git a/azure/table_azure_servicebus_namespace.go b/azure/table_azure_servicebus_namespace.go index 5cc8fabc..479c00a3 100644 --- a/azure/table_azure_servicebus_namespace.go +++ b/azure/table_azure_servicebus_namespace.go @@ -4,8 +4,9 @@ import ( "context" "strings" - "github.com/Azure/azure-sdk-for-go/profiles/2020-09-01/monitor/mgmt/insights" - "github.com/Azure/azure-sdk-for-go/services/preview/servicebus/mgmt/2021-06-01-preview/servicebus" + "github.com/Azure/azure-sdk-for-go/profiles/latest/servicebus/mgmt/servicebus" + "github.com/Azure/azure-sdk-for-go/profiles/preview/preview/monitor/mgmt/insights" + "github.com/turbot/steampipe-plugin-sdk/v5/grpc/proto" "github.com/turbot/steampipe-plugin-sdk/v5/plugin" "github.com/turbot/steampipe-plugin-sdk/v5/plugin/transform" diff --git a/azure/table_azure_signalr_service.go b/azure/table_azure_signalr_service.go index 5108dc8a..8959174f 100644 --- a/azure/table_azure_signalr_service.go +++ b/azure/table_azure_signalr_service.go @@ -3,8 +3,9 @@ package azure import ( "context" - "github.com/Azure/azure-sdk-for-go/profiles/2020-09-01/monitor/mgmt/insights" - "github.com/Azure/azure-sdk-for-go/services/signalr/mgmt/2020-05-01/signalr" + "github.com/Azure/azure-sdk-for-go/profiles/latest/signalr/mgmt/signalr" + "github.com/Azure/azure-sdk-for-go/profiles/preview/preview/monitor/mgmt/insights" + "github.com/turbot/steampipe-plugin-sdk/v5/grpc/proto" "github.com/turbot/steampipe-plugin-sdk/v5/plugin/transform" diff --git a/azure/table_azure_spring_cloud_service.go b/azure/table_azure_spring_cloud_service.go index 540188ea..9b00e5f3 100644 --- a/azure/table_azure_spring_cloud_service.go +++ b/azure/table_azure_spring_cloud_service.go @@ -3,9 +3,9 @@ package azure import ( "context" - "github.com/Azure/azure-sdk-for-go/profiles/2020-09-01/monitor/mgmt/insights" + "github.com/Azure/azure-sdk-for-go/profiles/latest/appplatform/mgmt/appplatform" "github.com/Azure/azure-sdk-for-go/profiles/latest/resources/mgmt/resources" - "github.com/Azure/azure-sdk-for-go/services/appplatform/mgmt/2020-07-01/appplatform" + "github.com/Azure/azure-sdk-for-go/profiles/preview/preview/monitor/mgmt/insights" "github.com/turbot/steampipe-plugin-sdk/v5/grpc/proto" "github.com/turbot/steampipe-plugin-sdk/v5/plugin/transform" diff --git a/azure/table_azure_sql_database.go b/azure/table_azure_sql_database.go index aa6e8f51..a2856564 100644 --- a/azure/table_azure_sql_database.go +++ b/azure/table_azure_sql_database.go @@ -4,9 +4,7 @@ import ( "context" "strings" - "github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2017-03-01-preview/sql" - sqlv3 "github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/v3.0/sql" - sqlV5 "github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/v5.0/sql" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/sql/armsql" "github.com/turbot/steampipe-plugin-sdk/v5/grpc/proto" "github.com/turbot/steampipe-plugin-sdk/v5/plugin/transform" @@ -27,6 +25,12 @@ func tableAzureSqlDatabase(_ context.Context) *plugin.Table { ParentHydrate: listSQLServer, Hydrate: listSqlDatabases, }, + HydrateConfig: []plugin.HydrateConfig{ + { + Func: listSqlDatabaseVulnerabilityAssessmentScans, + Depends: []plugin.HydrateFunc{listSqlDatabaseVulnerabilityAssessments}, + }, + }, Columns: azureColumns([]*plugin.Column{ { Name: "name", @@ -49,7 +53,7 @@ func tableAzureSqlDatabase(_ context.Context) *plugin.Table { Name: "status", Description: "The status of the database.", Type: proto.ColumnType_STRING, - Transform: transform.FromField("DatabaseProperties.Status"), + Transform: transform.FromField("Properties.Status"), }, { Name: "type", @@ -60,61 +64,61 @@ func tableAzureSqlDatabase(_ context.Context) *plugin.Table { Name: "collation", Description: "The collation of the database.", Type: proto.ColumnType_STRING, - Transform: transform.FromField("DatabaseProperties.Collation"), + Transform: transform.FromField("Properties.Collation"), }, { Name: "containment_state", Description: "The containment state of the database.", Type: proto.ColumnType_INT, - Transform: transform.FromField("DatabaseProperties.ContainmentState"), + Transform: transform.FromField("Properties.ContainmentState"), }, { Name: "creation_date", Description: "The creation date of the database.", Type: proto.ColumnType_TIMESTAMP, - Transform: transform.FromField("DatabaseProperties.CreationDate").Transform(convertDateToTime), + Transform: transform.FromField("Properties.CreationDate"), }, { Name: "current_service_objective_id", Description: "The current service level objective ID of the database.", Type: proto.ColumnType_STRING, - Transform: transform.FromField("DatabaseProperties.CurrentServiceObjectiveID"), + Transform: transform.FromField("Properties.CurrentServiceObjectiveID"), }, { Name: "database_id", Description: "The ID of the database.", Type: proto.ColumnType_STRING, - Transform: transform.FromField("DatabaseProperties.DatabaseID"), + Transform: transform.FromField("Properties.DatabaseID"), }, { Name: "default_secondary_location", Description: "The default secondary region for this database.", Type: proto.ColumnType_STRING, - Transform: transform.FromField("DatabaseProperties.DefaultSecondaryLocation"), + Transform: transform.FromField("Properties.DefaultSecondaryLocation"), }, { Name: "earliest_restore_date", Description: "This records the earliest start date and time that restore is available for this database.", Type: proto.ColumnType_TIMESTAMP, - Transform: transform.FromField("DatabaseProperties.EarliestRestoreDate").Transform(convertDateToTime), + Transform: transform.FromField("Properties.EarliestRestoreDate"), }, { Name: "edition", Description: "The edition of the database.", Type: proto.ColumnType_STRING, - Transform: transform.FromField("DatabaseProperties.Edition"), + Transform: transform.FromField("Properties.Edition"), }, { Name: "elastic_pool_name", Description: "The name of the elastic pool the database is in.", Type: proto.ColumnType_STRING, - Transform: transform.FromField("DatabaseProperties.ElasticPoolName"), + Transform: transform.FromField("Properties.ElasticPoolName"), }, { Name: "failover_group_id", Description: "The resource identifier of the failover group containing this database.", Type: proto.ColumnType_STRING, - Transform: transform.FromField("DatabaseProperties.FailoverGroupID"), + Transform: transform.FromField("Properties.FailoverGroupID"), }, { Name: "kind", @@ -130,31 +134,31 @@ func tableAzureSqlDatabase(_ context.Context) *plugin.Table { Name: "max_size_bytes", Description: "The max size of the database expressed in bytes.", Type: proto.ColumnType_STRING, - Transform: transform.FromField("DatabaseProperties.MaxSizeBytes"), + Transform: transform.FromField("Properties.MaxSizeBytes"), }, { Name: "recovery_services_recovery_point_resource_id", Description: "Specifies the resource ID of the recovery point to restore from if createMode is RestoreLongTermRetentionBackup.", Type: proto.ColumnType_STRING, - Transform: transform.FromField("DatabaseProperties.RecoveryServicesRecoveryPointResourceID"), + Transform: transform.FromField("Properties.RecoveryServicesRecoveryPointResourceID"), }, { Name: "requested_service_objective_id", Description: "The configured service level objective ID of the database.", Type: proto.ColumnType_STRING, - Transform: transform.FromField("DatabaseProperties.RequestedServiceObjectiveID"), + Transform: transform.FromField("Properties.RequestedServiceObjectiveID"), }, { Name: "restore_point_in_time", Description: "Specifies the point in time of the source database that will be restored to create the new database.", Type: proto.ColumnType_TIMESTAMP, - Transform: transform.FromField("DatabaseProperties.RestorePointInTime").Transform(convertDateToTime), + Transform: transform.FromField("Properties.RestorePointInTime"), }, { Name: "requested_service_objective_name", Description: "The name of the configured service level objective of the database.", Type: proto.ColumnType_STRING, - Transform: transform.FromField("DatabaseProperties.RequestedServiceObjectiveName"), + Transform: transform.FromField("Properties.RequestedServiceObjectiveName"), }, { Name: "retention_policy_id", @@ -181,37 +185,37 @@ func tableAzureSqlDatabase(_ context.Context) *plugin.Table { Name: "source_database_deletion_date", Description: "Specifies the time that the database was deleted when createMode is Restore and sourceDatabaseId is the deleted database's original resource id.", Type: proto.ColumnType_TIMESTAMP, - Transform: transform.FromField("DatabaseProperties.SourceDatabaseDeletionDate").Transform(convertDateToTime), + Transform: transform.FromField("Properties.SourceDatabaseDeletionDate"), }, { Name: "source_database_id", Description: "Specifies the resource ID of the source database if createMode is Copy, NonReadableSecondary, OnlineSecondary, PointInTimeRestore, Recovery, or Restore.", Type: proto.ColumnType_STRING, - Transform: transform.FromField("DatabaseProperties.SourceDatabaseID"), + Transform: transform.FromField("Properties.SourceDatabaseID"), }, { Name: "zone_redundant", Description: "Indicates if the database is zone redundant or not.", Type: proto.ColumnType_BOOL, - Transform: transform.FromField("DatabaseProperties.ZoneRedundant"), + Transform: transform.FromField("Properties.ZoneRedundant"), }, { Name: "create_mode", Description: "Specifies the mode of database creation.", Type: proto.ColumnType_STRING, - Transform: transform.FromField("DatabaseProperties.CreateMode"), + Transform: transform.FromField("Properties.CreateMode"), }, { Name: "read_scale", Description: "ReadScale indicates whether read-only connections are allowed to this database or not if the database is a geo-secondary.", Type: proto.ColumnType_STRING, - Transform: transform.FromField("DatabaseProperties.ReadScale"), + Transform: transform.FromField("Properties.ReadScale"), }, { Name: "recommended_index", Description: "The recommended indices for this database.", Type: proto.ColumnType_JSON, - Transform: transform.FromField("DatabaseProperties.RecommendedIndex"), + Transform: transform.FromField("Properties.RecommendedIndex"), }, { Name: "retention_policy_property", @@ -230,13 +234,13 @@ func tableAzureSqlDatabase(_ context.Context) *plugin.Table { Name: "service_level_objective", Description: "The current service level objective of the database.", Type: proto.ColumnType_JSON, - Transform: transform.FromField("DatabaseProperties.ServiceLevelObjective"), + Transform: transform.FromField("Properties.ServiceLevelObjective"), }, { Name: "service_tier_advisors", Description: "The list of service tier advisors for this database.", Type: proto.ColumnType_JSON, - Transform: transform.FromField("DatabaseProperties.ServiceTierAdvisors"), + Transform: transform.FromField("Properties.ServiceTierAdvisors"), }, { Name: "transparent_data_encryption", @@ -307,29 +311,34 @@ func tableAzureSqlDatabase(_ context.Context) *plugin.Table { //// LIST FUNCTION func listSqlDatabases(ctx context.Context, d *plugin.QueryData, h *plugin.HydrateData) (interface{}, error) { - session, err := GetNewSession(ctx, d, "MANAGEMENT") + session, err := GetNewSessionUpdated(ctx, d) if err != nil { + plugin.Logger(ctx).Error("azure_sql_database.listSqlDatabases", "session_error", err) return nil, err } - subscriptionID := session.SubscriptionID - - client := sql.NewDatabasesClientWithBaseURI(session.ResourceManagerEndpoint, subscriptionID) - client.Authorizer = session.Authorizer - - server := h.Item.(sqlv3.Server) - resourceGroupName := strings.Split(string(*server.ID), "/")[4] - - result, err := client.ListByServer(ctx, resourceGroupName, *server.Name, "", "") + client, err := armsql.NewDatabasesClient(session.SubscriptionID, session.Cred, session.ClientOptions) if err != nil { + plugin.Logger(ctx).Error("azure_sql_database.listSqlDatabases", "client_error", err) return nil, err } - for _, database := range *result.Value { - d.StreamLeafListItem(ctx, database) - // Check if context has been cancelled or if the limit has been hit (if specified) - // if there is a limit, it will return the number of rows required to reach this limit - if d.RowsRemaining(ctx) == 0 { - return nil, nil + server := h.Item.(armsql.Server) + resourceGroupName := strings.Split(string(*server.ID), "/")[4] + + pager := client.NewListByServerPager(resourceGroupName, *server.Name, nil) + for pager.More() { + result, err := pager.NextPage(ctx) + if err != nil { + plugin.Logger(ctx).Error("azure_sql_database.listSqlDatabases", "api_error", err) + return nil, err + } + for _, database := range result.Value { + d.StreamListItem(ctx, *database) + // Check if context has been cancelled or if the limit has been hit (if specified) + // if there is a limit, it will return the number of rows required to reach this limit + if d.RowsRemaining(ctx) == 0 { + return nil, nil + } } } @@ -343,411 +352,206 @@ func getSqlDatabase(ctx context.Context, d *plugin.QueryData, h *plugin.HydrateD var serverName, databaseName, resourceGroupName string if h.Item != nil { - database := h.Item.(sql.Database) + database := h.Item.(armsql.Database) serverName = strings.Split(*database.ID, "/")[8] databaseName = *database.Name resourceGroupName = strings.Split(string(*database.ID), "/")[4] } else { - serverName = d.EqualsQuals["server_name"].GetStringValue() - databaseName = d.EqualsQuals["name"].GetStringValue() - resourceGroupName = d.EqualsQuals["resource_group"].GetStringValue() + serverName = d.EqualsQualString("server_name") + databaseName = d.EqualsQualString("name") + resourceGroupName = d.EqualsQualString("resource_group") } - session, err := GetNewSession(ctx, d, "MANAGEMENT") + // check if server_name, name or resource_group is nil + if serverName == "" || databaseName == "" || resourceGroupName == "" { + return nil, nil + } + + session, err := GetNewSessionUpdated(ctx, d) if err != nil { + plugin.Logger(ctx).Error("azure_sql_database.getSqlDatabase", "session_error", err) + return nil, err + } + client, err := armsql.NewDatabasesClient(session.SubscriptionID, session.Cred, session.ClientOptions) + if err != nil { + plugin.Logger(ctx).Error("azure_sql_database.getSqlDatabase", "client_error", err) return nil, err } - subscriptionID := session.SubscriptionID - - client := sql.NewDatabasesClientWithBaseURI(session.ResourceManagerEndpoint, subscriptionID) - client.Authorizer = session.Authorizer - op, err := client.Get(ctx, resourceGroupName, serverName, databaseName, "") + op, err := client.Get(ctx, resourceGroupName, serverName, databaseName, nil) if err != nil { + plugin.Logger(ctx).Error("azure_sql_database.getSqlDatabase", "api_error", err) return nil, err } // In some cases resource does not give any notFound error // instead of notFound error, it returns empty data if op.ID != nil { - return op, nil + return op.Database, nil } return nil, nil } func getSqlDatabaseTransparentDataEncryption(ctx context.Context, d *plugin.QueryData, h *plugin.HydrateData) (interface{}, error) { - database := h.Item.(sql.Database) + database := h.Item.(armsql.Database) serverName := strings.Split(*database.ID, "/")[8] - databaseName := *database.Name resourceGroupName := strings.Split(string(*database.ID), "/")[4] + databaseName := *database.Name - session, err := GetNewSession(ctx, d, "MANAGEMENT") + session, err := GetNewSessionUpdated(ctx, d) if err != nil { + plugin.Logger(ctx).Error("azure_sql_database.getSqlDatabaseTransparentDataEncryption", "session_error", err) return nil, err } - subscriptionID := session.SubscriptionID - - client := sql.NewTransparentDataEncryptionsClientWithBaseURI(session.ResourceManagerEndpoint, subscriptionID) - client.Authorizer = session.Authorizer - - op, err := client.Get(ctx, resourceGroupName, serverName, databaseName) + client, err := armsql.NewTransparentDataEncryptionsClient(session.SubscriptionID, session.Cred, session.ClientOptions) if err != nil { + plugin.Logger(ctx).Error("azure_sql_database.getSqlDatabaseTransparentDataEncryption", "client_error", err) return nil, err } - // In some cases resource does not give any notFound error - // instead of notFound error, it returns empty data - if op.ID != nil { - return op, nil + var tdes []*armsql.LogicalDatabaseTransparentDataEncryption + pager := client.NewListByDatabasePager(resourceGroupName, serverName, databaseName, nil) + for pager.More() { + result, err := pager.NextPage(ctx) + if err != nil { + plugin.Logger(ctx).Error("azure_sql_database.getSqlDatabaseTransparentDataEncryption", "api_error", err) + return nil, err + } + tdes = append(tdes, result.Value...) } - return nil, nil + return tdes, nil } func getSqlDatabaseLongTermRetentionPolicies(ctx context.Context, d *plugin.QueryData, h *plugin.HydrateData) (interface{}, error) { - database := h.Item.(sql.Database) + database := h.Item.(armsql.Database) serverName := strings.Split(*database.ID, "/")[8] - databaseName := *database.Name resourceGroupName := strings.Split(string(*database.ID), "/")[4] + databaseName := *database.Name - session, err := GetNewSession(ctx, d, "MANAGEMENT") + session, err := GetNewSessionUpdated(ctx, d) if err != nil { + plugin.Logger(ctx).Error("azure_sql_database.getSqlDatabaseLongTermRetentionPolicies", "session_error", err) return nil, err } - subscriptionID := session.SubscriptionID - - client := sqlV5.NewLongTermRetentionPoliciesClientWithBaseURI(session.ResourceManagerEndpoint, subscriptionID) - client.Authorizer = session.Authorizer - - op, err := client.ListByDatabase(ctx, resourceGroupName, serverName, databaseName) + client, err := armsql.NewLongTermRetentionPoliciesClient(session.SubscriptionID, session.Cred, session.ClientOptions) if err != nil { + plugin.Logger(ctx).Error("azure_sql_database.getSqlDatabaseLongTermRetentionPolicies", "client_error", err) return nil, err } - // We can add only one retention policy per SQL Database. - res := op.Values() + pager := client.NewListByDatabasePager(resourceGroupName, serverName, databaseName, nil) + for pager.More() { + result, err := pager.NextPage(ctx) + if err != nil { + plugin.Logger(ctx).Error("azure_sql_database.getSqlDatabaseLongTermRetentionPolicies", "api_error", err) + return nil, err + } - // For master database we are getting the response as empty array - if len(res) == 0 { - return nil, nil + if len(result.Value) > 0 { + // Return the first retention policy found + return result.Value[0], nil + } } - return res[0], nil + return nil, nil } func getSqlDatabaseBlobAuditingPolicies(ctx context.Context, d *plugin.QueryData, h *plugin.HydrateData) (interface{}, error) { - database := h.Item.(sql.Database) + database := h.Item.(armsql.Database) serverName := strings.Split(*database.ID, "/")[8] - databaseName := *database.Name resourceGroupName := strings.Split(string(*database.ID), "/")[4] + databaseName := *database.Name - session, err := GetNewSession(ctx, d, "MANAGEMENT") + session, err := GetNewSessionUpdated(ctx, d) if err != nil { + plugin.Logger(ctx).Error("azure_sql_database.getSqlDatabaseBlobAuditingPolicies", "session_error", err) return nil, err } - subscriptionID := session.SubscriptionID - - client := sqlV5.NewDatabaseBlobAuditingPoliciesClientWithBaseURI(session.ResourceManagerEndpoint, subscriptionID) - client.Authorizer = session.Authorizer - - op, err := client.ListByDatabase(ctx, resourceGroupName, serverName, databaseName) + client, err := armsql.NewDatabaseBlobAuditingPoliciesClient(session.SubscriptionID, session.Cred, session.ClientOptions) if err != nil { + plugin.Logger(ctx).Error("azure_sql_database.getSqlDatabaseBlobAuditingPolicies", "client_error", err) return nil, err } - var blobPolicies []map[string]interface{} - for _, i := range op.Values() { - objectMap := make(map[string]interface{}) - if i.ID != nil { - objectMap["id"] = i.ID - } - if i.Name != nil { - objectMap["name"] = i.Name - } - if i.Kind != nil { - objectMap["kind"] = i.Kind - } - if i.Type != nil { - objectMap["type"] = i.Type - } - if i.DatabaseBlobAuditingPolicyProperties != nil { - obMap := make(map[string]interface{}) - if i.DatabaseBlobAuditingPolicyProperties.RetentionDays != nil { - obMap["retentionDays"] = i.DatabaseBlobAuditingPolicyProperties.RetentionDays - } - if i.DatabaseBlobAuditingPolicyProperties.AuditActionsAndGroups != nil { - obMap["AuditActionsAndGroups"] = i.DatabaseBlobAuditingPolicyProperties.AuditActionsAndGroups - } - if i.DatabaseBlobAuditingPolicyProperties.IsAzureMonitorTargetEnabled != nil { - obMap["isAzureMonitorTargetEnabled"] = i.DatabaseBlobAuditingPolicyProperties.IsAzureMonitorTargetEnabled - } - if i.DatabaseBlobAuditingPolicyProperties.IsStorageSecondaryKeyInUse != nil { - obMap["isStorageSecondaryKeyInUse"] = i.DatabaseBlobAuditingPolicyProperties.IsStorageSecondaryKeyInUse - } - if i.DatabaseBlobAuditingPolicyProperties.QueueDelayMs != nil { - obMap["queueDelayMs"] = i.DatabaseBlobAuditingPolicyProperties.QueueDelayMs - } - if i.DatabaseBlobAuditingPolicyProperties.State != "" { - obMap["state"] = i.DatabaseBlobAuditingPolicyProperties.State - } - if i.DatabaseBlobAuditingPolicyProperties.StorageEndpoint != nil { - obMap["storageEndpoint"] = i.DatabaseBlobAuditingPolicyProperties.StorageEndpoint - } - if i.DatabaseBlobAuditingPolicyProperties.StorageAccountAccessKey != nil { - obMap["storageAccountAccessKey"] = i.DatabaseBlobAuditingPolicyProperties.StorageAccountAccessKey - } - if i.DatabaseBlobAuditingPolicyProperties.StorageAccountSubscriptionID != nil { - obMap["storageAccountSubscriptionID"] = i.DatabaseBlobAuditingPolicyProperties.StorageAccountSubscriptionID - } - objectMap["databaseBlobAuditingPolicyProperties"] = obMap - } - - blobPolicies = append(blobPolicies, objectMap) - } - - if op.NotDone() { - for _, i := range op.Values() { - objectMap := make(map[string]interface{}) - if i.ID != nil { - objectMap["id"] = i.ID - } - if i.Name != nil { - objectMap["name"] = i.Name - } - if i.Kind != nil { - objectMap["kind"] = i.Kind - } - if i.Type != nil { - objectMap["type"] = i.Type - } - if i.DatabaseBlobAuditingPolicyProperties != nil { - obMap := make(map[string]interface{}) - if i.DatabaseBlobAuditingPolicyProperties.RetentionDays != nil { - obMap["retentionDays"] = i.DatabaseBlobAuditingPolicyProperties.RetentionDays - } - if i.DatabaseBlobAuditingPolicyProperties.AuditActionsAndGroups != nil { - obMap["AuditActionsAndGroups"] = i.DatabaseBlobAuditingPolicyProperties.AuditActionsAndGroups - } - if i.DatabaseBlobAuditingPolicyProperties.IsAzureMonitorTargetEnabled != nil { - obMap["isAzureMonitorTargetEnabled"] = i.DatabaseBlobAuditingPolicyProperties.IsAzureMonitorTargetEnabled - } - if i.DatabaseBlobAuditingPolicyProperties.IsStorageSecondaryKeyInUse != nil { - obMap["isStorageSecondaryKeyInUse"] = i.DatabaseBlobAuditingPolicyProperties.IsStorageSecondaryKeyInUse - } - if i.DatabaseBlobAuditingPolicyProperties.QueueDelayMs != nil { - obMap["queueDelayMs"] = i.DatabaseBlobAuditingPolicyProperties.QueueDelayMs - } - if i.DatabaseBlobAuditingPolicyProperties.State != "" { - obMap["state"] = i.DatabaseBlobAuditingPolicyProperties.State - } - if i.DatabaseBlobAuditingPolicyProperties.StorageEndpoint != nil { - obMap["storageEndpoint"] = i.DatabaseBlobAuditingPolicyProperties.StorageEndpoint - } - if i.DatabaseBlobAuditingPolicyProperties.StorageAccountAccessKey != nil { - obMap["storageAccountAccessKey"] = i.DatabaseBlobAuditingPolicyProperties.StorageAccountAccessKey - } - if i.DatabaseBlobAuditingPolicyProperties.StorageAccountSubscriptionID != nil { - obMap["storageAccountSubscriptionID"] = i.DatabaseBlobAuditingPolicyProperties.StorageAccountSubscriptionID - } - objectMap["databaseBlobAuditingPolicyProperties"] = obMap - } - - blobPolicies = append(blobPolicies, objectMap) + var blobPolicies []*armsql.DatabaseBlobAuditingPolicy + pager := client.NewListByDatabasePager(resourceGroupName, serverName, databaseName, nil) + for pager.More() { + result, err := pager.NextPage(ctx) + if err != nil { + plugin.Logger(ctx).Error("azure_sql_database.getSqlDatabaseBlobAuditingPolicies", "api_error", err) + return nil, err } + blobPolicies = append(blobPolicies, result.Value...) } return blobPolicies, nil } func listSqlDatabaseVulnerabilityAssessments(ctx context.Context, d *plugin.QueryData, h *plugin.HydrateData) (interface{}, error) { - database := h.Item.(sql.Database) + database := h.Item.(armsql.Database) serverName := strings.Split(*database.ID, "/")[8] - databaseName := *database.Name resourceGroupName := strings.Split(string(*database.ID), "/")[4] + databaseName := *database.Name - session, err := GetNewSession(ctx, d, "MANAGEMENT") + session, err := GetNewSessionUpdated(ctx, d) if err != nil { + plugin.Logger(ctx).Error("azure_sql_database.listSqlDatabaseVulnerabilityAssessments", "session_error", err) return nil, err } - subscriptionID := session.SubscriptionID - - client := sqlV5.NewDatabaseVulnerabilityAssessmentsClientWithBaseURI(session.ResourceManagerEndpoint, subscriptionID) - client.Authorizer = session.Authorizer - - op, err := client.ListByDatabase(ctx, resourceGroupName, serverName, databaseName) + client, err := armsql.NewDatabaseVulnerabilityAssessmentsClient(session.SubscriptionID, session.Cred, session.ClientOptions) if err != nil { + plugin.Logger(ctx).Error("azure_sql_database.listSqlDatabaseVulnerabilityAssessments", "client_error", err) return nil, err } - var vulnerabilityAssessments []map[string]interface{} - - for _, i := range op.Values() { - objectMap := make(map[string]interface{}) - if i.ID != nil { - objectMap["id"] = i.ID - } - if i.Name != nil { - objectMap["name"] = i.Name - } - if i.Type != nil { - objectMap["type"] = i.Type - } - if i.DatabaseVulnerabilityAssessmentProperties.RecurringScans != nil { - objectMap["recurringScans"] = i.DatabaseVulnerabilityAssessmentProperties.RecurringScans - } - if i.DatabaseVulnerabilityAssessmentProperties.StorageAccountAccessKey != nil { - objectMap["storageAccountAccessKey"] = *i.DatabaseVulnerabilityAssessmentProperties.StorageAccountAccessKey - } - if i.DatabaseVulnerabilityAssessmentProperties.StorageContainerPath != nil { - objectMap["storageContainerPath"] = *i.DatabaseVulnerabilityAssessmentProperties.StorageContainerPath - } - if i.DatabaseVulnerabilityAssessmentProperties.StorageContainerSasKey != nil { - objectMap["storageContainerSasKey"] = *i.DatabaseVulnerabilityAssessmentProperties.StorageContainerSasKey - } - vulnerabilityAssessments = append(vulnerabilityAssessments, objectMap) - } - - for op.NotDone() { - err = op.NextWithContext(ctx) + var vulnerabilityAssessments []*armsql.DatabaseVulnerabilityAssessment + pager := client.NewListByDatabasePager(resourceGroupName, serverName, databaseName, nil) + for pager.More() { + result, err := pager.NextPage(ctx) if err != nil { + plugin.Logger(ctx).Error("azure_sql_database.listSqlDatabaseVulnerabilityAssessments", "api_error", err) return nil, err } - for _, i := range op.Values() { - objectMap := make(map[string]interface{}) - if i.ID != nil { - objectMap["id"] = i.ID - } - if i.Name != nil { - objectMap["name"] = i.Name - } - if i.Type != nil { - objectMap["type"] = i.Type - } - if i.DatabaseVulnerabilityAssessmentProperties.RecurringScans != nil { - objectMap["recurringScans"] = i.DatabaseVulnerabilityAssessmentProperties.RecurringScans - } - if i.DatabaseVulnerabilityAssessmentProperties.StorageAccountAccessKey != nil { - objectMap["storageAccountAccessKey"] = *i.DatabaseVulnerabilityAssessmentProperties.StorageAccountAccessKey - } - if i.DatabaseVulnerabilityAssessmentProperties.StorageContainerPath != nil { - objectMap["storageContainerPath"] = *i.DatabaseVulnerabilityAssessmentProperties.StorageContainerPath - } - if i.DatabaseVulnerabilityAssessmentProperties.StorageContainerSasKey != nil { - objectMap["storageContainerSasKey"] = *i.DatabaseVulnerabilityAssessmentProperties.StorageContainerSasKey - } - vulnerabilityAssessments = append(vulnerabilityAssessments, objectMap) - } + vulnerabilityAssessments = append(vulnerabilityAssessments, result.Value...) } return vulnerabilityAssessments, nil } func listSqlDatabaseVulnerabilityAssessmentScans(ctx context.Context, d *plugin.QueryData, h *plugin.HydrateData) (interface{}, error) { - database := h.Item.(sql.Database) + database := h.Item.(armsql.Database) serverName := strings.Split(*database.ID, "/")[8] - databaseName := *database.Name resourceGroupName := strings.Split(string(*database.ID), "/")[4] + databaseName := *database.Name - session, err := GetNewSession(ctx, d, "MANAGEMENT") + session, err := GetNewSessionUpdated(ctx, d) if err != nil { + plugin.Logger(ctx).Error("azure_sql_database.listSqlDatabaseVulnerabilityAssessmentScans", "session_error", err) return nil, err } - subscriptionID := session.SubscriptionID - - client := sqlV5.NewDatabaseVulnerabilityAssessmentScansClientWithBaseURI(session.ResourceManagerEndpoint, subscriptionID) - client.Authorizer = session.Authorizer - var vulnerabilityAssessmentScanRecords []map[string]interface{} - - op, err := client.ListByDatabase(ctx, resourceGroupName, serverName, databaseName) + client, err := armsql.NewDatabaseVulnerabilityAssessmentScansClient(session.SubscriptionID, session.Cred, session.ClientOptions) if err != nil { - // API throws "VulnerabilityAssessmentInvalidPolicy" error if Vulnerability Assessment settings don't exist or invalid storage specified in settings. - // https://learn.microsoft.com/en-us/rest/api/sql/2022-05-01-preview/database-vulnerability-assessment-scans/list-by-database?tabs=HTTP - if strings.Contains(err.Error(), "VulnerabilityAssessmentInvalidPolicy") { - return vulnerabilityAssessmentScanRecords, nil - } + plugin.Logger(ctx).Error("azure_sql_database.listSqlDatabaseVulnerabilityAssessmentScans", "client_error", err) return nil, err } - - for _, i := range op.Values() { - objectMap := make(map[string]interface{}) - if i.ID != nil { - objectMap["id"] = i.ID - } - if i.Name != nil { - objectMap["name"] = i.Name - } - if i.Type != nil { - objectMap["type"] = i.Type - } - if i.VulnerabilityAssessmentScanRecordProperties.ScanID != nil { - objectMap["scanID"] = *i.VulnerabilityAssessmentScanRecordProperties.ScanID - } - if len(i.VulnerabilityAssessmentScanRecordProperties.TriggerType) > 0 { - objectMap["triggerType"] = i.VulnerabilityAssessmentScanRecordProperties.TriggerType - } - if len(i.VulnerabilityAssessmentScanRecordProperties.State) > 0 { - objectMap["state"] = i.VulnerabilityAssessmentScanRecordProperties.State - } - if i.VulnerabilityAssessmentScanRecordProperties.StartTime != nil { - objectMap["startTime"] = i.VulnerabilityAssessmentScanRecordProperties.StartTime - } - if i.VulnerabilityAssessmentScanRecordProperties.EndTime != nil { - objectMap["endTime"] = i.VulnerabilityAssessmentScanRecordProperties.EndTime - } - if i.VulnerabilityAssessmentScanRecordProperties.Errors != nil { - objectMap["errors"] = i.VulnerabilityAssessmentScanRecordProperties.Errors - } - if i.VulnerabilityAssessmentScanRecordProperties.StorageContainerPath != nil { - objectMap["storageContainerPath"] = i.VulnerabilityAssessmentScanRecordProperties.StorageContainerPath - } - if i.VulnerabilityAssessmentScanRecordProperties.NumberOfFailedSecurityChecks != nil { - objectMap["numberOfFailedSecurityChecks"] = *i.VulnerabilityAssessmentScanRecordProperties.NumberOfFailedSecurityChecks - } - vulnerabilityAssessmentScanRecords = append(vulnerabilityAssessmentScanRecords, objectMap) - } - - for op.NotDone() { - err = op.NextWithContext(ctx) - if err != nil { - return nil, err - } - for _, i := range op.Values() { - objectMap := make(map[string]interface{}) - if i.ID != nil { - objectMap["id"] = i.ID - } - if i.Name != nil { - objectMap["name"] = i.Name - } - if i.Type != nil { - objectMap["type"] = i.Type - } - if i.VulnerabilityAssessmentScanRecordProperties.ScanID != nil { - objectMap["scanID"] = *i.VulnerabilityAssessmentScanRecordProperties.ScanID - } - if len(i.VulnerabilityAssessmentScanRecordProperties.TriggerType) > 0 { - objectMap["triggerType"] = i.VulnerabilityAssessmentScanRecordProperties.TriggerType - } - if len(i.VulnerabilityAssessmentScanRecordProperties.State) > 0 { - objectMap["state"] = i.VulnerabilityAssessmentScanRecordProperties.State - } - if i.VulnerabilityAssessmentScanRecordProperties.StartTime != nil { - objectMap["startTime"] = i.VulnerabilityAssessmentScanRecordProperties.StartTime - } - if i.VulnerabilityAssessmentScanRecordProperties.EndTime != nil { - objectMap["endTime"] = i.VulnerabilityAssessmentScanRecordProperties.EndTime - } - if i.VulnerabilityAssessmentScanRecordProperties.Errors != nil { - objectMap["errors"] = i.VulnerabilityAssessmentScanRecordProperties.Errors - } - if i.VulnerabilityAssessmentScanRecordProperties.StorageContainerPath != nil { - objectMap["storageContainerPath"] = i.VulnerabilityAssessmentScanRecordProperties.StorageContainerPath - } - if i.VulnerabilityAssessmentScanRecordProperties.NumberOfFailedSecurityChecks != nil { - objectMap["numberOfFailedSecurityChecks"] = *i.VulnerabilityAssessmentScanRecordProperties.NumberOfFailedSecurityChecks + vulnerabilityAssessments := h.HydrateResults["listSqlDatabaseVulnerabilityAssessments"].([]*armsql.DatabaseVulnerabilityAssessment) + var vulnerabilityAssessmentScanRecords []*armsql.VulnerabilityAssessmentScanRecord + + for _, vulnerabilityAssessment := range vulnerabilityAssessments { + pager := client.NewListByDatabasePager(resourceGroupName, serverName, databaseName, armsql.VulnerabilityAssessmentName(*vulnerabilityAssessment.Name), nil) + for pager.More() { + result, err := pager.NextPage(ctx) + if err != nil { + // check if Vulnerability Assessment is invalid + if strings.Contains(err.Error(), "VulnerabilityAssessmentInvalidPolicy") { + return nil, nil + } + plugin.Logger(ctx).Error("azure_sql_database.listSqlDatabaseVulnerabilityAssessmentScans", "api_error", err) + return nil, err } - vulnerabilityAssessmentScanRecords = append(vulnerabilityAssessmentScanRecords, objectMap) + vulnerabilityAssessmentScanRecords = append(vulnerabilityAssessmentScanRecords, result.Value...) } } @@ -757,7 +561,9 @@ func listSqlDatabaseVulnerabilityAssessmentScans(ctx context.Context, d *plugin. //// TRANSFORM FUNCTION func idToServerName(ctx context.Context, d *transform.TransformData) (interface{}, error) { - data := d.HydrateItem.(sql.Database) - serverName := strings.Split(string(*data.ID), "/")[8] - return serverName, nil + if d.HydrateItem != nil { + item := d.HydrateItem.(armsql.Database) + return strings.Split(*item.ID, "/")[8], nil + } + return nil, nil } diff --git a/azure/table_azure_sql_server.go b/azure/table_azure_sql_server.go index 6a282c6d..cfc1862e 100644 --- a/azure/table_azure_sql_server.go +++ b/azure/table_azure_sql_server.go @@ -8,8 +8,7 @@ import ( "github.com/turbot/steampipe-plugin-sdk/v5/plugin" "github.com/turbot/steampipe-plugin-sdk/v5/plugin/transform" - "github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2017-03-01-preview/sql" - sqlv3 "github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/v3.0/sql" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/sql/armsql" ) //// TABLE DEFINITION @@ -49,7 +48,7 @@ func tableAzureSQLServer(_ context.Context) *plugin.Table { Name: "state", Description: "The state of the server.", Type: proto.ColumnType_STRING, - Transform: transform.FromField("ServerProperties.State"), + Transform: transform.FromField("Properties.State"), }, { Name: "kind", @@ -65,37 +64,37 @@ func tableAzureSQLServer(_ context.Context) *plugin.Table { Name: "administrator_login", Description: "Specifies the username of the administrator for this server.", Type: proto.ColumnType_STRING, - Transform: transform.FromField("ServerProperties.AdministratorLogin"), + Transform: transform.FromField("Properties.AdministratorLogin"), }, { Name: "administrator_login_password", Description: "The administrator login password.", Type: proto.ColumnType_STRING, - Transform: transform.FromField("ServerProperties.AdministratorLoginPassword"), + Transform: transform.FromField("Properties.AdministratorLoginPassword"), }, { Name: "minimal_tls_version", Description: "Minimal TLS version. Allowed values: '1.0', '1.1', '1.2'.", Type: proto.ColumnType_STRING, - Transform: transform.FromField("ServerProperties.MinimalTLSVersion"), + Transform: transform.FromField("Properties.MinimalTLSVersion"), }, { Name: "public_network_access", Description: "Whether or not public endpoint access is allowed for this server.", Type: proto.ColumnType_STRING, - Transform: transform.FromField("ServerProperties.PublicNetworkAccess"), + Transform: transform.FromField("Properties.PublicNetworkAccess"), }, { Name: "version", Description: "The version of the server.", Type: proto.ColumnType_STRING, - Transform: transform.FromField("ServerProperties.Version"), + Transform: transform.FromField("Properties.Version"), }, { Name: "fully_qualified_domain_name", Description: "The fully qualified domain name of the server.", Type: proto.ColumnType_STRING, - Transform: transform.FromField("ServerProperties.FullyQualifiedDomainName"), + Transform: transform.FromField("Properties.FullyQualifiedDomainName"), }, { Name: "server_audit_policy", @@ -159,13 +158,6 @@ func tableAzureSQLServer(_ context.Context) *plugin.Table { Hydrate: listSQLServerVirtualNetworkRules, Transform: transform.FromValue(), }, - { - Name: "audit_policy", - Description: "The SQL server blob auditing policy.", - Type: proto.ColumnType_JSON, - Hydrate: getSQLServerBlobAuditingPolicies, - Transform: transform.FromValue(), - }, // Steampipe standard columns { @@ -203,48 +195,30 @@ func tableAzureSQLServer(_ context.Context) *plugin.Table { } } -type PrivateConnectionInfo struct { - PrivateEndpointConnectionId string - PrivateEndpointId string - PrivateEndpointConnectionName string - PrivateEndpointConnectionType string - PrivateLinkServiceConnectionStateStatus string - PrivateLinkServiceConnectionStateDescription string - PrivateLinkServiceConnectionStateActionsRequired string - ProvisioningState string -} - //// LIST FUNCTION func listSQLServer(ctx context.Context, d *plugin.QueryData, _ *plugin.HydrateData) (interface{}, error) { - session, err := GetNewSession(ctx, d, "MANAGEMENT") + session, err := GetNewSessionUpdated(ctx, d) if err != nil { + plugin.Logger(ctx).Error("azure_sql_server.listSQLServer", "session_error", err) return nil, err } - subscriptionID := session.SubscriptionID - client := sqlv3.NewServersClientWithBaseURI(session.ResourceManagerEndpoint, subscriptionID) - client.Authorizer = session.Authorizer - - result, err := client.List(ctx) + client, err := armsql.NewServersClient(session.SubscriptionID, session.Cred, session.ClientOptions) if err != nil { + plugin.Logger(ctx).Error("azure_sql_server.listSQLServer", "client_error", err) return nil, err } - for _, server := range result.Values() { - d.StreamListItem(ctx, server) - // Check if context has been cancelled or if the limit has been hit (if specified) - // if there is a limit, it will return the number of rows required to reach this limit - if d.RowsRemaining(ctx) == 0 { - return nil, nil - } - } - for result.NotDone() { - err = result.NextWithContext(ctx) + pager := client.NewListPager(nil) + for pager.More() { + result, err := pager.NextPage(ctx) if err != nil { + plugin.Logger(ctx).Error("azure_sql_server.listSQLServer", "api_error", err) return nil, err } - for _, server := range result.Values() { - d.StreamListItem(ctx, server) + for _, server := range result.Value { + d.StreamListItem(ctx, *server) + // Check if context has been cancelled or if the limit has been hit (if specified) // if there is a limit, it will return the number of rows required to reach this limit if d.RowsRemaining(ctx) == 0 { @@ -252,6 +226,7 @@ func listSQLServer(ctx context.Context, d *plugin.QueryData, _ *plugin.HydrateDa } } } + return nil, err } @@ -260,27 +235,35 @@ func listSQLServer(ctx context.Context, d *plugin.QueryData, _ *plugin.HydrateDa func getSQLServer(ctx context.Context, d *plugin.QueryData, h *plugin.HydrateData) (interface{}, error) { plugin.Logger(ctx).Trace("getSQLServer") - name := d.EqualsQuals["name"].GetStringValue() - resourceGroup := d.EqualsQuals["resource_group"].GetStringValue() + name := d.EqualsQualString("name") + resourceGroup := d.EqualsQualString("resource_group") + + // check if name or resourceGroup is nil + if name == "" || resourceGroup == "" { + return nil, nil + } - session, err := GetNewSession(ctx, d, "MANAGEMENT") + session, err := GetNewSessionUpdated(ctx, d) if err != nil { + plugin.Logger(ctx).Error("azure_sql_server.getSQLServer", "session_error", err) + return nil, err + } + client, err := armsql.NewServersClient(session.SubscriptionID, session.Cred, session.ClientOptions) + if err != nil { + plugin.Logger(ctx).Error("azure_sql_server.getSQLServer", "client_error", err) return nil, err } - subscriptionID := session.SubscriptionID - - client := sqlv3.NewServersClientWithBaseURI(session.ResourceManagerEndpoint, subscriptionID) - client.Authorizer = session.Authorizer - op, err := client.Get(ctx, resourceGroup, name) + op, err := client.Get(ctx, resourceGroup, name, nil) if err != nil { + plugin.Logger(ctx).Error("azure_sql_server.getSQLServer", "api_error", err) return nil, err } // In some cases resource does not give any notFound error // instead of notFound error, it returns empty data if op.ID != nil { - return op, nil + return op.Server, nil } return nil, nil @@ -288,344 +271,155 @@ func getSQLServer(ctx context.Context, d *plugin.QueryData, h *plugin.HydrateDat func getSQLServerAuditPolicy(ctx context.Context, d *plugin.QueryData, h *plugin.HydrateData) (interface{}, error) { plugin.Logger(ctx).Trace("getSQLServerAuditPolicy") - server := h.Item.(sqlv3.Server) - session, err := GetNewSession(ctx, d, "MANAGEMENT") + server := h.Item.(armsql.Server) + serverName := *server.Name + resourceGroupName := strings.Split(string(*server.ID), "/")[4] + + session, err := GetNewSessionUpdated(ctx, d) if err != nil { + plugin.Logger(ctx).Error("azure_sql_server.getSQLServerAuditPolicy", "session_error", err) return nil, err } - subscriptionID := session.SubscriptionID - resourceGroupName := strings.Split(string(*server.ID), "/")[4] - - client := sql.NewServerBlobAuditingPoliciesClientWithBaseURI(session.ResourceManagerEndpoint, subscriptionID) - client.Authorizer = session.Authorizer - - op, err := client.ListByServer(ctx, resourceGroupName, *server.Name) + client, err := armsql.NewServerBlobAuditingPoliciesClient(session.SubscriptionID, session.Cred, session.ClientOptions) if err != nil { + plugin.Logger(ctx).Error("azure_sql_server.getSQLServerAuditPolicy", "client_error", err) return nil, err } - // If we return the API response directly, the output only gives - // the contents of ServerBlobAuditingPolicyProperties - var auditPolicies []map[string]interface{} - for _, i := range op.Values() { - objectMap := make(map[string]interface{}) - if i.ID != nil { - objectMap["id"] = i.ID - } - if i.Name != nil { - objectMap["name"] = i.Name - } - if i.Type != nil { - objectMap["type"] = i.Type - } - if i.ServerBlobAuditingPolicyProperties != nil { - objectMap["properties"] = i.ServerBlobAuditingPolicyProperties + var auditPolicies []*armsql.ServerBlobAuditingPolicy + pager := client.NewListByServerPager(resourceGroupName, serverName, nil) + for pager.More() { + result, err := pager.NextPage(ctx) + if err != nil { + plugin.Logger(ctx).Error("azure_sql_server.getSQLServerAuditPolicy", "api_error", err) + return nil, err } - auditPolicies = append(auditPolicies, objectMap) + auditPolicies = append(auditPolicies, result.Value...) } + return auditPolicies, nil } func listSQLServerPrivateEndpointConnections(ctx context.Context, d *plugin.QueryData, h *plugin.HydrateData) (interface{}, error) { plugin.Logger(ctx).Trace("listSQLServerPrivateEndpointConnections") - server := h.Item.(sqlv3.Server) + server := h.Item.(armsql.Server) + serverName := *server.Name + resourceGroupName := strings.Split(string(*server.ID), "/")[4] - session, err := GetNewSession(ctx, d, "MANAGEMENT") + session, err := GetNewSessionUpdated(ctx, d) if err != nil { + plugin.Logger(ctx).Error("azure_sql_server.listSQLServerPrivateEndpointConnections", "session_error", err) return nil, err } - subscriptionID := session.SubscriptionID - resourceGroupName := strings.Split(string(*server.ID), "/")[4] - - client := sqlv3.NewPrivateEndpointConnectionsClientWithBaseURI(session.ResourceManagerEndpoint, subscriptionID) - client.Authorizer = session.Authorizer - - op, err := client.ListByServer(ctx, resourceGroupName, *server.Name) + client, err := armsql.NewPrivateEndpointConnectionsClient(session.SubscriptionID, session.Cred, session.ClientOptions) if err != nil { - plugin.Logger(ctx).Error("listSQLServerPrivateEndpointConnections", "ListByServer", err) + plugin.Logger(ctx).Error("azure_sql_server.listSQLServerPrivateEndpointConnections", "client_error", err) return nil, err } - var privateEndpointConnections []PrivateConnectionInfo - var connection PrivateConnectionInfo - - for _, conn := range op.Values() { - connection = privateEndpointConnectionMap(conn) - privateEndpointConnections = append(privateEndpointConnections, connection) - } - - for op.NotDone() { - err = op.NextWithContext(ctx) + var privateEndpointConnections []*armsql.PrivateEndpointConnection + pager := client.NewListByServerPager(resourceGroupName, serverName, nil) + for pager.More() { + result, err := pager.NextPage(ctx) if err != nil { - plugin.Logger(ctx).Error("listSQLServerPrivateEndpointConnections", "ListByServer_pagination", err) + plugin.Logger(ctx).Error("azure_sql_server.listSQLServerPrivateEndpointConnections", "api_error", err) return nil, err } - for _, conn := range op.Values() { - connection = privateEndpointConnectionMap(conn) - privateEndpointConnections = append(privateEndpointConnections, connection) - } + privateEndpointConnections = append(privateEndpointConnections, result.Value...) } + return privateEndpointConnections, nil } func getSQLServerSecurityAlertPolicy(ctx context.Context, d *plugin.QueryData, h *plugin.HydrateData) (interface{}, error) { plugin.Logger(ctx).Trace("getSQLServerSecurityAlertPolicy") - server := h.Item.(sqlv3.Server) - - session, err := GetNewSession(ctx, d, "MANAGEMENT") - if err != nil { - return nil, err - } - subscriptionID := session.SubscriptionID + server := h.Item.(armsql.Server) + serverName := *server.Name resourceGroupName := strings.Split(string(*server.ID), "/")[4] - client := sql.NewServerSecurityAlertPoliciesClientWithBaseURI(session.ResourceManagerEndpoint, subscriptionID) - client.Authorizer = session.Authorizer - - op, err := client.ListByServer(ctx, resourceGroupName, *server.Name) + session, err := GetNewSessionUpdated(ctx, d) if err != nil { + plugin.Logger(ctx).Error("azure_sql_server.getSQLServerSecurityAlertPolicy", "session_error", err) return nil, err } - - // If we return the API response directly, the output only gives - // the contents of SecurityAlertPolicyProperties - var securityAlertPolicies []map[string]interface{} - for _, i := range op.Values() { - objectMap := make(map[string]interface{}) - if i.ID != nil { - objectMap["id"] = i.ID - } - if i.Name != nil { - objectMap["name"] = i.Name - } - if i.Type != nil { - objectMap["type"] = i.Type - } - if i.SecurityAlertPolicyProperties != nil { - objectMap["properties"] = i.SecurityAlertPolicyProperties - } - securityAlertPolicies = append(securityAlertPolicies, objectMap) - } - return securityAlertPolicies, nil -} - -func getSQLServerBlobAuditingPolicies(ctx context.Context, d *plugin.QueryData, h *plugin.HydrateData) (interface{}, error) { - - server := h.Item.(sqlv3.Server) - - session, err := GetNewSession(ctx, d, "MANAGEMENT") - if err != nil { - return nil, err - } - subscriptionID := session.SubscriptionID - resourceGroupName := strings.Split(string(*server.ID), "/")[4] - - client := sql.NewServerBlobAuditingPoliciesClientWithBaseURI(session.ResourceManagerEndpoint, subscriptionID) - client.Authorizer = session.Authorizer - - op, err := client.ListByServer(ctx, resourceGroupName, *server.Name) + client, err := armsql.NewServerSecurityAlertPoliciesClient(session.SubscriptionID, session.Cred, session.ClientOptions) if err != nil { + plugin.Logger(ctx).Error("azure_sql_server.getSQLServerSecurityAlertPolicy", "client_error", err) return nil, err } - var blobPolicies []map[string]interface{} - for _, i := range op.Values() { - objectMap := make(map[string]interface{}) - if i.ID != nil { - objectMap["id"] = i.ID - } - if i.Name != nil { - objectMap["name"] = i.Name - } - if i.Type != nil { - objectMap["type"] = i.Type - } - if i.ServerBlobAuditingPolicyProperties != nil { - obMap := make(map[string]interface{}) - if i.ServerBlobAuditingPolicyProperties.RetentionDays != nil { - obMap["retentionDays"] = i.ServerBlobAuditingPolicyProperties.RetentionDays - } - if i.ServerBlobAuditingPolicyProperties.AuditActionsAndGroups != nil { - obMap["AuditActionsAndGroups"] = i.ServerBlobAuditingPolicyProperties.AuditActionsAndGroups - } - if i.ServerBlobAuditingPolicyProperties.IsAzureMonitorTargetEnabled != nil { - obMap["isAzureMonitorTargetEnabled"] = i.ServerBlobAuditingPolicyProperties.IsAzureMonitorTargetEnabled - } - if i.ServerBlobAuditingPolicyProperties.IsStorageSecondaryKeyInUse != nil { - obMap["isStorageSecondaryKeyInUse"] = i.ServerBlobAuditingPolicyProperties.IsStorageSecondaryKeyInUse - } - if i.ServerBlobAuditingPolicyProperties.QueueDelayMs != nil { - obMap["queueDelayMs"] = i.ServerBlobAuditingPolicyProperties.QueueDelayMs - } - if i.ServerBlobAuditingPolicyProperties.State != "" { - obMap["state"] = i.ServerBlobAuditingPolicyProperties.State - } - if i.ServerBlobAuditingPolicyProperties.StorageEndpoint != nil { - obMap["storageEndpoint"] = i.ServerBlobAuditingPolicyProperties.StorageEndpoint - } - if i.ServerBlobAuditingPolicyProperties.StorageAccountAccessKey != nil { - obMap["storageAccountAccessKey"] = i.ServerBlobAuditingPolicyProperties.StorageAccountAccessKey - } - if i.ServerBlobAuditingPolicyProperties.StorageAccountSubscriptionID != nil { - obMap["storageAccountSubscriptionID"] = i.ServerBlobAuditingPolicyProperties.StorageAccountSubscriptionID - } - objectMap["serverBlobAuditingPolicyProperties"] = obMap - } - - blobPolicies = append(blobPolicies, objectMap) - } - - if op.NotDone() { - for _, i := range op.Values() { - objectMap := make(map[string]interface{}) - if i.ID != nil { - objectMap["id"] = i.ID - } - if i.Name != nil { - objectMap["name"] = i.Name - } - if i.Type != nil { - objectMap["type"] = i.Type - } - if i.ServerBlobAuditingPolicyProperties != nil { - obMap := make(map[string]interface{}) - if i.ServerBlobAuditingPolicyProperties.RetentionDays != nil { - obMap["retentionDays"] = i.ServerBlobAuditingPolicyProperties.RetentionDays - } - if i.ServerBlobAuditingPolicyProperties.AuditActionsAndGroups != nil { - obMap["AuditActionsAndGroups"] = i.ServerBlobAuditingPolicyProperties.AuditActionsAndGroups - } - if i.ServerBlobAuditingPolicyProperties.IsAzureMonitorTargetEnabled != nil { - obMap["isAzureMonitorTargetEnabled"] = i.ServerBlobAuditingPolicyProperties.IsAzureMonitorTargetEnabled - } - if i.ServerBlobAuditingPolicyProperties.IsStorageSecondaryKeyInUse != nil { - obMap["isStorageSecondaryKeyInUse"] = i.ServerBlobAuditingPolicyProperties.IsStorageSecondaryKeyInUse - } - if i.ServerBlobAuditingPolicyProperties.QueueDelayMs != nil { - obMap["queueDelayMs"] = i.ServerBlobAuditingPolicyProperties.QueueDelayMs - } - if i.ServerBlobAuditingPolicyProperties.State != "" { - obMap["state"] = i.ServerBlobAuditingPolicyProperties.State - } - if i.ServerBlobAuditingPolicyProperties.StorageEndpoint != nil { - obMap["storageEndpoint"] = i.ServerBlobAuditingPolicyProperties.StorageEndpoint - } - if i.ServerBlobAuditingPolicyProperties.StorageAccountAccessKey != nil { - obMap["storageAccountAccessKey"] = i.ServerBlobAuditingPolicyProperties.StorageAccountAccessKey - } - if i.ServerBlobAuditingPolicyProperties.StorageAccountSubscriptionID != nil { - obMap["storageAccountSubscriptionID"] = i.ServerBlobAuditingPolicyProperties.StorageAccountSubscriptionID - } - objectMap["serverBlobAuditingPolicyProperties"] = obMap - } - - blobPolicies = append(blobPolicies, objectMap) + var securityAlertPolicies []*armsql.ServerSecurityAlertPolicy + pager := client.NewListByServerPager(resourceGroupName, serverName, nil) + for pager.More() { + result, err := pager.NextPage(ctx) + if err != nil { + plugin.Logger(ctx).Error("azure_sql_server.getSQLServerSecurityAlertPolicy", "api_error", err) + return nil, err } + securityAlertPolicies = append(securityAlertPolicies, result.Value...) } - return blobPolicies, nil + return securityAlertPolicies, nil } func getSQLServerAzureADAdministrator(ctx context.Context, d *plugin.QueryData, h *plugin.HydrateData) (interface{}, error) { plugin.Logger(ctx).Trace("getSQLServerAzureADAdministrator") - server := h.Item.(sqlv3.Server) + server := h.Item.(armsql.Server) + serverName := *server.Name + resourceGroupName := strings.Split(string(*server.ID), "/")[4] - session, err := GetNewSession(ctx, d, "MANAGEMENT") + session, err := GetNewSessionUpdated(ctx, d) if err != nil { + plugin.Logger(ctx).Error("azure_sql_server.getSQLServerAzureADAdministrator", "session_error", err) return nil, err } - subscriptionID := session.SubscriptionID - resourceGroupName := strings.Split(string(*server.ID), "/")[4] - - client := sql.NewServerAzureADAdministratorsClientWithBaseURI(session.ResourceManagerEndpoint, subscriptionID) - client.Authorizer = session.Authorizer - - op, err := client.ListByServer(ctx, resourceGroupName, *server.Name) + client, err := armsql.NewServerAzureADAdministratorsClient(session.SubscriptionID, session.Cred, session.ClientOptions) if err != nil { - if strings.Contains(err.Error(), "NotFound") { - return nil, nil - } + plugin.Logger(ctx).Error("azure_sql_server.getSQLServerAzureADAdministrator", "client_error", err) return nil, err } - // If we return the API response directly, the output only gives - // the contents of ServerAdministratorProperties - var serverAdministrators []map[string]interface{} - for _, i := range *op.Value { - objectMap := make(map[string]interface{}) - if i.ID != nil { - objectMap["id"] = i.ID - } - if i.Name != nil { - objectMap["name"] = i.Name - } - if i.Type != nil { - objectMap["type"] = i.Type - } - if i.ServerAdministratorProperties != nil { - objectMap["properties"] = i.ServerAdministratorProperties + var serverAdministrators []*armsql.ServerAzureADAdministrator + pager := client.NewListByServerPager(resourceGroupName, serverName, nil) + for pager.More() { + result, err := pager.NextPage(ctx) + if err != nil { + plugin.Logger(ctx).Error("azure_sql_server.getSQLServerAzureADAdministrator", "api_error", err) + return nil, err } - serverAdministrators = append(serverAdministrators, objectMap) + serverAdministrators = append(serverAdministrators, result.Value...) } + return serverAdministrators, nil } func getSQLServerEncryptionProtector(ctx context.Context, d *plugin.QueryData, h *plugin.HydrateData) (interface{}, error) { plugin.Logger(ctx).Trace("getSQLServerEncryptionProtector") - server := h.Item.(sqlv3.Server) + server := h.Item.(armsql.Server) + serverName := *server.Name + resourceGroupName := strings.Split(string(*server.ID), "/")[4] - session, err := GetNewSession(ctx, d, "MANAGEMENT") + session, err := GetNewSessionUpdated(ctx, d) if err != nil { + plugin.Logger(ctx).Error("azure_sql_server.getSQLServerEncryptionProtector", "session_error", err) return nil, err } - subscriptionID := session.SubscriptionID - resourceGroupName := strings.Split(string(*server.ID), "/")[4] - - client := sql.NewEncryptionProtectorsClientWithBaseURI(session.ResourceManagerEndpoint, subscriptionID) - client.Authorizer = session.Authorizer - - op, err := client.ListByServer(ctx, resourceGroupName, *server.Name) + client, err := armsql.NewEncryptionProtectorsClient(session.SubscriptionID, session.Cred, session.ClientOptions) if err != nil { + plugin.Logger(ctx).Error("azure_sql_server.getSQLServerEncryptionProtector", "client_error", err) return nil, err } - // If we return the API response directly, the output only gives - // the contents of EncryptionProtectorProperties - var encryptionProtectors []map[string]interface{} - for _, i := range op.Values() { - objectMap := make(map[string]interface{}) - if i.ID != nil { - objectMap["id"] = i.ID - } - if i.Name != nil { - objectMap["name"] = i.Name - } - if i.Type != nil { - objectMap["type"] = i.Type - } - if i.Location != nil { - objectMap["location"] = i.Location - } - if i.Kind != nil { - objectMap["kind"] = i.Kind - } - if i.Subregion != nil { - objectMap["subregion"] = i.Subregion - } - if i.ServerKeyName != nil { - objectMap["serverKeyName"] = i.ServerKeyName - } - if i.ServerKeyType != "" { - objectMap["serverKeyType"] = i.ServerKeyType - } - if i.URI != nil { - objectMap["uri"] = i.URI - } - if i.Thumbprint != nil { - objectMap["thumbprint"] = i.Thumbprint + var encryptionProtectors []*armsql.EncryptionProtector + pager := client.NewListByServerPager(resourceGroupName, serverName, nil) + for pager.More() { + result, err := pager.NextPage(ctx) + if err != nil { + plugin.Logger(ctx).Error("azure_sql_server.getSQLServerEncryptionProtector", "api_error", err) + return nil, err } - encryptionProtectors = append(encryptionProtectors, objectMap) + encryptionProtectors = append(encryptionProtectors, result.Value...) } return encryptionProtectors, nil @@ -633,82 +427,61 @@ func getSQLServerEncryptionProtector(ctx context.Context, d *plugin.QueryData, h func getSQLServerVulnerabilityAssessment(ctx context.Context, d *plugin.QueryData, h *plugin.HydrateData) (interface{}, error) { plugin.Logger(ctx).Trace("getSQLServerVulnerabilityAssessment") - server := h.Item.(sqlv3.Server) + server := h.Item.(armsql.Server) + serverName := *server.Name + resourceGroupName := strings.Split(string(*server.ID), "/")[4] - session, err := GetNewSession(ctx, d, "MANAGEMENT") + session, err := GetNewSessionUpdated(ctx, d) if err != nil { + plugin.Logger(ctx).Error("azure_sql_server.getSQLServerVulnerabilityAssessment", "session_error", err) return nil, err } - subscriptionID := session.SubscriptionID - resourceGroupName := strings.Split(string(*server.ID), "/")[4] - - client := sqlv3.NewServerVulnerabilityAssessmentsClientWithBaseURI(session.ResourceManagerEndpoint, subscriptionID) - client.Authorizer = session.Authorizer - - op, err := client.ListByServer(ctx, resourceGroupName, *server.Name) + client, err := armsql.NewServerVulnerabilityAssessmentsClient(session.SubscriptionID, session.Cred, session.ClientOptions) if err != nil { + plugin.Logger(ctx).Error("azure_sql_server.getSQLServerVulnerabilityAssessment", "client_error", err) return nil, err } - // If we return the API response directly, the output only gives - // the contents of ServerVulnerabilityAssessmentProperties - var vulnerabilityAssessments []map[string]interface{} - for _, i := range op.Values() { - objectMap := make(map[string]interface{}) - if i.ID != nil { - objectMap["id"] = i.ID - } - if i.Name != nil { - objectMap["name"] = i.Name - } - if i.Type != nil { - objectMap["type"] = i.Type - } - if i.ServerVulnerabilityAssessmentProperties != nil { - objectMap["properties"] = i.ServerVulnerabilityAssessmentProperties + var vulnerabilityAssessments []*armsql.ServerVulnerabilityAssessment + pager := client.NewListByServerPager(resourceGroupName, serverName, nil) + for pager.More() { + result, err := pager.NextPage(ctx) + if err != nil { + plugin.Logger(ctx).Error("azure_sql_server.getSQLServerVulnerabilityAssessment", "api_error", err) + return nil, err } - vulnerabilityAssessments = append(vulnerabilityAssessments, objectMap) + vulnerabilityAssessments = append(vulnerabilityAssessments, result.Value...) } + return vulnerabilityAssessments, nil } func listSQLServerFirewallRules(ctx context.Context, d *plugin.QueryData, h *plugin.HydrateData) (interface{}, error) { plugin.Logger(ctx).Trace("listSQLServerFirewallRules") - server := h.Item.(sqlv3.Server) + server := h.Item.(armsql.Server) + serverName := *server.Name + resourceGroupName := strings.Split(string(*server.ID), "/")[4] - session, err := GetNewSession(ctx, d, "MANAGEMENT") + session, err := GetNewSessionUpdated(ctx, d) if err != nil { + plugin.Logger(ctx).Error("azure_sql_server.listSQLServerFirewallRules", "session_error", err) return nil, err } - subscriptionID := session.SubscriptionID - resourceGroupName := strings.Split(string(*server.ID), "/")[4] - - client := sql.NewFirewallRulesClientWithBaseURI(session.ResourceManagerEndpoint, subscriptionID) - client.Authorizer = session.Authorizer - - op, err := client.ListByServer(ctx, resourceGroupName, *server.Name) + client, err := armsql.NewFirewallRulesClient(session.SubscriptionID, session.Cred, session.ClientOptions) if err != nil { + plugin.Logger(ctx).Error("azure_sql_server.listSQLServerFirewallRules", "client_error", err) return nil, err } - // If we return the API response directly, the output only gives - // the contents of FirewallRuleProperties - var firewallRules []map[string]interface{} - for _, i := range *op.Value { - objectMap := make(map[string]interface{}) - if i.ID != nil { - objectMap["id"] = i.ID - } - if i.Name != nil { - objectMap["name"] = i.Name - } - if i.Type != nil { - objectMap["type"] = i.Type - } - if i.FirewallRuleProperties != nil { - objectMap["properties"] = i.FirewallRuleProperties + var firewallRules []*armsql.FirewallRule + pager := client.NewListByServerPager(resourceGroupName, serverName, nil) + for pager.More() { + result, err := pager.NextPage(ctx) + if err != nil { + plugin.Logger(ctx).Error("azure_sql_server.listSQLServerFirewallRules", "api_error", err) + return nil, err } - firewallRules = append(firewallRules, objectMap) + firewallRules = append(firewallRules, result.Value...) } return firewallRules, nil @@ -716,93 +489,31 @@ func listSQLServerFirewallRules(ctx context.Context, d *plugin.QueryData, h *plu func listSQLServerVirtualNetworkRules(ctx context.Context, d *plugin.QueryData, h *plugin.HydrateData) (interface{}, error) { plugin.Logger(ctx).Trace("listSQLServerVirtualNetworkRules") - server := h.Item.(sqlv3.Server) + server := h.Item.(armsql.Server) + serverName := *server.Name + resourceGroupName := strings.Split(string(*server.ID), "/")[4] - session, err := GetNewSession(ctx, d, "MANAGEMENT") + session, err := GetNewSessionUpdated(ctx, d) if err != nil { + plugin.Logger(ctx).Error("azure_sql_server.listSQLServerVirtualNetworkRules", "session_error", err) return nil, err } - subscriptionID := session.SubscriptionID - resourceGroupName := strings.Split(string(*server.ID), "/")[4] - - client := sql.NewVirtualNetworkRulesClientWithBaseURI(session.ResourceManagerEndpoint, subscriptionID) - client.Authorizer = session.Authorizer - - // If we return the API response directly, the output only gives - // the contents of VirtualNetworkRuleProperties - var NetworkRules []map[string]interface{} - result, err := client.ListByServer(ctx, resourceGroupName, *server.Name) + client, err := armsql.NewVirtualNetworkRulesClient(session.SubscriptionID, session.Cred, session.ClientOptions) if err != nil { + plugin.Logger(ctx).Error("azure_sql_server.listSQLServerVirtualNetworkRules", "client_error", err) return nil, err } - for _, networkRule := range result.Values() { - NetworkRules = append(NetworkRules, networkRuleMap(networkRule)) - } - for result.NotDone() { - err := result.NextWithContext(ctx) + var networkRules []*armsql.VirtualNetworkRule + pager := client.NewListByServerPager(resourceGroupName, serverName, nil) + for pager.More() { + result, err := pager.NextPage(ctx) if err != nil { + plugin.Logger(ctx).Error("azure_sql_server.listSQLServerVirtualNetworkRules", "api_error", err) return nil, err } - for _, networkRule := range result.Values() { - NetworkRules = append(NetworkRules, networkRuleMap(networkRule)) - } - } - - return NetworkRules, nil -} - -func networkRuleMap(rule sql.VirtualNetworkRule) map[string]interface{} { - objectMap := make(map[string]interface{}) - if rule.ID != nil { - objectMap["id"] = rule.ID - } - if rule.Name != nil { - objectMap["name"] = rule.Name - } - if rule.Type != nil { - objectMap["type"] = rule.Type - } - if rule.VirtualNetworkRuleProperties != nil { - objectMap["properties"] = rule.VirtualNetworkRuleProperties - } - return objectMap -} - -// If we return the API response directly, the output will not give -// all the contents of PrivateEndpointConnection -func privateEndpointConnectionMap(conn sqlv3.PrivateEndpointConnection) PrivateConnectionInfo { - var connection PrivateConnectionInfo - if conn.ID != nil { - connection.PrivateEndpointConnectionId = *conn.ID - } - if conn.Name != nil { - connection.PrivateEndpointConnectionName = *conn.Name - } - if conn.Type != nil { - connection.PrivateEndpointConnectionType = *conn.Type - } - if conn.PrivateEndpointConnectionProperties != nil { - if conn.PrivateEndpoint != nil { - if conn.PrivateEndpoint.ID != nil { - connection.PrivateEndpointId = *conn.PrivateEndpoint.ID - } - } - if conn.PrivateLinkServiceConnectionState != nil { - if conn.PrivateLinkServiceConnectionState.ActionsRequired != "" { - connection.PrivateLinkServiceConnectionStateActionsRequired = string(conn.PrivateLinkServiceConnectionState.ActionsRequired) - } - if conn.PrivateLinkServiceConnectionState.Status != "" { - connection.PrivateLinkServiceConnectionStateStatus = string(conn.PrivateLinkServiceConnectionState.Status) - } - if conn.PrivateLinkServiceConnectionState.Description != nil { - connection.PrivateLinkServiceConnectionStateDescription = *conn.PrivateLinkServiceConnectionState.Description - } - } - if conn.ProvisioningState != "" { - connection.ProvisioningState = string(conn.ProvisioningState) - } + networkRules = append(networkRules, result.Value...) } - return connection + return networkRules, nil } diff --git a/azure/table_azure_storage_account.go b/azure/table_azure_storage_account.go index f87722c1..f8423750 100644 --- a/azure/table_azure_storage_account.go +++ b/azure/table_azure_storage_account.go @@ -4,9 +4,10 @@ import ( "context" "strings" - "github.com/Azure/azure-sdk-for-go/profiles/2020-09-01/monitor/mgmt/insights" + "github.com/Azure/azure-sdk-for-go/profiles/latest/storage/mgmt/storage" + "github.com/Azure/azure-sdk-for-go/profiles/preview/preview/monitor/mgmt/insights" "github.com/Azure/azure-sdk-for-go/sdk/data/aztables" - "github.com/Azure/azure-sdk-for-go/services/storage/mgmt/2019-06-01/storage" + "github.com/Azure/go-autorest/autorest" "github.com/tombuildsstuff/giovanni/storage/2018-11-09/queue/queues" "github.com/tombuildsstuff/giovanni/storage/2019-12-12/blob/accounts" diff --git a/azure/table_azure_storage_blob.go b/azure/table_azure_storage_blob.go index d386a9f5..49fcbc16 100644 --- a/azure/table_azure_storage_blob.go +++ b/azure/table_azure_storage_blob.go @@ -11,7 +11,7 @@ import ( "github.com/turbot/steampipe-plugin-sdk/v5/plugin" "github.com/turbot/steampipe-plugin-sdk/v5/plugin/transform" - "github.com/Azure/azure-sdk-for-go/services/storage/mgmt/2019-06-01/storage" + "github.com/Azure/azure-sdk-for-go/profiles/latest/storage/mgmt/storage" "github.com/Azure/azure-storage-blob-go/azblob" ) diff --git a/azure/table_azure_storage_blob_service.go b/azure/table_azure_storage_blob_service.go index 2c0f3cc9..f31c99c7 100644 --- a/azure/table_azure_storage_blob_service.go +++ b/azure/table_azure_storage_blob_service.go @@ -3,7 +3,7 @@ package azure import ( "context" - "github.com/Azure/azure-sdk-for-go/services/storage/mgmt/2019-06-01/storage" + "github.com/Azure/azure-sdk-for-go/profiles/latest/storage/mgmt/storage" "github.com/turbot/steampipe-plugin-sdk/v5/grpc/proto" "github.com/turbot/steampipe-plugin-sdk/v5/plugin/transform" diff --git a/azure/table_azure_storage_container.go b/azure/table_azure_storage_container.go index 3681470e..92517161 100644 --- a/azure/table_azure_storage_container.go +++ b/azure/table_azure_storage_container.go @@ -9,7 +9,7 @@ import ( "github.com/turbot/steampipe-plugin-sdk/v5/plugin" "github.com/turbot/steampipe-plugin-sdk/v5/plugin/transform" - "github.com/Azure/azure-sdk-for-go/services/storage/mgmt/2019-06-01/storage" + "github.com/Azure/azure-sdk-for-go/profiles/latest/storage/mgmt/storage" ) //// TABLE DEFINITION diff --git a/azure/table_azure_storage_queue.go b/azure/table_azure_storage_queue.go index 960dc67a..6ea0a8d2 100644 --- a/azure/table_azure_storage_queue.go +++ b/azure/table_azure_storage_queue.go @@ -4,7 +4,7 @@ import ( "context" "strings" - "github.com/Azure/azure-sdk-for-go/services/storage/mgmt/2019-06-01/storage" + "github.com/Azure/azure-sdk-for-go/profiles/latest/storage/mgmt/storage" "github.com/turbot/steampipe-plugin-sdk/v5/grpc/proto" "github.com/turbot/steampipe-plugin-sdk/v5/plugin/transform" diff --git a/azure/table_azure_storage_share_file.go b/azure/table_azure_storage_share_file.go index ae805b20..d4a6a5b4 100644 --- a/azure/table_azure_storage_share_file.go +++ b/azure/table_azure_storage_share_file.go @@ -4,7 +4,7 @@ import ( "context" "strings" - "github.com/Azure/azure-sdk-for-go/services/storage/mgmt/2019-06-01/storage" + "github.com/Azure/azure-sdk-for-go/profiles/latest/storage/mgmt/storage" "github.com/turbot/go-kit/types" "github.com/turbot/steampipe-plugin-sdk/v5/grpc/proto" "github.com/turbot/steampipe-plugin-sdk/v5/plugin/transform" @@ -273,7 +273,7 @@ func getStorageAccountsFileShare(ctx context.Context, d *plugin.QueryData, h *pl fileShareCLient := storage.NewFileSharesClientWithBaseURI(session.ResourceManagerEndpoint, subscriptionID) fileShareCLient.Authorizer = session.Authorizer - result, err := fileShareCLient.Get(ctx, resourceGroup, storageAccountName, name, "") + result, err := fileShareCLient.Get(ctx, resourceGroup, storageAccountName, name, "", "") if err != nil { return nil, err diff --git a/azure/table_azure_storage_sync.go b/azure/table_azure_storage_sync.go index 25a3eba3..440c1b1b 100644 --- a/azure/table_azure_storage_sync.go +++ b/azure/table_azure_storage_sync.go @@ -3,7 +3,7 @@ package azure import ( "context" - "github.com/Azure/azure-sdk-for-go/services/storagesync/mgmt/2020-03-01/storagesync" + "github.com/Azure/azure-sdk-for-go/profiles/latest/storagesync/mgmt/storagesync" "github.com/turbot/steampipe-plugin-sdk/v5/grpc/proto" "github.com/turbot/steampipe-plugin-sdk/v5/plugin/transform" diff --git a/azure/table_azure_storage_table.go b/azure/table_azure_storage_table.go index 83d0be98..d5a33b74 100644 --- a/azure/table_azure_storage_table.go +++ b/azure/table_azure_storage_table.go @@ -4,7 +4,7 @@ import ( "context" "strings" - "github.com/Azure/azure-sdk-for-go/services/storage/mgmt/2019-06-01/storage" + "github.com/Azure/azure-sdk-for-go/profiles/latest/storage/mgmt/storage" "github.com/turbot/steampipe-plugin-sdk/v5/grpc/proto" "github.com/turbot/steampipe-plugin-sdk/v5/plugin/transform" diff --git a/azure/table_azure_storage_table_service.go b/azure/table_azure_storage_table_service.go index 74f71d43..f84dce1b 100644 --- a/azure/table_azure_storage_table_service.go +++ b/azure/table_azure_storage_table_service.go @@ -3,7 +3,7 @@ package azure import ( "context" - "github.com/Azure/azure-sdk-for-go/services/storage/mgmt/2019-06-01/storage" + "github.com/Azure/azure-sdk-for-go/profiles/latest/storage/mgmt/storage" "github.com/turbot/steampipe-plugin-sdk/v5/grpc/proto" "github.com/turbot/steampipe-plugin-sdk/v5/plugin/transform" diff --git a/azure/table_azure_stream_analytics_job.go b/azure/table_azure_stream_analytics_job.go index 518c067b..c002ba6f 100644 --- a/azure/table_azure_stream_analytics_job.go +++ b/azure/table_azure_stream_analytics_job.go @@ -3,8 +3,8 @@ package azure import ( "context" - "github.com/Azure/azure-sdk-for-go/profiles/2020-09-01/monitor/mgmt/insights" - "github.com/Azure/azure-sdk-for-go/services/streamanalytics/mgmt/2016-03-01/streamanalytics" + "github.com/Azure/azure-sdk-for-go/profiles/latest/streamanalytics/mgmt/streamanalytics" + "github.com/Azure/azure-sdk-for-go/profiles/preview/preview/monitor/mgmt/insights" "github.com/turbot/steampipe-plugin-sdk/v5/grpc/proto" "github.com/turbot/steampipe-plugin-sdk/v5/plugin/transform" diff --git a/azure/table_azure_subnet.go b/azure/table_azure_subnet.go index dd9fc470..3b39b664 100644 --- a/azure/table_azure_subnet.go +++ b/azure/table_azure_subnet.go @@ -5,7 +5,7 @@ import ( "strings" "sync" - "github.com/Azure/azure-sdk-for-go/services/network/mgmt/2020-05-01/network" + "github.com/Azure/azure-sdk-for-go/profiles/latest/network/mgmt/network" "github.com/turbot/steampipe-plugin-sdk/v5/grpc/proto" "github.com/turbot/steampipe-plugin-sdk/v5/plugin/transform" diff --git a/azure/table_azure_subscription.go b/azure/table_azure_subscription.go index d42846e7..dc374737 100644 --- a/azure/table_azure_subscription.go +++ b/azure/table_azure_subscription.go @@ -3,7 +3,7 @@ package azure import ( "context" - "github.com/Azure/azure-sdk-for-go/services/resources/mgmt/2019-06-01/subscriptions" + "github.com/Azure/azure-sdk-for-go/profiles/latest/resources/mgmt/subscriptions" "github.com/turbot/steampipe-plugin-sdk/v5/grpc/proto" "github.com/turbot/steampipe-plugin-sdk/v5/plugin/transform" diff --git a/azure/table_azure_synapse_workspace.go b/azure/table_azure_synapse_workspace.go index 8cb8197e..66ab6f9d 100644 --- a/azure/table_azure_synapse_workspace.go +++ b/azure/table_azure_synapse_workspace.go @@ -4,8 +4,8 @@ import ( "context" "strings" - "github.com/Azure/azure-sdk-for-go/profiles/2020-09-01/monitor/mgmt/insights" - "github.com/Azure/azure-sdk-for-go/services/synapse/mgmt/2021-03-01/synapse" + "github.com/Azure/azure-sdk-for-go/profiles/preview/preview/monitor/mgmt/insights" + "github.com/Azure/azure-sdk-for-go/profiles/latest/synapse/mgmt/synapse" "github.com/turbot/steampipe-plugin-sdk/v5/grpc/proto" "github.com/turbot/steampipe-plugin-sdk/v5/plugin/transform" diff --git a/azure/table_azure_tenant.go b/azure/table_azure_tenant.go index d0cea84a..1a2a7bb3 100644 --- a/azure/table_azure_tenant.go +++ b/azure/table_azure_tenant.go @@ -3,7 +3,7 @@ package azure import ( "context" - "github.com/Azure/azure-sdk-for-go/services/resources/mgmt/2019-06-01/subscriptions" + "github.com/Azure/azure-sdk-for-go/profiles/latest/resources/mgmt/subscriptions" "github.com/turbot/steampipe-plugin-sdk/v5/grpc/proto" "github.com/turbot/steampipe-plugin-sdk/v5/plugin" "github.com/turbot/steampipe-plugin-sdk/v5/plugin/transform" diff --git a/azure/table_azure_virtual_network.go b/azure/table_azure_virtual_network.go index 4d66406c..7002b92c 100644 --- a/azure/table_azure_virtual_network.go +++ b/azure/table_azure_virtual_network.go @@ -3,7 +3,7 @@ package azure import ( "context" - "github.com/Azure/azure-sdk-for-go/services/network/mgmt/2020-05-01/network" + "github.com/Azure/azure-sdk-for-go/profiles/latest/network/mgmt/network" "github.com/turbot/steampipe-plugin-sdk/v5/grpc/proto" "github.com/turbot/steampipe-plugin-sdk/v5/plugin/transform" diff --git a/azure/table_azure_virtual_network_gateway.go b/azure/table_azure_virtual_network_gateway.go index 747cdbd0..abf564d5 100644 --- a/azure/table_azure_virtual_network_gateway.go +++ b/azure/table_azure_virtual_network_gateway.go @@ -5,7 +5,7 @@ import ( "strings" "github.com/Azure/azure-sdk-for-go/profiles/latest/resources/mgmt/resources" - "github.com/Azure/azure-sdk-for-go/services/network/mgmt/2020-05-01/network" + "github.com/Azure/azure-sdk-for-go/profiles/latest/network/mgmt/network" "github.com/turbot/steampipe-plugin-sdk/v5/grpc/proto" "github.com/turbot/steampipe-plugin-sdk/v5/plugin" "github.com/turbot/steampipe-plugin-sdk/v5/plugin/transform" diff --git a/docs/tables/azure_kubernetes_service_version.md b/docs/tables/azure_kubernetes_service_version.md index 2ed76ccb..c24f9064 100644 --- a/docs/tables/azure_kubernetes_service_version.md +++ b/docs/tables/azure_kubernetes_service_version.md @@ -12,20 +12,21 @@ Azure Kubernetes Service (AKS) is a managed container orchestration service prov The `azure_kubernetes_service_version` table provides insights into the different versions of Azure Kubernetes Service available. As a DevOps engineer or system administrator, you can use this table to understand the features, improvements, and fixes associated with each version of the service. This can help in making informed decisions when planning for version upgrades or when troubleshooting issues related to specific versions. **Important notes:** + - You must specify the `location` in the `where` clause to query this table. ## Examples ### Basic info + Discover the segments of Azure's Kubernetes service located in the 'eastus2' region to understand their orchestration types and versions. This can be useful to identify and manage services based on their orchestration details. ```sql+postgres select - name, - id, - type, - orchestrator_type, - orchestrator_version + version, + cloud_environment, + is_preview, + title from azure_kubernetes_service_version where @@ -34,91 +35,52 @@ where ```sql+sqlite select - name, - id, - type, - orchestrator_type, - orchestrator_version + version, + cloud_environment, + is_preview, + title from azure_kubernetes_service_version where location = 'eastus2'; ``` -### List major kubernetes versions -Determine the major versions of Kubernetes orchestration service in the East US 2 region within Azure. This is useful for understanding the available Kubernetes versions in a specific location for planning deployments or upgrades. +### List patch kubernetes versions -```sql+postgres -select - name, - id, - orchestrator_type, - orchestrator_version -from - azure_kubernetes_service_version -where - orchestrator_version = 'major' -and - location = 'eastus2'; -``` - -```sql+sqlite -select - name, - id, - orchestrator_type, - orchestrator_version -from - azure_kubernetes_service_version -where - orchestrator_version = 'major' -and - location = 'eastus2'; -``` - -### List kubernetes orchestrator type -Determine the areas in which Kubernetes is used as the orchestrator type within the Azure Kubernetes Service in the East US 2 region. This can be useful for organizations to assess their use of Kubernetes in specific geographical locations. +Determine the patch versions of Kubernetes orchestration service in the East US 2 region within Azure. This is useful for understanding the available Kubernetes versions in a specific location for planning deployments or upgrades. ```sql+postgres select - name, - id, - type, - orchestrator_type, - is_preview + version, + is_preview, + jsonb_pretty(patch_versions) as patch_versions from azure_kubernetes_service_version where - orchestrator_type = 'Kubernetes' -and location = 'eastus2'; ``` ```sql+sqlite select - name, - id, - type, - orchestrator_type, - is_preview + version, + is_preview, + jsonb(patch_versions) as patch_versions from azure_kubernetes_service_version where - orchestrator_type = 'Kubernetes' -and location = 'eastus2'; ``` ### List kubernetes versions that are not in preview + Determine the versions of Kubernetes in the 'eastus2' location that are fully released and not in a preview stage. This could be useful for organizations planning to use stable versions of Kubernetes for their operations in the specified location. ```sql+postgres select - name, - id, - orchestrator_type, - orchestrator_version, - is_preview + version, + cloud_environment, + is_preview, + title from azure_kubernetes_service_version where @@ -129,11 +91,10 @@ and ```sql+sqlite select - name, - id, - orchestrator_type, - orchestrator_version, - is_preview + version, + cloud_environment, + is_preview, + title from azure_kubernetes_service_version where @@ -142,31 +103,28 @@ and location = 'eastus2'; ``` -### Get upgrade details of each kubernetes version -Determine the upgrade details for each version of Kubernetes within a specific location. This can be useful for planning and managing version upgrades, especially in identifying whether the version is still in preview or fully released. +### Get capabilities of each kubernetes version + +Determine the capabilities for each version of Kubernetes within a specific location. This can be useful for planning and managing version capabilities, especially in identifying whether the version is still in preview or fully released. ```sql+postgres select - name, - u ->> 'orchestratorType' as orchestrator_type, - u ->> 'orchestratorVersion' as orchestrator_version, - u ->> 'isPreview' as is_preview + version, + is_preview, + jsonb_pretty(capabilities) as capabilities from - azure_kubernetes_service_version, - jsonb_array_elements(upgrades) as u + azure_kubernetes_service_version where location = 'eastus2'; ``` ```sql+sqlite select - name, - json_extract(u.value, '$.orchestratorType') as orchestrator_type, - json_extract(u.value, '$.orchestratorVersion') as orchestrator_version, - json_extract(u.value, '$.isPreview') as is_preview + version, + is_preview, + json(capabilities) as capabilities from - azure_kubernetes_service_version, - json_each(upgrades) as u + azure_kubernetes_service_version where location = 'eastus2'; -``` \ No newline at end of file +``` diff --git a/go.mod b/go.mod index 49101b9e..d125d4c1 100644 --- a/go.mod +++ b/go.mod @@ -5,10 +5,13 @@ go 1.21.0 toolchain go1.21.4 require ( - github.com/Azure/azure-sdk-for-go v58.0.0+incompatible - github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.3.1 - github.com/Azure/azure-sdk-for-go/sdk/data/aztables v1.0.1 + github.com/Azure/azure-sdk-for-go v68.0.0+incompatible + github.com/Azure/azure-sdk-for-go/sdk/azcore v1.11.0 + github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.5.2 + github.com/Azure/azure-sdk-for-go/sdk/data/aztables v1.2.0 + github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerservice/armcontainerservice/v4 v4.8.0 github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/v3 v3.0.0 + github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/sql/armsql v1.2.0 github.com/Azure/azure-storage-blob-go v0.12.0 github.com/Azure/go-autorest/autorest v0.11.17 github.com/Azure/go-autorest/autorest/azure/auth v0.5.6 @@ -26,15 +29,14 @@ require ( cloud.google.com/go/iam v1.1.6 // indirect cloud.google.com/go/storage v1.36.0 // indirect github.com/Azure/azure-pipeline-go v0.2.3 // indirect - github.com/Azure/azure-sdk-for-go/sdk/azcore v1.7.1 // indirect - github.com/Azure/azure-sdk-for-go/sdk/internal v1.3.0 // indirect + github.com/Azure/azure-sdk-for-go/sdk/internal v1.5.2 // indirect github.com/Azure/go-autorest v14.2.0+incompatible // indirect github.com/Azure/go-autorest/autorest/adal v0.9.10 // indirect github.com/Azure/go-autorest/autorest/to v0.4.0 // indirect github.com/Azure/go-autorest/autorest/validation v0.3.0 // indirect github.com/Azure/go-autorest/logger v0.2.0 // indirect github.com/Azure/go-autorest/tracing v0.6.0 // indirect - github.com/AzureAD/microsoft-authentication-library-for-go v1.1.1 // indirect + github.com/AzureAD/microsoft-authentication-library-for-go v1.2.2 // indirect github.com/acarl005/stripansi v0.0.0-20180116102854-5a71ef0e047d // indirect github.com/agext/levenshtein v1.2.2 // indirect github.com/allegro/bigcache/v3 v3.1.0 // indirect @@ -46,7 +48,6 @@ require ( github.com/cenkalti/backoff/v4 v4.3.0 // indirect github.com/cespare/xxhash/v2 v2.2.0 // indirect github.com/danwakefield/fnmatch v0.0.0-20160403171240-cbb64ac3d964 // indirect - github.com/davecgh/go-spew v1.1.1 // indirect github.com/dgraph-io/ristretto v0.1.1 // indirect github.com/dimchansky/utfbom v1.1.1 // indirect github.com/dustin/go-humanize v1.0.0 // indirect @@ -62,7 +63,7 @@ require ( github.com/go-logr/logr v1.4.1 // indirect github.com/go-logr/stdr v1.2.2 // indirect github.com/gofrs/uuid v4.0.0+incompatible // indirect - github.com/golang-jwt/jwt/v5 v5.0.0 // indirect + github.com/golang-jwt/jwt/v5 v5.2.1 // indirect github.com/golang/glog v1.2.0 // indirect github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect github.com/golang/mock v1.6.0 // indirect @@ -96,9 +97,8 @@ require ( github.com/mitchellh/mapstructure v1.5.0 // indirect github.com/oklog/run v1.0.0 // indirect github.com/olekukonko/tablewriter v0.0.5 // indirect - github.com/pkg/browser v0.0.0-20210911075715-681adbf594b8 // indirect + github.com/pkg/browser v0.0.0-20240102092130-5ac0b6a4141c // indirect github.com/pkg/errors v0.9.1 // indirect - github.com/pmezard/go-difflib v1.0.0 // indirect github.com/prometheus/client_golang v1.14.0 // indirect github.com/prometheus/client_model v0.3.0 // indirect github.com/prometheus/common v0.37.0 // indirect @@ -107,7 +107,6 @@ require ( github.com/sethvargo/go-retry v0.2.4 // indirect github.com/shopspring/decimal v1.3.1 // indirect github.com/stevenle/topsort v0.2.0 // indirect - github.com/stretchr/testify v1.9.0 // indirect github.com/tkrajina/go-reflector v0.5.6 // indirect github.com/ulikunitz/xz v0.5.10 // indirect github.com/zclconf/go-cty v1.14.4 // indirect @@ -141,5 +140,4 @@ require ( google.golang.org/grpc v1.63.2 // indirect google.golang.org/protobuf v1.33.0 // indirect gopkg.in/yaml.v2 v2.4.0 // indirect - gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/go.sum b/go.sum index 74ef8fbf..4d930193 100644 --- a/go.sum +++ b/go.sum @@ -189,18 +189,26 @@ github.com/Azure/azure-pipeline-go v0.2.3 h1:7U9HBg1JFK3jHl5qmo4CTZKFTVgMwdFHMVt github.com/Azure/azure-pipeline-go v0.2.3/go.mod h1:x841ezTBIMG6O3lAcl8ATHnsOPVl2bqk7S3ta6S6u4k= github.com/Azure/azure-sdk-for-go v45.0.0+incompatible/go.mod h1:9XXNKU+eRnpl9moKnB4QOLf1HestfXbmab5FXxiDBjc= github.com/Azure/azure-sdk-for-go v47.1.0+incompatible/go.mod h1:9XXNKU+eRnpl9moKnB4QOLf1HestfXbmab5FXxiDBjc= -github.com/Azure/azure-sdk-for-go v58.0.0+incompatible h1:Cw16jiP4dI+CK761aq44ol4RV5dUiIIXky1+EKpoiVM= -github.com/Azure/azure-sdk-for-go v58.0.0+incompatible/go.mod h1:9XXNKU+eRnpl9moKnB4QOLf1HestfXbmab5FXxiDBjc= -github.com/Azure/azure-sdk-for-go/sdk/azcore v1.7.1 h1:/iHxaJhsFr0+xVFfbMr5vxz848jyiWuIEDhYq3y5odY= -github.com/Azure/azure-sdk-for-go/sdk/azcore v1.7.1/go.mod h1:bjGvMhVMb+EEm3VRNQawDMUyMMjo+S5ewNjflkep/0Q= -github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.3.1 h1:LNHhpdK7hzUcx/k1LIcuh5k7k1LGIWLQfCjaneSj7Fc= -github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.3.1/go.mod h1:uE9zaUfEQT/nbQjVi2IblCG9iaLtZsuYZ8ne+PuQ02M= -github.com/Azure/azure-sdk-for-go/sdk/data/aztables v1.0.1 h1:bFa9IcjvrCber6gGgDAUZ+I2bO8J7s8JxXmu9fhi2ss= -github.com/Azure/azure-sdk-for-go/sdk/data/aztables v1.0.1/go.mod h1:l3wvZkG9oW07GLBW5Cd0WwG5asOfJ8aqE8raUvNzLpk= -github.com/Azure/azure-sdk-for-go/sdk/internal v1.3.0 h1:sXr+ck84g/ZlZUOZiNELInmMgOsuGwdjjVkEIde0OtY= -github.com/Azure/azure-sdk-for-go/sdk/internal v1.3.0/go.mod h1:okt5dMMTOFjX/aovMlrjvvXoPMBVSPzk9185BT0+eZM= +github.com/Azure/azure-sdk-for-go v68.0.0+incompatible h1:fcYLmCpyNYRnvJbPerq7U0hS+6+I79yEDJBqVNcqUzU= +github.com/Azure/azure-sdk-for-go v68.0.0+incompatible/go.mod h1:9XXNKU+eRnpl9moKnB4QOLf1HestfXbmab5FXxiDBjc= +github.com/Azure/azure-sdk-for-go/sdk/azcore v1.11.0 h1:U/kwEXj0Y+1REAkV4kV8VO1CsEp8tSaQDG/7qC5XuqQ= +github.com/Azure/azure-sdk-for-go/sdk/azcore v1.11.0/go.mod h1:a6xsAQUZg+VsS3TJ05SRp524Hs4pZ/AeFSr5ENf0Yjo= +github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.5.2 h1:FDif4R1+UUR+00q6wquyX90K7A8dN+R5E8GEadoP7sU= +github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.5.2/go.mod h1:aiYBYui4BJ/BJCAIKs92XiPyQfTaBWqvHujDwKb6CBU= +github.com/Azure/azure-sdk-for-go/sdk/data/aztables v1.2.0 h1:aJG+Jxd9/rrLwf8R1Ko0RlOBTJASs/lGQJ8b9AdlKTc= +github.com/Azure/azure-sdk-for-go/sdk/data/aztables v1.2.0/go.mod h1:41ONblJrPxDcnVr+voS+3xXWy/KnZLh+7zY5s6woAlQ= +github.com/Azure/azure-sdk-for-go/sdk/internal v1.5.2 h1:LqbJ/WzJUwBf8UiaSzgX7aMclParm9/5Vgp+TY51uBQ= +github.com/Azure/azure-sdk-for-go/sdk/internal v1.5.2/go.mod h1:yInRyqWXAuaPrgI7p70+lDDgh3mlBohis29jGMISnmc= +github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerservice/armcontainerservice/v4 v4.8.0 h1:0nGmzwBv5ougvzfGPCO2ljFRHvun57KpNrVCMrlk0ns= +github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerservice/armcontainerservice/v4 v4.8.0/go.mod h1:gYq8wyDgv6JLhGbAU6gg8amCPgQWRE+aCvrV2gyzdfs= +github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/internal/v2 v2.0.0 h1:PTFGRSlMKCQelWwxUyYVEUqseBJVemLyqWJjvMyt0do= +github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/internal/v2 v2.0.0/go.mod h1:LRr2FzBTQlONPPa5HREE5+RjSCTXl7BwOvYOaWTqCaI= github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/v3 v3.0.0 h1:BIvscO5ZFKaEHoix9jAV6vbatKLiDNb5pj8XjzQR2g4= github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/recoveryservices/armrecoveryservicesbackup/v3 v3.0.0/go.mod h1:4uHLkZ3JvDvacFcEyB0T/cCeVqlvtHHA7DjvpgvlpdA= +github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armresources v1.1.1 h1:7CBQ+Ei8SP2c6ydQTGCCrS35bDxgTMfoP2miAwK++OU= +github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armresources v1.1.1/go.mod h1:c/wcGeGx5FUPbM/JltUYHZcKmigwyVLJlDq+4HdtXaw= +github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/sql/armsql v1.2.0 h1:S087deZ0kP1RUg4pU7w9U9xpUedTCbOtz+mnd0+hrkQ= +github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/sql/armsql v1.2.0/go.mod h1:B4cEyXrWBmbfMDAPnpJ1di7MAt5DKP57jPEObAvZChg= github.com/Azure/azure-storage-blob-go v0.12.0 h1:7bFXA1QB+lOK2/ASWHhp6/vnxjaeeZq6t8w1Jyp0Iaw= github.com/Azure/azure-storage-blob-go v0.12.0/go.mod h1:A0u4VjtpgZJ7Y7um/+ix2DHBuEKFC6sEIlj0xc13a4Q= github.com/Azure/go-autorest v14.2.0+incompatible h1:V5VMDjClD3GiElqLWO7mz2MxNAK/vTfRHdAubSIPRgs= @@ -232,8 +240,8 @@ github.com/Azure/go-autorest/logger v0.2.0 h1:e4RVHVZKC5p6UANLJHkM4OfR1UKZPj8Wt8 github.com/Azure/go-autorest/logger v0.2.0/go.mod h1:T9E3cAhj2VqvPOtCYAvby9aBXkZmbF5NWuPV8+WeEW8= github.com/Azure/go-autorest/tracing v0.6.0 h1:TYi4+3m5t6K48TGI9AUdb+IzbnSxvnvUMfuitfgcfuo= github.com/Azure/go-autorest/tracing v0.6.0/go.mod h1:+vhtPC754Xsa23ID7GlGsrdKBpUA79WCAKPPZVC2DeU= -github.com/AzureAD/microsoft-authentication-library-for-go v1.1.1 h1:WpB/QDNLpMw72xHJc34BNNykqSOeEJDAWkhf0u12/Jk= -github.com/AzureAD/microsoft-authentication-library-for-go v1.1.1/go.mod h1:wP83P5OoQ5p6ip3ScPr0BAq0BvuPAvacpEuSzyouqAI= +github.com/AzureAD/microsoft-authentication-library-for-go v1.2.2 h1:XHOnouVk1mxXfQidrMEnLlPk9UMeRtyBTnEFtxkV0kU= +github.com/AzureAD/microsoft-authentication-library-for-go v1.2.2/go.mod h1:wP83P5OoQ5p6ip3ScPr0BAq0BvuPAvacpEuSzyouqAI= github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo= github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU= @@ -358,8 +366,8 @@ github.com/go-test/deep v1.0.3/go.mod h1:wGDj63lr65AM2AQyKZd/NYHGb0R+1RLqB8NKt3a github.com/gofrs/uuid v4.0.0+incompatible h1:1SD/1F5pU8p29ybwgQSwpQk+mwdRrXCYuPhW6m+TnJw= github.com/gofrs/uuid v4.0.0+incompatible/go.mod h1:b2aQJv3Z4Fp6yNu3cdSllBxTCLRxnplIgP/c0N/04lM= github.com/gogo/protobuf v1.1.1/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ= -github.com/golang-jwt/jwt/v5 v5.0.0 h1:1n1XNM9hk7O9mnQoNBGolZvzebBQ7p93ULHRc28XJUE= -github.com/golang-jwt/jwt/v5 v5.0.0/go.mod h1:pqrtFR0X4osieyHYxtmOUWsAWrfe1Q5UVIyoH402zdk= +github.com/golang-jwt/jwt/v5 v5.2.1 h1:OuVbFODueb089Lh128TAcimifWaLhJwVflnrgM17wHk= +github.com/golang-jwt/jwt/v5 v5.2.1/go.mod h1:pqrtFR0X4osieyHYxtmOUWsAWrfe1Q5UVIyoH402zdk= github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= github.com/golang/glog v1.2.0 h1:uCdmnmatrKCgMBlM4rMuJZWOkPDqdbZPnrMXDY4gI68= github.com/golang/glog v1.2.0/go.mod h1:6AhwSGph0fcJtXVM/PEHPqZlFeoLxhs7/t5UDAwmO+w= @@ -565,8 +573,8 @@ github.com/oklog/run v1.0.0 h1:Ru7dDtJNOyC66gQ5dQmaCa0qIsAUFY3sFpK1Xk8igrw= github.com/oklog/run v1.0.0/go.mod h1:dlhp/R75TPv97u0XWUtDeV/lRKWPKSdTuV0TZvrmrQA= github.com/olekukonko/tablewriter v0.0.5 h1:P2Ga83D34wi1o9J6Wh1mRuqd4mF/x/lgBS7N7AbDhec= github.com/olekukonko/tablewriter v0.0.5/go.mod h1:hPp6KlRPjbx+hW8ykQs1w3UBbZlj6HuIJcUGPhkA7kY= -github.com/pkg/browser v0.0.0-20210911075715-681adbf594b8 h1:KoWmjvw+nsYOo29YJK9vDA65RGE3NrOnUtO7a+RF9HU= -github.com/pkg/browser v0.0.0-20210911075715-681adbf594b8/go.mod h1:HKlIX3XHQyzLZPlr7++PzdhaXEj94dEiJgZDTsxEqUI= +github.com/pkg/browser v0.0.0-20240102092130-5ac0b6a4141c h1:+mdjkGKdHQG3305AYmdv1U2eRNDiU2ErMBj1gwrq8eQ= +github.com/pkg/browser v0.0.0-20240102092130-5ac0b6a4141c/go.mod h1:7rwL4CYBLnjLxUqIJNnCWiEdr3bn6IUYi15bNlnbCCU= github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= @@ -886,7 +894,6 @@ golang.org/x/sys v0.0.0-20210514084401-e8d321eab015/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.0.0-20210603081109-ebe580a85c40/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210603125802-9665404d3644/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20210616045830-e2b7044e8c71/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210616094352-59db8d763f22/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210806184541-e5e7981a1069/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=