Skip to content

Commit

Permalink
support force delete consumer quota override (GoogleCloudPlatform#5753)
Browse files Browse the repository at this point in the history
  • Loading branch information
linweicgoogle authored and lcaggio committed Mar 17, 2022
1 parent 3f3ecf0 commit f145931
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 2 deletions.
4 changes: 2 additions & 2 deletions mmv1/products/serviceusage/api.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ objects:
create_url: projects/{{project}}/services/{{service}}/consumerQuotaMetrics/{{metric}}/limits/{{limit}}/adminOverrides/{{name}}?force={{force}}
update_url: projects/{{project}}/services/{{service}}/consumerQuotaMetrics/{{metric}}/limits/{{limit}}/adminOverrides/{{name}}
update_verb: :PATCH
delete_url: projects/{{project}}/services/{{service}}/consumerQuotaMetrics/{{metric}}/limits/{{limit}}/adminOverrides/{{name}}
delete_url: projects/{{project}}/services/{{service}}/consumerQuotaMetrics/{{metric}}/limits/{{limit}}/adminOverrides/{{name}}?force={{force}}
references: !ruby/object:Api::Resource::ReferenceLinks
guides:
'Getting Started': 'https://cloud.google.com/service-usage/docs/manage-quota#create_consumer_quota_override'
Expand Down Expand Up @@ -123,7 +123,7 @@ objects:
create_url: projects/{{project}}/services/{{service}}/consumerQuotaMetrics/{{metric}}/limits/{{limit}}/consumerOverrides/{{name}}?force={{force}}
update_url: projects/{{project}}/services/{{service}}/consumerQuotaMetrics/{{metric}}/limits/{{limit}}/consumerOverrides/{{name}}?force={{force}}
update_verb: :PATCH
delete_url: projects/{{project}}/services/{{service}}/consumerQuotaMetrics/{{metric}}/limits/{{limit}}/consumerOverrides/{{name}}
delete_url: projects/{{project}}/services/{{service}}/consumerQuotaMetrics/{{metric}}/limits/{{limit}}/consumerOverrides/{{name}}?force={{force}}
references: !ruby/object:Api::Resource::ReferenceLinks
guides:
'Getting Started': 'https://cloud.google.com/service-usage/docs/getting-started'
Expand Down
8 changes: 8 additions & 0 deletions mmv1/products/serviceusage/terraform.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,14 @@ overrides: !ruby/object:Overrides::ResourceOverrides
project_id: "quota"
test_env_vars:
org_id: :ORG_ID
- !ruby/object:Provider::Terraform::Examples
name: "consumer_quota_override_custom_dimension"
primary_resource_id: "override"
min_version: 'beta'
vars:
project_id: "quota"
test_env_vars:
org_id: :ORG_ID
id_format: "projects/{{project}}/services/{{service}}/consumerQuotaMetrics/{{metric}}/limits/{{limit}}/consumerOverrides/{{name}}"
import_format: [ "services/{{service}}/consumerQuotaMetrics/{{metric}}/limits/{{limit}}/consumerOverrides/{{name}}", "projects/{{project}}/services/{{service}}/consumerQuotaMetrics/{{metric}}/limits/{{limit}}/consumerOverrides/{{name}}" ]
skip_sweeper: true
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
resource "google_project" "my_project" {
provider = google-beta
name = "tf-test-project"
project_id = "<%= ctx[:vars]['project_id'] %>"
org_id = "<%= ctx[:test_env_vars]['org_id'] %>"
}

resource "google_service_usage_consumer_quota_override" "override" {
provider = google-beta
project = google_project.my_project.project_id
service = "libraryagent.googleapis.com"
metric = urlencode("libraryagent.googleapis.com/borrows")
limit = urlencode("/author/project")
override_value = "1"
force = true
dimensions = {
author = "larry"
}
}

0 comments on commit f145931

Please sign in to comment.