Skip to content
This repository has been archived by the owner on Dec 31, 2023. It is now read-only.

chore: use gapic-generator-python 0.58.1 #258

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions google/cloud/monitoring_v3/services/metric_service/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -166,14 +166,14 @@ def transport(self) -> MetricServiceTransport:
return self._transport

'''@staticmethod
def metric_descriptor_path(project: str,) -> str:
def metric_descriptor_path(project: str,metric_descriptor: str,) -> str:
"""Returns a fully-qualified metric_descriptor string."""
return "projects/{project}/metricDescriptors/{metric_descriptor=**}".format(project=project, )
return "projects/{project}/metricDescriptors/{metric_descriptor=**}".format(project=project, metric_descriptor=metric_descriptor, )

@staticmethod
def parse_metric_descriptor_path(path: str) -> Dict[str,str]:
"""Parses a metric_descriptor path into its component segments."""
m = re.match(r"^projects/(?P<project>.+?)/metricDescriptors/{metric_descriptor=**}$", path)
m = re.match(r"^projects/(?P<project>.+?)/metricDescriptors/(?P<metric_descriptor>.+?)$", path)
return m.groupdict() if m else {}'''

@staticmethod
Expand Down
48 changes: 25 additions & 23 deletions tests/unit/gapic/monitoring_v3/test_metric_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -3548,14 +3548,16 @@ def test_metric_service_transport_channel_mtls_with_adc(transport_class):

"""def test_metric_descriptor_path():
project = "squid"
expected = "projects/{project}/metricDescriptors/{metric_descriptor=**}".format(project=project, )
actual = MetricServiceClient.metric_descriptor_path(project)
metric_descriptor = "clam"
expected = "projects/{project}/metricDescriptors/{metric_descriptor=**}".format(project=project, metric_descriptor=metric_descriptor, )
actual = MetricServiceClient.metric_descriptor_path(project, metric_descriptor)
assert expected == actual


def test_parse_metric_descriptor_path():
expected = {
"project": "clam",
"project": "whelk",
"metric_descriptor": "octopus",
}
path = MetricServiceClient.metric_descriptor_path(**expected)

Expand All @@ -3567,8 +3569,8 @@ def test_parse_metric_descriptor_path():


def test_monitored_resource_descriptor_path():
project = "whelk"
monitored_resource_descriptor = "octopus"
project = "oyster"
monitored_resource_descriptor = "nudibranch"
expected = "projects/{project}/monitoredResourceDescriptors/{monitored_resource_descriptor}".format(
project=project, monitored_resource_descriptor=monitored_resource_descriptor,
)
Expand All @@ -3580,8 +3582,8 @@ def test_monitored_resource_descriptor_path():

def test_parse_monitored_resource_descriptor_path():
expected = {
"project": "oyster",
"monitored_resource_descriptor": "nudibranch",
"project": "cuttlefish",
"monitored_resource_descriptor": "mussel",
}
path = MetricServiceClient.monitored_resource_descriptor_path(**expected)

Expand All @@ -3591,8 +3593,8 @@ def test_parse_monitored_resource_descriptor_path():


def test_time_series_path():
project = "cuttlefish"
time_series = "mussel"
project = "winkle"
time_series = "nautilus"
expected = "projects/{project}/timeSeries/{time_series}".format(
project=project, time_series=time_series,
)
Expand All @@ -3602,8 +3604,8 @@ def test_time_series_path():

def test_parse_time_series_path():
expected = {
"project": "winkle",
"time_series": "nautilus",
"project": "scallop",
"time_series": "abalone",
}
path = MetricServiceClient.time_series_path(**expected)

Expand All @@ -3613,7 +3615,7 @@ def test_parse_time_series_path():


def test_common_billing_account_path():
billing_account = "scallop"
billing_account = "squid"
expected = "billingAccounts/{billing_account}".format(
billing_account=billing_account,
)
Expand All @@ -3623,7 +3625,7 @@ def test_common_billing_account_path():

def test_parse_common_billing_account_path():
expected = {
"billing_account": "abalone",
"billing_account": "clam",
}
path = MetricServiceClient.common_billing_account_path(**expected)

Expand All @@ -3633,15 +3635,15 @@ def test_parse_common_billing_account_path():


def test_common_folder_path():
folder = "squid"
folder = "whelk"
expected = "folders/{folder}".format(folder=folder,)
actual = MetricServiceClient.common_folder_path(folder)
assert expected == actual


def test_parse_common_folder_path():
expected = {
"folder": "clam",
"folder": "octopus",
}
path = MetricServiceClient.common_folder_path(**expected)

Expand All @@ -3651,15 +3653,15 @@ def test_parse_common_folder_path():


def test_common_organization_path():
organization = "whelk"
organization = "oyster"
expected = "organizations/{organization}".format(organization=organization,)
actual = MetricServiceClient.common_organization_path(organization)
assert expected == actual


def test_parse_common_organization_path():
expected = {
"organization": "octopus",
"organization": "nudibranch",
}
path = MetricServiceClient.common_organization_path(**expected)

Expand All @@ -3669,15 +3671,15 @@ def test_parse_common_organization_path():


def test_common_project_path():
project = "oyster"
project = "cuttlefish"
expected = "projects/{project}".format(project=project,)
actual = MetricServiceClient.common_project_path(project)
assert expected == actual


def test_parse_common_project_path():
expected = {
"project": "nudibranch",
"project": "mussel",
}
path = MetricServiceClient.common_project_path(**expected)

Expand All @@ -3687,8 +3689,8 @@ def test_parse_common_project_path():


def test_common_location_path():
project = "cuttlefish"
location = "mussel"
project = "winkle"
location = "nautilus"
expected = "projects/{project}/locations/{location}".format(
project=project, location=location,
)
Expand All @@ -3698,8 +3700,8 @@ def test_common_location_path():

def test_parse_common_location_path():
expected = {
"project": "winkle",
"location": "nautilus",
"project": "scallop",
"location": "abalone",
}
path = MetricServiceClient.common_location_path(**expected)

Expand Down