Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(monitoring): add monitoring.v3.InternalChecker.state; add monitoring.v3.UptimeCheckConfig.ContentMatcher.ContentMatcherOption; add recursive parameter to delete_group; add read-only validity field to monitoring.v3.AlertPolicy; add validate_ssl parameter to monitoring.v3.UptimeCheckConfig.HttpCheck #9546

Merged
merged 1 commit into from
Nov 13, 2019
Merged
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
2 changes: 1 addition & 1 deletion monitoring/docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -344,7 +344,7 @@
"google-gax": ("https://gax-python.readthedocs.io/en/latest/", None),
"google.api_core": ("https://googleapis.dev/python/google-api-core/latest", None),
"grpc": ("https://grpc.io/grpc/python/", None),
"requests": ("https://requests.kennethreitz.org/en/stable/", None),
"requests": ("https://requests.kennethreitz.org/en/master/", None),
"fastavro": ("https://fastavro.readthedocs.io/en/stable/", None),
"pandas": ("https://pandas.pydata.org/pandas-docs/stable/", None),
}
Expand Down
59 changes: 57 additions & 2 deletions monitoring/google/cloud/monitoring_v3/gapic/enums.py
Original file line number Diff line number Diff line change
Expand Up @@ -148,10 +148,10 @@ class ServiceTier(enum.IntEnum):

class UptimeCheckRegion(enum.IntEnum):
"""
The regions from which an uptime check can be run.
The regions from which an Uptime check can be run.

Attributes:
REGION_UNSPECIFIED (int): Default value if no region is specified. Will result in uptime checks
REGION_UNSPECIFIED (int): Default value if no region is specified. Will result in Uptime checks
running from all regions.
USA (int): Allows checks to run from locations within the United States of America.
EUROPE (int): Allows checks to run from locations within the continent of Europe.
Expand Down Expand Up @@ -397,6 +397,31 @@ class ConditionCombinerType(enum.IntEnum):
AND_WITH_MATCHING_RESOURCE = 3


class InternalChecker(object):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add internal checker

class State(enum.IntEnum):
"""
Operational states for an internal checker.

Attributes:
UNSPECIFIED (int): An internal checker should never be in the unspecified state.
CREATING (int): The checker is being created, provisioned, and configured. A checker in
this state can be returned by ``ListInternalCheckers`` or
``GetInternalChecker``, as well as by examining the `long running
Operation <https://cloud.google.com/apis/design/design_patterns#long_running_operations>`__
that created it.
RUNNING (int): The checker is running and available for use. A checker in this state
can be returned by ``ListInternalCheckers`` or ``GetInternalChecker`` as
well as by examining the `long running
Operation <https://cloud.google.com/apis/design/design_patterns#long_running_operations>`__
that created it. If a checker is being torn down, it is neither visible
nor usable, so there is no "deleting" or "down" state.
"""

UNSPECIFIED = 0
CREATING = 1
RUNNING = 2


class LabelDescriptor(object):
class ValueType(enum.IntEnum):
"""
Expand Down Expand Up @@ -498,3 +523,33 @@ class VerificationStatus(enum.IntEnum):
VERIFICATION_STATUS_UNSPECIFIED = 0
UNVERIFIED = 1
VERIFIED = 2


class UptimeCheckConfig(object):
Copy link
Contributor

@busunkim96 busunkim96 Nov 13, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add monitoring.v3.UptimeCheckConfig.ContentMatcher.ContentMatcherOption

class ContentMatcher(object):
class ContentMatcherOption(enum.IntEnum):
"""
Options to perform content matching.

Attributes:
CONTENT_MATCHER_OPTION_UNSPECIFIED (int): No content matcher type specified (maintained for backward
compatibility, but deprecated for future use). Treated as
``CONTAINS_STRING``.
CONTAINS_STRING (int): Selects substring matching (there is a match if the output contains the
``content`` string). This is the default value for checks without a
``matcher`` option, or where the value of ``matcher`` is
``CONTENT_MATCHER_OPTION_UNSPECIFIED``.
NOT_CONTAINS_STRING (int): Selects negation of substring matching (there is a match if the output
does NOT contain the ``content`` string).
MATCHES_REGEX (int): Selects regular expression matching (there is a match of the output
matches the regular expression specified in the ``content`` string).
NOT_MATCHES_REGEX (int): Selects negation of regular expression matching (there is a match if the
output does NOT match the regular expression specified in the
``content`` string).
"""

CONTENT_MATCHER_OPTION_UNSPECIFIED = 0
CONTAINS_STRING = 1
NOT_CONTAINS_STRING = 2
MATCHES_REGEX = 3
NOT_MATCHES_REGEX = 4
Original file line number Diff line number Diff line change
Expand Up @@ -599,6 +599,7 @@ def update_group(
def delete_group(
self,
name,
recursive=None,
retry=google.api_core.gapic_v1.method.DEFAULT,
timeout=google.api_core.gapic_v1.method.DEFAULT,
metadata=None,
Expand All @@ -618,6 +619,9 @@ def delete_group(
Args:
name (str): The group to delete. The format is
``"projects/{project_id_or_number}/groups/{group_id}"``.
recursive (bool): If this field is true, then the request means to delete a group with all
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add recursive option to delete_group

its descendants. Otherwise, the request means to delete a group only when
it has no descendants. The default value is false.
retry (Optional[google.api_core.retry.Retry]): A retry object used
to retry requests. If ``None`` is specified, requests will
be retried using a default configuration.
Expand Down Expand Up @@ -648,7 +652,7 @@ def delete_group(
client_info=self._client_info,
)

request = group_service_pb2.DeleteGroupRequest(name=name)
request = group_service_pb2.DeleteGroupRequest(name=name, recursive=recursive)
if metadata is None:
metadata = []
metadata = list(metadata)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -236,8 +236,7 @@ def list_monitored_resource_descriptors(
metadata=None,
):
"""
Lists monitored resource descriptors that match a filter. This method does
not require a Stackdriver account.
Lists monitored resource descriptors that match a filter. This method does not require a Stackdriver account.

Example:
>>> from google.cloud import monitoring_v3
Expand Down Expand Up @@ -356,8 +355,7 @@ def get_monitored_resource_descriptor(
metadata=None,
):
"""
Gets a single monitored resource descriptor. This method does not require a
Stackdriver account.
Gets a single monitored resource descriptor. This method does not require a Stackdriver account.

Example:
>>> from google.cloud import monitoring_v3
Expand Down Expand Up @@ -438,8 +436,7 @@ def list_metric_descriptors(
metadata=None,
):
"""
Lists metric descriptors that match a filter. This method does not require
a Stackdriver account.
Lists metric descriptors that match a filter. This method does not require a Stackdriver account.

Example:
>>> from google.cloud import monitoring_v3
Expand Down Expand Up @@ -555,8 +552,7 @@ def get_metric_descriptor(
metadata=None,
):
"""
Gets a single metric descriptor. This method does not require a Stackdriver
account.
Gets a single metric descriptor. This method does not require a Stackdriver account.

Example:
>>> from google.cloud import monitoring_v3
Expand Down Expand Up @@ -797,8 +793,7 @@ def list_time_series(
metadata=None,
):
"""
Lists time series that match a filter. This method does not require a
Stackdriver account.
Lists time series that match a filter. This method does not require a Stackdriver account.

Example:
>>> from google.cloud import monitoring_v3
Expand Down Expand Up @@ -843,7 +838,7 @@ def list_time_series(
::

metric.type = "compute.googleapis.com/instance/cpu/usage_time" AND
metric.label.instance_name = "my-instance-name"
metric.labels.instance_name = "my-instance-name"
busunkim96 marked this conversation as resolved.
Show resolved Hide resolved
interval (Union[dict, ~google.cloud.monitoring_v3.types.TimeInterval]): The time interval for which results should be returned. Only time series
that contain data points in the specified interval are included
in the response.
Expand Down Expand Up @@ -972,6 +967,9 @@ def create_time_series(
value must fully specify a unique time series by supplying all label
values for the metric and the monitored resource.

The maximum number of ``TimeSeries`` objects per ``Create`` request is
200.

If a dict is provided, it must be of the same form as the protobuf
message :class:`~google.cloud.monitoring_v3.types.TimeSeries`
retry (Optional[google.api_core.retry.Retry]): A retry object used
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,8 +116,7 @@ def channel(self):
def list_monitored_resource_descriptors(self):
"""Return the gRPC stub for :meth:`MetricServiceClient.list_monitored_resource_descriptors`.

Lists monitored resource descriptors that match a filter. This method does
not require a Stackdriver account.
Lists monitored resource descriptors that match a filter. This method does not require a Stackdriver account.

Returns:
Callable: A callable which accepts the appropriate
Expand All @@ -130,8 +129,7 @@ def list_monitored_resource_descriptors(self):
def get_monitored_resource_descriptor(self):
"""Return the gRPC stub for :meth:`MetricServiceClient.get_monitored_resource_descriptor`.

Gets a single monitored resource descriptor. This method does not require a
Stackdriver account.
Gets a single monitored resource descriptor. This method does not require a Stackdriver account.

Returns:
Callable: A callable which accepts the appropriate
Expand All @@ -144,8 +142,7 @@ def get_monitored_resource_descriptor(self):
def list_metric_descriptors(self):
"""Return the gRPC stub for :meth:`MetricServiceClient.list_metric_descriptors`.

Lists metric descriptors that match a filter. This method does not require
a Stackdriver account.
Lists metric descriptors that match a filter. This method does not require a Stackdriver account.

Returns:
Callable: A callable which accepts the appropriate
Expand All @@ -158,8 +155,7 @@ def list_metric_descriptors(self):
def get_metric_descriptor(self):
"""Return the gRPC stub for :meth:`MetricServiceClient.get_metric_descriptor`.

Gets a single metric descriptor. This method does not require a Stackdriver
account.
Gets a single metric descriptor. This method does not require a Stackdriver account.

Returns:
Callable: A callable which accepts the appropriate
Expand Down Expand Up @@ -201,8 +197,7 @@ def delete_metric_descriptor(self):
def list_time_series(self):
"""Return the gRPC stub for :meth:`MetricServiceClient.list_time_series`.

Lists time series that match a filter. This method does not require a
Stackdriver account.
Lists time series that match a filter. This method does not require a Stackdriver account.

Returns:
Callable: A callable which accepts the appropriate
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,8 +118,8 @@ def channel(self):
def list_uptime_check_configs(self):
"""Return the gRPC stub for :meth:`UptimeCheckServiceClient.list_uptime_check_configs`.

Lists the existing valid uptime check configurations for the project,
leaving out any invalid configurations.
Lists the existing valid Uptime check configurations for the project
(leaving out any invalid configurations).

Returns:
Callable: A callable which accepts the appropriate
Expand All @@ -132,7 +132,7 @@ def list_uptime_check_configs(self):
def get_uptime_check_config(self):
"""Return the gRPC stub for :meth:`UptimeCheckServiceClient.get_uptime_check_config`.

Gets a single uptime check configuration.
Gets a single Uptime check configuration.

Returns:
Callable: A callable which accepts the appropriate
Expand All @@ -145,7 +145,7 @@ def get_uptime_check_config(self):
def create_uptime_check_config(self):
"""Return the gRPC stub for :meth:`UptimeCheckServiceClient.create_uptime_check_config`.

Creates a new uptime check configuration.
Creates a new Uptime check configuration.

Returns:
Callable: A callable which accepts the appropriate
Expand All @@ -158,10 +158,10 @@ def create_uptime_check_config(self):
def update_uptime_check_config(self):
"""Return the gRPC stub for :meth:`UptimeCheckServiceClient.update_uptime_check_config`.

Updates an uptime check configuration. You can either replace the entire
Updates an Uptime check configuration. You can either replace the entire
configuration with a new one or replace only certain fields in the
current configuration by specifying the fields to be updated via
``"updateMask"``. Returns the updated configuration.
``updateMask``. Returns the updated configuration.

Returns:
Callable: A callable which accepts the appropriate
Expand All @@ -174,8 +174,8 @@ def update_uptime_check_config(self):
def delete_uptime_check_config(self):
"""Return the gRPC stub for :meth:`UptimeCheckServiceClient.delete_uptime_check_config`.

Deletes an uptime check configuration. Note that this method will fail
if the uptime check configuration is referenced by an alert policy or
Deletes an Uptime check configuration. Note that this method will fail
if the Uptime check configuration is referenced by an alert policy or
other dependent configs that would be rendered invalid by the deletion.

Returns:
Expand All @@ -189,7 +189,7 @@ def delete_uptime_check_config(self):
def list_uptime_check_ips(self):
"""Return the gRPC stub for :meth:`UptimeCheckServiceClient.list_uptime_check_ips`.

Returns the list of IPs that checkers run from
Returns the list of IP addresses that checkers run from

Returns:
Callable: A callable which accepts the appropriate
Expand Down
Loading