diff --git a/docs/resources/google_compute_url_map.md b/docs/resources/google_compute_url_map.md index b00cd0e1c..7802ca445 100644 --- a/docs/resources/google_compute_url_map.md +++ b/docs/resources/google_compute_url_map.md @@ -30,33 +30,31 @@ end Properties that can be accessed from the `google_compute_url_map` resource: + * `id`: The unique identifier for the resource. + * `creation_timestamp`: Creation timestamp in RFC3339 text format. - * `default_service`: A reference to BackendService resource if none of the hostRules match. + * `default_service`: The BackendService resource to which traffic is directed if none of the hostRules match. If defaultRouteAction is additionally specified, advanced routing actions like URL Rewrites, etc. take effect prior to sending the request to the backend. However, if defaultService is specified, defaultRouteAction cannot contain any weightedBackendServices. Conversely, if routeAction specifies any weightedBackendServices, service must not be specified. Only one of defaultService, defaultUrlRedirect or defaultRouteAction.weightedBackendService must be set. * `description`: An optional description of this resource. Provide this property when you create the resource. + * `fingerprint`: Fingerprint of this resource. A hash of the contents stored in this object. This field is used in optimistic locking. + * `host_rules`: The list of HostRules to use against the URL. - * `description`: An optional description of this HostRule. Provide this property when you create the resource. + * `description`: An optional description of this resource. Provide this property when you create the resource. * `hosts`: The list of host patterns to match. They must be valid hostnames, except * will match any string of ([a-z0-9-.]*). In that case, * must be the first character and must be followed in the pattern by either - or .. * `path_matcher`: The name of the PathMatcher to use to match the path portion of the URL if the hostRule matches the URL's host portion. - * `id`: The unique identifier for the resource. - - * `fingerprint`: Fingerprint of this resource. This field is used internally during updates of this resource. - * `name`: Name of the resource. Provided by the client when the resource is created. The name must be 1-63 characters long, and comply with RFC1035. Specifically, the name must be 1-63 characters long and match the regular expression `[a-z]([-a-z0-9]*[a-z0-9])?` which means the first character must be a lowercase letter, and all following characters must be a dash, lowercase letter, or digit, except the last character, which cannot be a dash. * `path_matchers`: The list of named PathMatchers to use against the URL. - * `default_service`: A reference to a BackendService resource. This will be used if none of the pathRules defined by this PathMatcher is matched by the URL's path portion. - - * `description`: An optional description of this resource. + * `default_service`: The BackendService resource. This will be used if none of the pathRules or routeRules defined by this PathMatcher are matched. For example, the following are all valid URLs to a BackendService resource: - http s://www.googleapis.com/compute/v1/projects/project/global/backendServices/backen dService - compute/v1/projects/project/global/backendServices/backendService - global/backendServices/backendService If defaultRouteAction is additionally specified, advanced routing actions like URL Rewrites, etc. take effect prior to sending the request to the backend. However, if defaultService is specified, defaultRouteAction cannot contain any weightedBackendServices. Conversely, if defaultRouteAction specifies any weightedBackendServices, defaultService must not be specified. Only one of defaultService, defaultUrlRedirect or defaultRouteAction.weightedBackendService must be set. Authorization requires one or more of the following Google IAM permissions on the specified resource default_service: - compute.backendBuckets.use - compute.backendServices.use - * `name`: The name to which this PathMatcher is referred by the HostRule. + * `description`: An optional description of this resource. Provide this property when you create the resource. * `path_rules`: The list of path rules. @@ -64,7 +62,9 @@ Properties that can be accessed from the `google_compute_url_map` resource: * `service`: A reference to the BackendService resource if this rule is matched. - * `tests`: The list of expected URL mappings. Requests to update this UrlMap will succeed only if all of the test cases pass. + * `name`: The name to which this PathMatcher is referred by the HostRule. + + * `tests`: The list of expected URL mapping tests. Request to update this UrlMap will succeed only if all of the test cases pass. You can specify a maximum of 100 tests per UrlMap. * `description`: Description of this test case. @@ -72,7 +72,7 @@ Properties that can be accessed from the `google_compute_url_map` resource: * `path`: Path portion of the URL. - * `service`: A reference to expected BackendService resource the given URL should be mapped to. + * `service`: Expected BackendService resource the given URL should be mapped to. ## GCP Permissions diff --git a/docs/resources/google_compute_url_maps.md b/docs/resources/google_compute_url_maps.md index 9f98d9c4f..219bb7053 100644 --- a/docs/resources/google_compute_url_maps.md +++ b/docs/resources/google_compute_url_maps.md @@ -17,12 +17,12 @@ end Properties that can be accessed from the `google_compute_url_maps` resource: See [google_compute_url_map.md](google_compute_url_map.md) for more detailed information + * `ids`: an array of `google_compute_url_map` id * `creation_timestamps`: an array of `google_compute_url_map` creation_timestamp * `default_services`: an array of `google_compute_url_map` default_service * `descriptions`: an array of `google_compute_url_map` description - * `host_rules`: an array of `google_compute_url_map` host_rules - * `ids`: an array of `google_compute_url_map` id * `fingerprints`: an array of `google_compute_url_map` fingerprint + * `host_rules`: an array of `google_compute_url_map` host_rules * `names`: an array of `google_compute_url_map` name * `path_matchers`: an array of `google_compute_url_map` path_matchers * `tests`: an array of `google_compute_url_map` tests diff --git a/libraries/google/compute/property/urlmap_path_matchers.rb b/libraries/google/compute/property/urlmap_path_matchers.rb index da8563514..f2b3a0a20 100644 --- a/libraries/google/compute/property/urlmap_path_matchers.rb +++ b/libraries/google/compute/property/urlmap_path_matchers.rb @@ -22,17 +22,17 @@ class UrlMapPathMatchers attr_reader :description - attr_reader :name - attr_reader :path_rules + attr_reader :name + def initialize(args = nil, parent_identifier = nil) return if args.nil? @parent_identifier = parent_identifier @default_service = args['defaultService'] @description = args['description'] - @name = args['name'] @path_rules = GoogleInSpec::Compute::Property::UrlMapPathMatchersPathRulesArray.parse(args['pathRules'], to_s) + @name = args['name'] end def to_s diff --git a/libraries/google_compute_url_map.rb b/libraries/google_compute_url_map.rb index 2801f8be1..cff61a393 100644 --- a/libraries/google_compute_url_map.rb +++ b/libraries/google_compute_url_map.rb @@ -25,12 +25,12 @@ class ComputeUrlMap < GcpResourceBase supports platform: 'gcp' attr_reader :params + attr_reader :id attr_reader :creation_timestamp attr_reader :default_service attr_reader :description - attr_reader :host_rules - attr_reader :id attr_reader :fingerprint + attr_reader :host_rules attr_reader :name attr_reader :path_matchers attr_reader :tests @@ -43,12 +43,12 @@ def initialize(params) end def parse + @id = @fetched['id'] @creation_timestamp = parse_time_string(@fetched['creationTimestamp']) @default_service = @fetched['defaultService'] @description = @fetched['description'] - @host_rules = GoogleInSpec::Compute::Property::UrlMapHostRulesArray.parse(@fetched['hostRules'], to_s) - @id = @fetched['id'] @fingerprint = @fetched['fingerprint'] + @host_rules = GoogleInSpec::Compute::Property::UrlMapHostRulesArray.parse(@fetched['hostRules'], to_s) @name = @fetched['name'] @path_matchers = GoogleInSpec::Compute::Property::UrlMapPathMatchersArray.parse(@fetched['pathMatchers'], to_s) @tests = GoogleInSpec::Compute::Property::UrlMapTestsArray.parse(@fetched['tests'], to_s) diff --git a/libraries/google_compute_url_maps.rb b/libraries/google_compute_url_maps.rb index 3b0295761..9cfba453a 100644 --- a/libraries/google_compute_url_maps.rb +++ b/libraries/google_compute_url_maps.rb @@ -23,12 +23,12 @@ class ComputeUrlMaps < GcpResourceBase filter_table_config = FilterTable.create + filter_table_config.add(:ids, field: :id) filter_table_config.add(:creation_timestamps, field: :creation_timestamp) filter_table_config.add(:default_services, field: :default_service) filter_table_config.add(:descriptions, field: :description) - filter_table_config.add(:host_rules, field: :host_rules) - filter_table_config.add(:ids, field: :id) filter_table_config.add(:fingerprints, field: :fingerprint) + filter_table_config.add(:host_rules, field: :host_rules) filter_table_config.add(:names, field: :name) filter_table_config.add(:path_matchers, field: :path_matchers) filter_table_config.add(:tests, field: :tests) @@ -71,12 +71,12 @@ def transform(key, value) def transformers { + 'id' => ->(obj) { return :id, obj['id'] }, 'creationTimestamp' => ->(obj) { return :creation_timestamp, parse_time_string(obj['creationTimestamp']) }, 'defaultService' => ->(obj) { return :default_service, obj['defaultService'] }, 'description' => ->(obj) { return :description, obj['description'] }, - 'hostRules' => ->(obj) { return :host_rules, GoogleInSpec::Compute::Property::UrlMapHostRulesArray.parse(obj['hostRules'], to_s) }, - 'id' => ->(obj) { return :id, obj['id'] }, 'fingerprint' => ->(obj) { return :fingerprint, obj['fingerprint'] }, + 'hostRules' => ->(obj) { return :host_rules, GoogleInSpec::Compute::Property::UrlMapHostRulesArray.parse(obj['hostRules'], to_s) }, 'name' => ->(obj) { return :name, obj['name'] }, 'pathMatchers' => ->(obj) { return :path_matchers, GoogleInSpec::Compute::Property::UrlMapPathMatchersArray.parse(obj['pathMatchers'], to_s) }, 'tests' => ->(obj) { return :tests, GoogleInSpec::Compute::Property::UrlMapTestsArray.parse(obj['tests'], to_s) },