-
Notifications
You must be signed in to change notification settings - Fork 4.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* first commit and wait clusters ready * merge master * merge master * revert client.go * Normalize workspace checks and schema updates * Update test with new schema * Update documentation to match schema update * Added LF for code readability * Normalize ID casing * Test cases for LogAnalyticsLinkedServiceId * Removed unneeded attribute linked_service_type * Workaround for link service changing SKU * Delete wait state and block workspace modification * Update docs * Split out by type * Remove redundant code and update workspace name * Adding removed fields back into schema * Resolve Conflicts * Merging Changes between master and branch * Mostly working again... few tweaks needed... * Add legacy attribute todo's * Fix lint errors * model legacy behavior add legacy field test case * Fix lint error Co-authored-by: Jeffrey Cline <[email protected]>
- Loading branch information
1 parent
f8a77e6
commit 6be9876
Showing
6 changed files
with
392 additions
and
69 deletions.
There are no files selected for viewing
42 changes: 42 additions & 0 deletions
42
azurerm/internal/services/loganalytics/log_analytics_linked_service.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
package loganalytics | ||
|
||
import ( | ||
"context" | ||
"fmt" | ||
"log" | ||
"time" | ||
|
||
"github.com/hashicorp/terraform-plugin-sdk/helper/resource" | ||
"github.com/terraform-providers/terraform-provider-azurerm/azurerm/internal/clients" | ||
) | ||
|
||
func logAnalyticsLinkedServiceDeleteWaitForState(ctx context.Context, meta interface{}, timeout time.Duration, resourceGroup string, workspaceName string, serviceType string) *resource.StateChangeConf { | ||
return &resource.StateChangeConf{ | ||
Pending: []string{"Deleting"}, | ||
Target: []string{"Deleted"}, | ||
MinTimeout: 30 * time.Second, | ||
Timeout: timeout, | ||
Refresh: logAnalyticsLinkedServiceRefresh(ctx, meta, resourceGroup, workspaceName, serviceType), | ||
} | ||
} | ||
|
||
func logAnalyticsLinkedServiceRefresh(ctx context.Context, meta interface{}, resourceGroup string, workspaceName string, serviceType string) resource.StateRefreshFunc { | ||
return func() (interface{}, string, error) { | ||
client := meta.(*clients.Client).LogAnalytics.LinkedServicesClient | ||
|
||
log.Printf("[INFO] checking on state of Log Analytics Linked Service '%s/%s' (Resource Group %q)", workspaceName, serviceType, resourceGroup) | ||
|
||
resp, err := client.Get(ctx, resourceGroup, workspaceName, serviceType) | ||
if err != nil { | ||
return nil, "nil", fmt.Errorf("polling for the status of Log Analytics Linked Service '%s/%s' (Resource Group %q)", workspaceName, serviceType, resourceGroup) | ||
} | ||
|
||
// (@WodansSon) - The service returns status code 200 even if the resource does not exist | ||
// instead it returns an empty slice... | ||
if props := resp.LinkedServiceProperties; props == nil { | ||
return resp, "Deleted", nil | ||
} | ||
|
||
return resp, "Deleting", nil | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.