Skip to content

Commit

Permalink
Remove ProviderBatching from provider_model.go in the google package (G…
Browse files Browse the repository at this point in the history
  • Loading branch information
zli82016 authored and ericayyliu committed Jul 26, 2023
1 parent b798007 commit ec7e672
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 23 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -69,11 +69,6 @@ type ProviderModel struct {
<% end -%>
}

type ProviderBatching struct {
SendAfter types.String `tfsdk:"send_after"`
EnableBatching types.Bool `tfsdk:"enable_batching"`
}

var ProviderBatchingAttributes = map[string]attr.Type{
"send_after": types.StringType,
"enable_batching": types.BoolType,
Expand Down
18 changes: 0 additions & 18 deletions mmv1/third_party/terraform/utils/error_retry_predicates.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@ package google
import (
"fmt"

sqladmin "google.golang.org/api/sqladmin/v1beta4"

transport_tpg "github.com/hashicorp/terraform-provider-google/google/transport"
)

Expand All @@ -31,22 +29,6 @@ func PubsubTopicProjectNotReady(err error) (bool, string) {
return transport_tpg.PubsubTopicProjectNotReady(err)
}

// Retry if Cloud SQL operation returns a 429 with a specific message for
// concurrent operations.
func IsSqlInternalError(err error) (bool, string) {
if gerr, ok := err.(*SqlAdminOperationError); ok {
// SqlAdminOperationError is a non-interface type so we need to cast it through
// a layer of interface{}. :)
var ierr interface{}
ierr = gerr
if serr, ok := ierr.(*sqladmin.OperationErrors); ok && serr.Errors[0].Code == "INTERNAL_ERROR" {
return true, "Received an internal error, which is sometimes retryable for some SQL resources. Optimistically retrying."
}

}
return false, ""
}

// Retry if Cloud SQL operation returns a 429 with a specific message for
// concurrent operations.
func IsSqlOperationInProgressError(err error) (bool, string) {
Expand Down
16 changes: 16 additions & 0 deletions mmv1/third_party/terraform/utils/sqladmin_operation.go
Original file line number Diff line number Diff line change
Expand Up @@ -133,3 +133,19 @@ func (e SqlAdminOperationError) Error() string {

return buf.String()
}

// Retry if Cloud SQL operation returns a 429 with a specific message for
// concurrent operations.
func IsSqlInternalError(err error) (bool, string) {
if gerr, ok := err.(*SqlAdminOperationError); ok {
// SqlAdminOperationError is a non-interface type so we need to cast it through
// a layer of interface{}. :)
var ierr interface{}
ierr = gerr
if serr, ok := ierr.(*sqladmin.OperationErrors); ok && serr.Errors[0].Code == "INTERNAL_ERROR" {
return true, "Received an internal error, which is sometimes retryable for some SQL resources. Optimistically retrying."
}

}
return false, ""
}

0 comments on commit ec7e672

Please sign in to comment.