Skip to content

Commit

Permalink
fix: CustomDimension and CustomMetric resource configuration (#222)
Browse files Browse the repository at this point in the history
* fix: CustomDimension and CustomMetric resource configuration in Analytics Admin API

PiperOrigin-RevId: 448304423

Source-Link: googleapis/googleapis@d018d54

Source-Link: googleapis/googleapis-gen@6c363ee
Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiNmMzNjNlZWEwZjk5ZDAwYTIxNmE0ZWZjODAxNWU2OTI3MmNjYWE4MyJ9

* 🦉 Updates from OwlBot post-processor

See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md

Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
  • Loading branch information
gcf-owl-bot[bot] and gcf-owl-bot[bot] authored May 13, 2022
1 parent cb32975 commit 97653d3
Show file tree
Hide file tree
Showing 2 changed files with 82 additions and 65 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -220,31 +220,40 @@ def parse_conversion_event_path(path: str) -> Dict[str, str]:
@staticmethod
def custom_dimension_path(
property: str,
custom_dimension: str,
) -> str:
"""Returns a fully-qualified custom_dimension string."""
return "properties/{property}/customDimensions".format(
return "properties/{property}/customDimensions/{custom_dimension}".format(
property=property,
custom_dimension=custom_dimension,
)

@staticmethod
def parse_custom_dimension_path(path: str) -> Dict[str, str]:
"""Parses a custom_dimension path into its component segments."""
m = re.match(r"^properties/(?P<property>.+?)/customDimensions$", path)
m = re.match(
r"^properties/(?P<property>.+?)/customDimensions/(?P<custom_dimension>.+?)$",
path,
)
return m.groupdict() if m else {}

@staticmethod
def custom_metric_path(
property: str,
custom_metric: str,
) -> str:
"""Returns a fully-qualified custom_metric string."""
return "properties/{property}/customMetrics".format(
return "properties/{property}/customMetrics/{custom_metric}".format(
property=property,
custom_metric=custom_metric,
)

@staticmethod
def parse_custom_metric_path(path: str) -> Dict[str, str]:
"""Parses a custom_metric path into its component segments."""
m = re.match(r"^properties/(?P<property>.+?)/customMetrics$", path)
m = re.match(
r"^properties/(?P<property>.+?)/customMetrics/(?P<custom_metric>.+?)$", path
)
return m.groupdict() if m else {}

@staticmethod
Expand Down
Loading

0 comments on commit 97653d3

Please sign in to comment.