-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
…20237) [upstream:a8a545fe5d66b53f6ec872743137bfb426669232] Signed-off-by: Modular Magician <magic-modules@google.com>
- Loading branch information
1 parent
04253f5
commit 89cd3e8
Showing
21 changed files
with
2,191 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
```release-note:new-resource | ||
`google_managed_kafka_cluster` and `google_managed_kafka_topic` (ga) | ||
``` |
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
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
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
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
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
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,92 @@ | ||
// Copyright (c) HashiCorp, Inc. | ||
// SPDX-License-Identifier: MPL-2.0 | ||
|
||
// ---------------------------------------------------------------------------- | ||
// | ||
// *** AUTO GENERATED CODE *** Type: MMv1 *** | ||
// | ||
// ---------------------------------------------------------------------------- | ||
// | ||
// This file is automatically generated by Magic Modules and manual | ||
// changes will be clobbered when the file is regenerated. | ||
// | ||
// Please read more about how to change this file in | ||
// .github/CONTRIBUTING.md. | ||
// | ||
// ---------------------------------------------------------------------------- | ||
|
||
package managedkafka | ||
|
||
import ( | ||
"encoding/json" | ||
"errors" | ||
"fmt" | ||
"time" | ||
|
||
"github.com/hashicorp/terraform-provider-google/google/tpgresource" | ||
transport_tpg "github.com/hashicorp/terraform-provider-google/google/transport" | ||
) | ||
|
||
type ManagedKafkaOperationWaiter struct { | ||
Config *transport_tpg.Config | ||
UserAgent string | ||
Project string | ||
tpgresource.CommonOperationWaiter | ||
} | ||
|
||
func (w *ManagedKafkaOperationWaiter) QueryOp() (interface{}, error) { | ||
if w == nil { | ||
return nil, fmt.Errorf("Cannot query operation, it's unset or nil.") | ||
} | ||
// Returns the proper get. | ||
url := fmt.Sprintf("%s%s", w.Config.ManagedKafkaBasePath, w.CommonOperationWaiter.Op.Name) | ||
|
||
return transport_tpg.SendRequest(transport_tpg.SendRequestOptions{ | ||
Config: w.Config, | ||
Method: "GET", | ||
Project: w.Project, | ||
RawURL: url, | ||
UserAgent: w.UserAgent, | ||
}) | ||
} | ||
|
||
func createManagedKafkaWaiter(config *transport_tpg.Config, op map[string]interface{}, project, activity, userAgent string) (*ManagedKafkaOperationWaiter, error) { | ||
w := &ManagedKafkaOperationWaiter{ | ||
Config: config, | ||
UserAgent: userAgent, | ||
Project: project, | ||
} | ||
if err := w.CommonOperationWaiter.SetOp(op); err != nil { | ||
return nil, err | ||
} | ||
return w, nil | ||
} | ||
|
||
// nolint: deadcode,unused | ||
func ManagedKafkaOperationWaitTimeWithResponse(config *transport_tpg.Config, op map[string]interface{}, response *map[string]interface{}, project, activity, userAgent string, timeout time.Duration) error { | ||
w, err := createManagedKafkaWaiter(config, op, project, activity, userAgent) | ||
if err != nil { | ||
return err | ||
} | ||
if err := tpgresource.OperationWait(w, activity, timeout, config.PollInterval); err != nil { | ||
return err | ||
} | ||
rawResponse := []byte(w.CommonOperationWaiter.Op.Response) | ||
if len(rawResponse) == 0 { | ||
return errors.New("`resource` not set in operation response") | ||
} | ||
return json.Unmarshal(rawResponse, response) | ||
} | ||
|
||
func ManagedKafkaOperationWaitTime(config *transport_tpg.Config, op map[string]interface{}, project, activity, userAgent string, timeout time.Duration) error { | ||
if val, ok := op["name"]; !ok || val == "" { | ||
// This was a synchronous call - there is no operation to wait for. | ||
return nil | ||
} | ||
w, err := createManagedKafkaWaiter(config, op, project, activity, userAgent) | ||
if err != nil { | ||
// If w is nil, the op was synchronous. | ||
return err | ||
} | ||
return tpgresource.OperationWait(w, activity, timeout, config.PollInterval) | ||
} |
Oops, something went wrong.