Skip to content

Commit

Permalink
Fix iam files with snakecase back to camelcase (GoogleCloudPlatform#5605
Browse files Browse the repository at this point in the history
)

* Fix iam files with snakecase back to camelcase

* Modify servicemanagement terraform yaml import format

* Modify servicemanagement api yaml service name to snake case
  • Loading branch information
iyabchen authored and lcaggio committed Mar 17, 2022
1 parent 8f9a67b commit 9d0ea35
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 8 deletions.
4 changes: 2 additions & 2 deletions mmv1/products/servicemanagement/api.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,11 @@ objects:
- !ruby/object:Api::Resource
name: 'Service'
base_url: services
self_link: services/{{serviceName}}
self_link: services/{{service_name}}
description: |
A service that is managed by Google Service Management
properties:
- !ruby/object:Api::Type::String
name: 'serviceName'
description: The name of the service.
required: true
required: true
4 changes: 2 additions & 2 deletions mmv1/products/servicemanagement/terraform.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ legacy_name: endpoints
overrides: !ruby/object:Overrides::ResourceOverrides
Service: !ruby/object:Overrides::Terraform::ResourceOverride
legacy_name: google_endpoints_service
id_format: 'services/{{serviceName}}'
import_format: ["services/{{serviceName}}"]
id_format: 'services/{{service_name}}'
import_format: ["services/{{service_name}}"]
exclude_resource: true
iam_policy: !ruby/object:Api::Resource::IamPolicy
parent_resource_attribute: 'service_name'
Expand Down
2 changes: 1 addition & 1 deletion mmv1/templates/validator/resource_converter_iam.go.erb
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
if import_format.nil? || import_format.empty?
asset_name_template = '//' + product_backend_name.downcase + '.googleapis.com/' + (object.cai_base_url || object.self_link || object.base_url) + '/{{' + object.name.downcase + '}}'
else
asset_name_template = '//' + product_backend_name.downcase + '.googleapis.com/' + Google::StringUtils.underscore(import_format[0].gsub('{{name}}', "{{#{parent_resource_name}}}").gsub('%', ''))
asset_name_template = '//' + product_backend_name.downcase + '.googleapis.com/' + import_format[0].gsub('{{name}}', "{{#{parent_resource_name}}}").gsub('%', '')
end
-%>

Expand Down
6 changes: 3 additions & 3 deletions mmv1/templates/validator/resource_converters.go.erb
Original file line number Diff line number Diff line change
Expand Up @@ -73,9 +73,9 @@ func ResourceConverters() map[string][]ResourceConverter {
"google_pubsub_subscription_iam_policy": {resourceConverterPubsubSubscriptionIamPolicy()},
"google_pubsub_subscription_iam_binding": {resourceConverterPubsubSubscriptionIamBinding()},
"google_pubsub_subscription_iam_member": {resourceConverterPubsubSubscriptionIamMember()},
"google_storage_bucket_iam_policy": {resourceConverterStorageBucketIamPolicy()},
"google_storage_bucket_iam_binding": {resourceConverterStorageBucketIamBinding()},
"google_storage_bucket_iam_member": {resourceConverterStorageBucketIamMember()},
"google_storage_bucket_iam_policy": {resourceConverterStorageBucketIamPolicy()},
"google_storage_bucket_iam_binding": {resourceConverterStorageBucketIamBinding()},
"google_storage_bucket_iam_member": {resourceConverterStorageBucketIamMember()},
"google_pubsub_topic": {resourceConverterPubsubTopic()},
"google_kms_crypto_key": {resourceConverterKMSCryptoKey()},
"google_kms_key_ring": {resourceConverterKMSKeyRing()},
Expand Down

0 comments on commit 9d0ea35

Please sign in to comment.