Skip to content

Commit 30dd6ab

Browse files
Move common_operation.go and common_polling.go to the new packages (#7894) (#5617)
* Move common_operation.go to the tpgresource package * Replace CommonOperationWaiter * Replace function OperationWait * Move common_operation_test.go to the tpgresource package * common_operation_test.go stays in the google package * Move common_polling.go to the transport package * Add docs * Add tpgresource/common_operation.go to the convertion list * Remove duplicate import package Signed-off-by: Modular Magician <[email protected]>
1 parent 8edff73 commit 30dd6ab

File tree

83 files changed

+621
-456
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

83 files changed

+621
-456
lines changed

.changelog/7894.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
```release-note:none
2+
3+
```

google-beta/access_context_manager_operation.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,14 @@ import (
1919
"fmt"
2020
"time"
2121

22+
"github.com/hashicorp/terraform-provider-google-beta/google-beta/tpgresource"
2223
transport_tpg "github.com/hashicorp/terraform-provider-google-beta/google-beta/transport"
2324
)
2425

2526
type AccessContextManagerOperationWaiter struct {
2627
Config *transport_tpg.Config
2728
UserAgent string
28-
CommonOperationWaiter
29+
tpgresource.CommonOperationWaiter
2930
}
3031

3132
func (w *AccessContextManagerOperationWaiter) QueryOp() (interface{}, error) {
@@ -55,7 +56,7 @@ func AccessContextManagerOperationWaitTimeWithResponse(config *transport_tpg.Con
5556
if err != nil {
5657
return err
5758
}
58-
if err := OperationWait(w, activity, timeout, config.PollInterval); err != nil {
59+
if err := tpgresource.OperationWait(w, activity, timeout, config.PollInterval); err != nil {
5960
return err
6061
}
6162
return json.Unmarshal([]byte(w.CommonOperationWaiter.Op.Response), response)
@@ -71,5 +72,5 @@ func AccessContextManagerOperationWaitTime(config *transport_tpg.Config, op map[
7172
// If w is nil, the op was synchronous.
7273
return err
7374
}
74-
return OperationWait(w, activity, timeout, config.PollInterval)
75+
return tpgresource.OperationWait(w, activity, timeout, config.PollInterval)
7576
}

google-beta/active_directory_operation.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,14 +19,15 @@ import (
1919
"fmt"
2020
"time"
2121

22+
"github.com/hashicorp/terraform-provider-google-beta/google-beta/tpgresource"
2223
transport_tpg "github.com/hashicorp/terraform-provider-google-beta/google-beta/transport"
2324
)
2425

2526
type ActiveDirectoryOperationWaiter struct {
2627
Config *transport_tpg.Config
2728
UserAgent string
2829
Project string
29-
CommonOperationWaiter
30+
tpgresource.CommonOperationWaiter
3031
}
3132

3233
func (w *ActiveDirectoryOperationWaiter) QueryOp() (interface{}, error) {
@@ -57,7 +58,7 @@ func ActiveDirectoryOperationWaitTimeWithResponse(config *transport_tpg.Config,
5758
if err != nil {
5859
return err
5960
}
60-
if err := OperationWait(w, activity, timeout, config.PollInterval); err != nil {
61+
if err := tpgresource.OperationWait(w, activity, timeout, config.PollInterval); err != nil {
6162
return err
6263
}
6364
return json.Unmarshal([]byte(w.CommonOperationWaiter.Op.Response), response)
@@ -73,5 +74,5 @@ func ActiveDirectoryOperationWaitTime(config *transport_tpg.Config, op map[strin
7374
// If w is nil, the op was synchronous.
7475
return err
7576
}
76-
return OperationWait(w, activity, timeout, config.PollInterval)
77+
return tpgresource.OperationWait(w, activity, timeout, config.PollInterval)
7778
}

google-beta/alloydb_operation.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,14 +18,15 @@ import (
1818
"fmt"
1919
"time"
2020

21+
"github.com/hashicorp/terraform-provider-google-beta/google-beta/tpgresource"
2122
transport_tpg "github.com/hashicorp/terraform-provider-google-beta/google-beta/transport"
2223
)
2324

2425
type AlloydbOperationWaiter struct {
2526
Config *transport_tpg.Config
2627
UserAgent string
2728
Project string
28-
CommonOperationWaiter
29+
tpgresource.CommonOperationWaiter
2930
}
3031

3132
func (w *AlloydbOperationWaiter) QueryOp() (interface{}, error) {
@@ -60,5 +61,5 @@ func AlloydbOperationWaitTime(config *transport_tpg.Config, op map[string]interf
6061
// If w is nil, the op was synchronous.
6162
return err
6263
}
63-
return OperationWait(w, activity, timeout, config.PollInterval)
64+
return tpgresource.OperationWait(w, activity, timeout, config.PollInterval)
6465
}

google-beta/api_gateway_operation.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,14 +19,15 @@ import (
1919
"fmt"
2020
"time"
2121

22+
"github.com/hashicorp/terraform-provider-google-beta/google-beta/tpgresource"
2223
transport_tpg "github.com/hashicorp/terraform-provider-google-beta/google-beta/transport"
2324
)
2425

2526
type ApiGatewayOperationWaiter struct {
2627
Config *transport_tpg.Config
2728
UserAgent string
2829
Project string
29-
CommonOperationWaiter
30+
tpgresource.CommonOperationWaiter
3031
}
3132

3233
func (w *ApiGatewayOperationWaiter) QueryOp() (interface{}, error) {
@@ -57,7 +58,7 @@ func ApiGatewayOperationWaitTimeWithResponse(config *transport_tpg.Config, op ma
5758
if err != nil {
5859
return err
5960
}
60-
if err := OperationWait(w, activity, timeout, config.PollInterval); err != nil {
61+
if err := tpgresource.OperationWait(w, activity, timeout, config.PollInterval); err != nil {
6162
return err
6263
}
6364
return json.Unmarshal([]byte(w.CommonOperationWaiter.Op.Response), response)
@@ -73,5 +74,5 @@ func ApiGatewayOperationWaitTime(config *transport_tpg.Config, op map[string]int
7374
// If w is nil, the op was synchronous.
7475
return err
7576
}
76-
return OperationWait(w, activity, timeout, config.PollInterval)
77+
return tpgresource.OperationWait(w, activity, timeout, config.PollInterval)
7778
}

google-beta/apigee_operation.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,14 @@ import (
1919
"fmt"
2020
"time"
2121

22+
"github.com/hashicorp/terraform-provider-google-beta/google-beta/tpgresource"
2223
transport_tpg "github.com/hashicorp/terraform-provider-google-beta/google-beta/transport"
2324
)
2425

2526
type ApigeeOperationWaiter struct {
2627
Config *transport_tpg.Config
2728
UserAgent string
28-
CommonOperationWaiter
29+
tpgresource.CommonOperationWaiter
2930
}
3031

3132
func (w *ApigeeOperationWaiter) QueryOp() (interface{}, error) {
@@ -55,7 +56,7 @@ func ApigeeOperationWaitTimeWithResponse(config *transport_tpg.Config, op map[st
5556
if err != nil {
5657
return err
5758
}
58-
if err := OperationWait(w, activity, timeout, config.PollInterval); err != nil {
59+
if err := tpgresource.OperationWait(w, activity, timeout, config.PollInterval); err != nil {
5960
return err
6061
}
6162
return json.Unmarshal([]byte(w.CommonOperationWaiter.Op.Response), response)
@@ -71,5 +72,5 @@ func ApigeeOperationWaitTime(config *transport_tpg.Config, op map[string]interfa
7172
// If w is nil, the op was synchronous.
7273
return err
7374
}
74-
return OperationWait(w, activity, timeout, config.PollInterval)
75+
return tpgresource.OperationWait(w, activity, timeout, config.PollInterval)
7576
}

google-beta/appengine_operation.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ var (
2020
type AppEngineOperationWaiter struct {
2121
Service *appengine.APIService
2222
AppId string
23-
CommonOperationWaiter
23+
tpgresource.CommonOperationWaiter
2424
}
2525

2626
func (w *AppEngineOperationWaiter) QueryOp() (interface{}, error) {
@@ -49,7 +49,7 @@ func AppEngineOperationWaitTimeWithResponse(config *transport_tpg.Config, res in
4949
if err := w.SetOp(op); err != nil {
5050
return err
5151
}
52-
if err := OperationWait(w, activity, timeout, config.PollInterval); err != nil {
52+
if err := tpgresource.OperationWait(w, activity, timeout, config.PollInterval); err != nil {
5353
return err
5454
}
5555
return json.Unmarshal([]byte(w.CommonOperationWaiter.Op.Response), response)
@@ -70,5 +70,5 @@ func AppEngineOperationWaitTime(config *transport_tpg.Config, res interface{}, a
7070
if err := w.SetOp(op); err != nil {
7171
return err
7272
}
73-
return OperationWait(w, activity, timeout, config.PollInterval)
73+
return tpgresource.OperationWait(w, activity, timeout, config.PollInterval)
7474
}

google-beta/artifact_registry_operation.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,14 +19,15 @@ import (
1919
"fmt"
2020
"time"
2121

22+
"github.com/hashicorp/terraform-provider-google-beta/google-beta/tpgresource"
2223
transport_tpg "github.com/hashicorp/terraform-provider-google-beta/google-beta/transport"
2324
)
2425

2526
type ArtifactRegistryOperationWaiter struct {
2627
Config *transport_tpg.Config
2728
UserAgent string
2829
Project string
29-
CommonOperationWaiter
30+
tpgresource.CommonOperationWaiter
3031
}
3132

3233
func (w *ArtifactRegistryOperationWaiter) QueryOp() (interface{}, error) {
@@ -57,7 +58,7 @@ func ArtifactRegistryOperationWaitTimeWithResponse(config *transport_tpg.Config,
5758
if err != nil {
5859
return err
5960
}
60-
if err := OperationWait(w, activity, timeout, config.PollInterval); err != nil {
61+
if err := tpgresource.OperationWait(w, activity, timeout, config.PollInterval); err != nil {
6162
return err
6263
}
6364
return json.Unmarshal([]byte(w.CommonOperationWaiter.Op.Response), response)
@@ -73,5 +74,5 @@ func ArtifactRegistryOperationWaitTime(config *transport_tpg.Config, op map[stri
7374
// If w is nil, the op was synchronous.
7475
return err
7576
}
76-
return OperationWait(w, activity, timeout, config.PollInterval)
77+
return tpgresource.OperationWait(w, activity, timeout, config.PollInterval)
7778
}

google-beta/beyondcorp_operation.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,14 +19,15 @@ import (
1919
"fmt"
2020
"time"
2121

22+
"github.com/hashicorp/terraform-provider-google-beta/google-beta/tpgresource"
2223
transport_tpg "github.com/hashicorp/terraform-provider-google-beta/google-beta/transport"
2324
)
2425

2526
type BeyondcorpOperationWaiter struct {
2627
Config *transport_tpg.Config
2728
UserAgent string
2829
Project string
29-
CommonOperationWaiter
30+
tpgresource.CommonOperationWaiter
3031
}
3132

3233
func (w *BeyondcorpOperationWaiter) QueryOp() (interface{}, error) {
@@ -57,7 +58,7 @@ func BeyondcorpOperationWaitTimeWithResponse(config *transport_tpg.Config, op ma
5758
if err != nil {
5859
return err
5960
}
60-
if err := OperationWait(w, activity, timeout, config.PollInterval); err != nil {
61+
if err := tpgresource.OperationWait(w, activity, timeout, config.PollInterval); err != nil {
6162
return err
6263
}
6364
return json.Unmarshal([]byte(w.CommonOperationWaiter.Op.Response), response)
@@ -73,5 +74,5 @@ func BeyondcorpOperationWaitTime(config *transport_tpg.Config, op map[string]int
7374
// If w is nil, the op was synchronous.
7475
return err
7576
}
76-
return OperationWait(w, activity, timeout, config.PollInterval)
77+
return tpgresource.OperationWait(w, activity, timeout, config.PollInterval)
7778
}

google-beta/certificate_manager_operation.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,14 +18,15 @@ import (
1818
"fmt"
1919
"time"
2020

21+
"github.com/hashicorp/terraform-provider-google-beta/google-beta/tpgresource"
2122
transport_tpg "github.com/hashicorp/terraform-provider-google-beta/google-beta/transport"
2223
)
2324

2425
type CertificateManagerOperationWaiter struct {
2526
Config *transport_tpg.Config
2627
UserAgent string
2728
Project string
28-
CommonOperationWaiter
29+
tpgresource.CommonOperationWaiter
2930
}
3031

3132
func (w *CertificateManagerOperationWaiter) QueryOp() (interface{}, error) {
@@ -60,5 +61,5 @@ func CertificateManagerOperationWaitTime(config *transport_tpg.Config, op map[st
6061
// If w is nil, the op was synchronous.
6162
return err
6263
}
63-
return OperationWait(w, activity, timeout, config.PollInterval)
64+
return tpgresource.OperationWait(w, activity, timeout, config.PollInterval)
6465
}

0 commit comments

Comments
 (0)