Skip to content

Commit

Permalink
Adds resource BitbucketServerConfig to CloudBuild. (#7083) (#5218)
Browse files Browse the repository at this point in the history
* Adds resource BitbucketServerConfig to CloudBuild.

* Adds example bitbucket config with peered_network and ssl_ca fields being used

* Minor code refactor. Removing unnecessary code for Cloud Build BitbucketServerConfig

* Update doc description mmv1/products/cloudbuild/api.yaml



* Update doc description mmv1/products/cloudbuild/api.yaml



---------

Signed-off-by: Modular Magician <[email protected]>
Co-authored-by: Mario Machado <[email protected]>
Co-authored-by: Shuya Ma <[email protected]>
  • Loading branch information
3 people authored Feb 16, 2023
1 parent 08d1406 commit 0a41a5a
Show file tree
Hide file tree
Showing 7 changed files with 1,475 additions and 2 deletions.
3 changes: 3 additions & 0 deletions .changelog/7083.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:new-resource
`google_cloudbuild_bitbucket_server_config`
```
75 changes: 75 additions & 0 deletions google-beta/cloud_build_operation.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
// ----------------------------------------------------------------------------
//
// *** 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 google

import (
"encoding/json"
"fmt"
"time"
)

type CloudBuildOperationWaiter struct {
Config *Config
UserAgent string
Project string
CommonOperationWaiter
}

func (w *CloudBuildOperationWaiter) 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.CloudBuildBasePath, w.CommonOperationWaiter.Op.Name)

return sendRequest(w.Config, "GET", w.Project, url, w.UserAgent, nil)
}

func createCloudBuildWaiter(config *Config, op map[string]interface{}, project, activity, userAgent string) (*CloudBuildOperationWaiter, error) {
w := &CloudBuildOperationWaiter{
Config: config,
UserAgent: userAgent,
Project: project,
}
if err := w.CommonOperationWaiter.SetOp(op); err != nil {
return nil, err
}
return w, nil
}

// nolint: deadcode,unused
func cloudBuildOperationWaitTimeWithResponse(config *Config, op map[string]interface{}, response *map[string]interface{}, project, activity, userAgent string, timeout time.Duration) error {
w, err := createCloudBuildWaiter(config, op, project, activity, userAgent)
if err != nil {
return err
}
if err := OperationWait(w, activity, timeout, config.PollInterval); err != nil {
return err
}
return json.Unmarshal([]byte(w.CommonOperationWaiter.Op.Response), response)
}

func cloudBuildOperationWaitTime(config *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 := createCloudBuildWaiter(config, op, project, activity, userAgent)
if err != nil {
// If w is nil, the op was synchronous.
return err
}
return OperationWait(w, activity, timeout, config.PollInterval)
}
5 changes: 3 additions & 2 deletions google-beta/provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -1108,9 +1108,9 @@ func Provider() *schema.Provider {
return provider
}

// Generated resources: 300
// Generated resources: 301
// Generated IAM resources: 204
// Total generated resources: 504
// Total generated resources: 505
func ResourceMap() map[string]*schema.Resource {
resourceMap, _ := ResourceMapWithErrors()
return resourceMap
Expand Down Expand Up @@ -1217,6 +1217,7 @@ func ResourceMapWithErrors() (map[string]*schema.Resource, error) {
"google_cloud_asset_folder_feed": resourceCloudAssetFolderFeed(),
"google_cloud_asset_organization_feed": resourceCloudAssetOrganizationFeed(),
"google_cloud_asset_project_feed": resourceCloudAssetProjectFeed(),
"google_cloudbuild_bitbucket_server_config": resourceCloudBuildBitbucketServerConfig(),
"google_cloudbuild_trigger": resourceCloudBuildTrigger(),
"google_cloudbuildv2_connection_iam_binding": ResourceIamBinding(Cloudbuildv2ConnectionIamSchema, Cloudbuildv2ConnectionIamUpdaterProducer, Cloudbuildv2ConnectionIdParseFunc),
"google_cloudbuildv2_connection_iam_member": ResourceIamMember(Cloudbuildv2ConnectionIamSchema, Cloudbuildv2ConnectionIamUpdaterProducer, Cloudbuildv2ConnectionIdParseFunc),
Expand Down
Loading

0 comments on commit 0a41a5a

Please sign in to comment.