Skip to content

Commit

Permalink
Merge branch 'GoogleCloudPlatform:main' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
niharika-98 authored Oct 17, 2024
2 parents 8c434e7 + a88f745 commit 4e0feb5
Show file tree
Hide file tree
Showing 23 changed files with 886 additions and 24 deletions.
1 change: 1 addition & 0 deletions mmv1/products/deploymentmanager/product.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,6 @@ display_name: 'Cloud Deployment Manager'
versions:
- name: 'ga'
base_url: 'https://www.googleapis.com/deploymentmanager/v2/'
cai_base_url: 'https://deploymentmanager.googleapis.com/v2/'
scopes:
- 'https://www.googleapis.com/auth/cloud-platform'
1 change: 1 addition & 0 deletions mmv1/products/dialogflowcx/SecuritySettings.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ timeouts:
delete_minutes: 20
custom_code:
post_create: 'templates/terraform/post_create/sleep.go.tmpl'
post_update: 'templates/terraform/post_create/sleep.go.tmpl'
examples:
- name: 'dialogflowcx_security_settings_basic'
primary_resource_id: 'basic_security_settings'
Expand Down
1 change: 1 addition & 0 deletions mmv1/products/essentialcontacts/Contact.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ timeouts:
update_minutes: 20
delete_minutes: 20
custom_code:
post_import: 'templates/terraform/post_import/essential_contacts_contact.go.tmpl'
examples:
- name: 'essential_contact'
primary_resource_id: 'contact'
Expand Down
4 changes: 2 additions & 2 deletions mmv1/products/orgpolicy/Policy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -84,9 +84,9 @@ properties:
output: true
- name: 'rules'
type: Array
description: 'Up to 10 PolicyRules are allowed. In Policies for boolean constraints, the following requirements apply: - There must be one and only one PolicyRule where condition is unset. - BooleanPolicyRules with conditions must set `enforced` to the opposite of the PolicyRule without a condition. - During policy evaluation, PolicyRules with conditions that are true for a target resource take precedence.'
description: 'In Policies for boolean constraints, the following requirements apply: - There must be one and only one PolicyRule where condition is unset. - BooleanPolicyRules with conditions must set `enforced` to the opposite of the PolicyRule without a condition. - During policy evaluation, PolicyRules with conditions that are true for a target resource take precedence.'
item_type:
description: 'Up to 10 PolicyRules are allowed. In Policies for boolean constraints, the following requirements apply: - There must be one and only one PolicyRule where condition is unset. - BooleanPolicyRules with conditions must set `enforced` to the opposite of the PolicyRule without a condition. - During policy evaluation, PolicyRules with conditions that are true for a target resource take precedence.'
description: 'In Policies for boolean constraints, the following requirements apply: - There must be one and only one PolicyRule where condition is unset. - BooleanPolicyRules with conditions must set `enforced` to the opposite of the PolicyRule without a condition. - During policy evaluation, PolicyRules with conditions that are true for a target resource take precedence.'
type: NestedObject
properties:
- name: 'values'
Expand Down
2 changes: 2 additions & 0 deletions mmv1/products/secretmanagerregional/product.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,9 @@ display_name: 'Secret Manager'
versions:
- name: 'ga'
base_url: 'https://secretmanager.{{location}}.rep.googleapis.com/v1/'
cai_base_url: 'https://secretmanager.googleapis.com/v1/'
- name: 'beta'
base_url: 'https://secretmanager.{{location}}.rep.googleapis.com/v1/'
cai_base_url: 'https://secretmanager.googleapis.com/v1/'
scopes:
- 'https://www.googleapis.com/auth/cloud-platform'
1 change: 1 addition & 0 deletions mmv1/products/siteverification/product.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,6 @@ display_name: 'Site Verification'
versions:
- name: 'ga'
base_url: 'https://www.googleapis.com/siteVerification/v1/'
cai_base_url: 'https://siteverification.googleapis.com/v1/'
scopes:
- 'https://www.googleapis.com/auth/siteverification'
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
// Split resource name into tokens
nameTokens := strings.SplitAfterN(d.Id(), "/", 3)

if err := d.Set("parent", nameTokens[0]+strings.Trim(nameTokens[1], "/")); err != nil {
return nil, fmt.Errorf("error getting parent for the contact : %s", err)
}
17 changes: 11 additions & 6 deletions mmv1/third_party/terraform/acctest/vcr_utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -347,7 +347,14 @@ func HandleVCRConfiguration(ctx context.Context, testName string, rndTripper htt
return pollInterval, rndTripper, diags
}
// Defines how VCR will match requests to responses.
rec.SetMatcher(func(r *http.Request, i cassette.Request) bool {
rec.SetMatcher(NewVcrMatcherFunc(ctx))

return pollInterval, rec, diags
}

// NewVcrMatcherFunc returns a function used for matching HTTP requests with data recorded in VCR cassettes
func NewVcrMatcherFunc(ctx context.Context) func(r *http.Request, i cassette.Request) bool {
return func(r *http.Request, i cassette.Request) bool {
// Default matcher compares method and URL only
if !cassette.DefaultMatcher(r, i) {
return false
Expand Down Expand Up @@ -377,19 +384,17 @@ func HandleVCRConfiguration(ctx context.Context, testName string, rndTripper htt
if strings.Contains(contentType, "application/json") {
var reqJson, cassetteJson interface{}
if err := json.Unmarshal([]byte(reqBody), &reqJson); err != nil {
tflog.Debug(ctx, fmt.Sprintf("Failed to unmarshall request json: %v", err))
tflog.Debug(ctx, fmt.Sprintf("Failed to unmarshal request json: %v", err))
return false
}
if err := json.Unmarshal([]byte(i.Body), &cassetteJson); err != nil {
tflog.Debug(ctx, fmt.Sprintf("Failed to unmarshall cassette json: %v", err))
tflog.Debug(ctx, fmt.Sprintf("Failed to unmarshal cassette json: %v", err))
return false
}
return reflect.DeepEqual(reqJson, cassetteJson)
}
return false
})

return pollInterval, rec, diags
}
}

// MuxedProviders configures the providers, thus, if we want the providers to be configured
Expand Down
Loading

0 comments on commit 4e0feb5

Please sign in to comment.